Ejemplo n.º 1
0
 /**
  * Show the Permissions for this Campaign
  */
 public function PermissionsForm()
 {
     $db =& $this->db;
     $user =& $this->user;
     $response = new ResponseManager();
     $campaignId = Kit::GetParam('CampaignID', _GET, _INT);
     $auth = $this->user->CampaignAuth($campaignId, true);
     if (!$auth->modifyPermissions) {
         trigger_error(__('You do not have permissions to edit this campaign'), E_USER_ERROR);
     }
     // Set some information about the form
     Theme::Set('form_id', 'CampaignPermissionsForm');
     Theme::Set('form_action', 'index.php?p=campaign&q=Permissions');
     Theme::Set('form_meta', '<input type="hidden" name="campaignId" value="' . $campaignId . '" />');
     // List of all Groups with a view / edit / delete check box
     $permissions = new CampaignSecurity();
     if (!($result = $permissions->GetPermissions($campaignId))) {
         trigger_error($permissions->GetErrorMessage(), E_USER_ERROR);
     }
     if (count($result) <= 0) {
         trigger_error(__('Unable to get permissions for this Campaign'), 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);
     $formFields[] = FormManager::AddCheckbox('replaceInLayouts', __('Update these permissions on all layouts, regions and media.'), 0, __('Note: It will only be replaced in layouts you have permission to edit.'), 'r');
     $users = $user->userList(array('userName'));
     $users[] = array('userid' => -1, 'username' => '');
     $formFields[] = FormManager::AddCombo('ownerId', __('Owner'), -1, $users, 'userid', 'username', __('Change the Owner of this item. Leave empty to keep the current owner.'), 'o');
     Theme::Set('form_fields', $formFields);
     $form = Theme::RenderReturn('form_render');
     $response->SetFormRequestResponse($form, __('Permissions'), '350px', '500px');
     $response->AddButton(__('Help'), 'XiboHelpRender("' . HelpManager::Link('Campaign', 'Permissions') . '")');
     $response->AddButton(__('Cancel'), 'XiboDialogClose()');
     $response->AddButton(__('Save'), '$("#CampaignPermissionsForm").submit()');
     $response->Respond();
 }
Ejemplo n.º 2
0
 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();
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 4
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();
 }