public function GetPermissions($objectId)
 {
     $userGroup = new UserGroup();
     if (!($result = $userGroup->GetPermissionsForObject('lkcampaigngroup', 'CampaignID', $objectId))) {
         return $this->SetError($userGroup->GetErrorMessage());
     }
     return $result;
 }
 public function ListSecurity($dataSetId, $groupId)
 {
     if ($dataSetId == 0 || $dataSetId == '') {
         return $this->SetError(25001, __('Missing dataSetId'));
     }
     $userGroup = new UserGroup();
     if (!($result = $userGroup->GetPermissionsForObject('lkdatasetgroup', 'DataSetID', $dataSetId))) {
         return $this->SetError($userGroup->GetErrorMessage());
     }
     $security = array();
     foreach ($result as $row) {
         $security[] = array('groupid' => Kit::ValidateParam($row['groupid'], _INT), 'group' => Kit::ValidateParam($row['group'], _STRING), 'view' => Kit::ValidateParam($row['view'], _INT), 'edit' => Kit::ValidateParam($row['edit'], _INT), 'del' => Kit::ValidateParam($row['del'], _INT), 'isuserspecific' => Kit::ValidateParam($row['isuserspecific'], _INT));
     }
     return $security;
 }
Пример #3
0
 /**
  * Permissions form
  */
 public function PermissionsForm()
 {
     $db =& $this->db;
     $user =& $this->user;
     $response = new ResponseManager();
     $helpManager = new HelpManager($db, $user);
     if (!$this->auth->modifyPermissions) {
         trigger_error(__('You do not have permissions to edit this media'), E_USER_ERROR);
     }
     // List of all Groups with a view / edit / delete check box
     $permissions = new UserGroup();
     if ($this->assignedMedia) {
         if (!($result = $permissions->GetPermissionsForObject('lklayoutmediagroup', NULL, NULL, sprintf(" AND lklayoutmediagroup.MediaID = '%s' AND lklayoutmediagroup.RegionID = '%s' AND lklayoutmediagroup.LayoutID = %d ", $this->mediaid, $this->regionid, $this->layoutid)))) {
             trigger_error($permissions->GetErrorMessage(), E_USER_ERROR);
         }
     } else {
         if (!($result = $permissions->GetPermissionsForObject('lkmediagroup', 'MediaID', $this->mediaid))) {
             trigger_error($permissions->GetErrorMessage(), E_USER_ERROR);
         }
     }
     if (count($result) <= 0) {
         trigger_error(__('Unable to get permissions'), E_USER_ERROR);
     }
     $checkboxes = array();
     foreach ($result 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);
     // Set some information about the form
     Theme::Set('form_id', 'LayoutPermissionsForm');
     Theme::Set('form_action', 'index.php?p=module&mod=' . $this->type . '&q=Exec&method=Permissions');
     Theme::Set('form_meta', '<input type="hidden" name="layoutid" value="' . $this->layoutid . '" /><input type="hidden" name="regionid" value="' . $this->regionid . '" /><input type="hidden" name="mediaid" value="' . $this->mediaid . '" />');
     $response->SetFormRequestResponse(NULL, __('Permissions'), '350px', '500px');
     $response->AddButton(__('Help'), 'XiboHelpRender("' . ($this->layoutid != 0 ? $helpManager->Link('LayoutMedia', 'Permissions') : $helpManager->Link('Media', 'Permissions')) . '")');
     if ($this->assignedMedia) {
         $response->AddButton(__('Cancel'), 'XiboSwapDialog("index.php?p=timeline&layoutid=' . $this->layoutid . '&regionid=' . $this->regionid . '&q=RegionOptions")');
     } else {
         $response->AddButton(__('Cancel'), 'XiboDialogClose()');
     }
     $response->AddButton(__('Save'), '$("#LayoutPermissionsForm").submit()');
     return $response;
 }
Пример #4
0
 /**
  * Show the Permissions for this Display Group
  */
 public function PermissionsForm()
 {
     $db =& $this->db;
     $user =& $this->user;
     $response = new ResponseManager();
     $helpManager = new HelpManager($db, $user);
     $displayGroupId = Kit::GetParam('DisplayGroupID', _GET, _INT);
     $auth = $this->user->DisplayGroupAuth($displayGroupId, true);
     if (!$auth->modifyPermissions) {
         trigger_error(__('You do not have permissions to edit this display group'), E_USER_ERROR);
     }
     // Set some information about the form
     Theme::Set('form_id', 'DisplayGroupPermissionsForm');
     Theme::Set('form_action', 'index.php?p=displaygroup&q=Permissions');
     Theme::Set('form_meta', '<input type="hidden" name="displayGroupId" value="' . $displayGroupId . '" />');
     // List of all Groups with a view / edit / delete check box
     $permissions = new UserGroup();
     if (!($result = $permissions->GetPermissionsForObject('lkdisplaygroupgroup', 'DisplayGroupID', $displayGroupId))) {
         trigger_error($permissions->GetErrorMessage(), E_USER_ERROR);
     }
     if (count($result) <= 0) {
         trigger_error(__('Unable to get permissions for this Display Group'), E_USER_ERROR);
     }
     $checkboxes = array();
     foreach ($result 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('DisplayGroup', 'Permissions') . '")');
     $response->AddButton(__('Cancel'), 'XiboDialogClose()');
     $response->AddButton(__('Save'), '$("#DisplayGroupPermissionsForm").submit()');
     $response->Respond();
 }
Пример #5
0
 public function RegionPermissionsForm()
 {
     $db =& $this->db;
     $user =& $this->user;
     $response = new ResponseManager();
     $helpManager = new HelpManager($db, $user);
     $layoutid = Kit::GetParam('layoutid', _GET, _INT);
     $regionid = Kit::GetParam('regionid', _GET, _STRING);
     Kit::ClassLoader('region');
     $region = new region($db);
     $ownerId = $region->GetOwnerId($layoutid, $regionid);
     $regionAuth = $this->user->RegionAssignmentAuth($ownerId, $layoutid, $regionid, true);
     if (!$regionAuth->modifyPermissions) {
         trigger_error(__("You do not have permissions to edit this regions permissions"), E_USER_ERROR);
     }
     // List of all Groups with a view / edit / delete check box
     $permissions = new UserGroup();
     if (!($result = $permissions->GetPermissionsForObject('lklayoutregiongroup', NULL, NULL, sprintf(" AND lklayoutregiongroup.LayoutID = %d AND lklayoutregiongroup.RegionID = '%s' ", $layoutid, $regionid)))) {
         trigger_error($permissions->GetErrorMessage(), E_USER_ERROR);
     }
     if (count($result) <= 0) {
         trigger_error(__('Unable to get permissions'), E_USER_ERROR);
     }
     $checkboxes = array();
     foreach ($result 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);
     // Set some information about the form
     Theme::Set('form_id', 'RegionPermissionsForm');
     Theme::Set('form_action', 'index.php?p=timeline&q=RegionPermissions');
     Theme::Set('form_meta', '<input type="hidden" name="layoutid" value="' . $layoutid . '" /><input type="hidden" name="regionid" value="' . $regionid . '" />');
     $response->SetFormRequestResponse(NULL, __('Permissions'), '350px', '500px');
     $response->AddButton(__('Help'), 'XiboHelpRender("' . $helpManager->Link('Region', 'Permissions') . '")');
     $response->AddButton(__('Cancel'), 'XiboDialogClose()');
     $response->AddButton(__('Save'), '$("#RegionPermissionsForm").submit()');
     $response->Respond();
 }