/** * DataSet Security List * @return <XiboAPIResponse> */ public function DataSetSecurityList() { // Auth if (!$this->user->PageAuth('dataset')) { return $this->Error(1, 'Access Denied'); } $dataSetId = $this->GetParam('dataSetId', _INT); $auth = $this->user->DataSetAuth($dataSetId, true); if (!$auth->view) { return $this->Error(1, 'Access Denied'); } Kit::ClassLoader('datasetgroupsecurity'); $security = new DataSetGroupSecurity(); if (!($results = $security->ListSecurity($dataSetId, $this->user->getGroupFromId($this->user->userid, true)))) { return $this->Error($security->GetErrorNumber(), $security->GetErrorMessage()); } return $this->Respond($this->NodeListFromArray($results, 'datasetgroupsecurity')); }
public function PermissionsForm() { $db =& $this->db; $user =& $this->user; $response = new ResponseManager(); $helpManager = new HelpManager($db, $user); $dataSetId = Kit::GetParam('datasetid', _GET, _INT); $auth = $this->user->DataSetAuth($dataSetId, true); if (!$auth->modifyPermissions) { trigger_error(__('You do not have permissions to edit this dataset'), E_USER_ERROR); } // Set some information about the form Theme::Set('form_id', 'DataSetPermissionsForm'); Theme::Set('form_action', 'index.php?p=dataset&q=Permissions'); Theme::Set('form_meta', '<input type="hidden" name="datasetid" value="' . $dataSetId . '" />'); // List of all Groups with a view/edit/delete checkbox Kit::ClassLoader('datasetgroupsecurity'); $security = new DataSetGroupSecurity($this->db); if (!($results = $security->ListSecurity($dataSetId, $user->getGroupFromId($user->userid, true)))) { trigger_error(__('Unable to get permissions for this dataset'), E_USER_ERROR); } $checkboxes = array(); foreach ($results as $row) { $groupId = $row['groupid']; $rowClass = $row['isuserspecific'] == 0 ? 'strong_text' : ''; $checkbox = array('id' => $groupId, 'name' => Kit::ValidateParam($row['group'], _STRING), 'class' => $rowClass, 'value_view' => $groupId . '_view', 'value_view_checked' => $row['view'] == 1 ? 'checked' : '', 'value_edit' => $groupId . '_edit', 'value_edit_checked' => $row['edit'] == 1 ? 'checked' : '', 'value_del' => $groupId . '_del', 'value_del_checked' => $row['del'] == 1 ? 'checked' : ''); $checkboxes[] = $checkbox; } $formFields = array(); $formFields[] = FormManager::AddPermissions('groupids[]', $checkboxes); Theme::Set('form_fields', $formFields); $response->SetFormRequestResponse(NULL, __('Permissions'), '350px', '500px'); $response->AddButton(__('Help'), 'XiboHelpRender("' . $helpManager->Link('DataSet', 'Permissions') . '")'); $response->AddButton(__('Cancel'), 'XiboDialogClose()'); $response->AddButton(__('Save'), '$("#DataSetPermissionsForm").submit()'); $response->Respond(); }