public function save() { if (Loader::helper('validation/token')->validate('save_permissions')) { $fs = FileSet::getGlobal(); $tp = new TaskPermission(); if ($tp->canAccessTaskPermissions()) { $permissions = PermissionKey::getList('file_set'); foreach ($permissions as $pk) { $pk->setPermissionObject($fs); $paID = $_POST['pkID'][$pk->getPermissionKeyID()]; $pt = $pk->getPermissionAssignmentObject(); $pt->clearPermissionAssignment(); if ($paID > 0) { $pa = PermissionAccess::getByID($paID, $pk); if (is_object($pa)) { $pt->assignPermissionAccess($pa); } } } $this->redirect('/dashboard/system/permissions/files', 'updated'); } } else { $this->error->add(Loader::helper("validation/token")->getErrorMessage()); } }
public function save() { if (Loader::helper('validation/token')->validate('save_permissions')) { $tp = new TaskPermission(); if ($tp->canAccessTaskPermissions()) { $permissions = PermissionKey::getList('sitemap'); $permissions = array_merge($permissions, PermissionKey::getList('marketplace_newsflow')); $permissions = array_merge($permissions, PermissionKey::getList('admin')); foreach ($permissions as $pk) { $paID = $_POST['pkID'][$pk->getPermissionKeyID()]; $pt = $pk->getPermissionAssignmentObject(); $pt->clearPermissionAssignment(); if ($paID > 0) { $pa = PermissionAccess::getByID($paID, $pk); if (is_object($pa)) { $pt->assignPermissionAccess($pa); } } } $this->redirect('/dashboard/system/permissions/tasks', 'updated'); } } else { $this->error->add(Loader::helper("validation/token")->getErrorMessage()); } }
/** * @see \C5TL\Parser\DynamicItem::parseManual() */ public function parseManual(\Gettext\Translations $translations, $concrete5version) { if (class_exists('\\PermissionKeyCategory', true) && method_exists('\\PermissionKeyCategory', 'getList')) { foreach (\PermissionKeyCategory::getList() as $pkc) { $pkcHandle = $pkc->getPermissionKeyCategoryHandle(); foreach (\PermissionKey::getList($pkcHandle) as $pk) { $this->addTranslation($translations, $pk->getPermissionKeyName(), 'PermissionKeyName'); $this->addTranslation($translations, $pk->getPermissionKeyDescription(), 'PermissionKeyDescription'); } } } }
public function updateDetails($post) { $permissions = PermissionKey::getList('basic_workflow'); foreach($permissions as $pk) { $pk->setPermissionObject($this); $pt = $pk->getPermissionAssignmentObject(); $paID = $post['pkID'][$pk->getPermissionKeyID()]; $pt->clearPermissionAssignment(); if ($paID > 0) { $pa = PermissionAccess::getByID($paID, $pk); if (is_object($pa)) { $pt->assignPermissionAccess($pa); } } } }
public function approve(WorkflowProgress $wp) { $c = Page::getByID($this->getRequestedPageID()); $permissions = PermissionKey::getList('page'); $ps = $this->getPagePermissionSet(); $assignments = $ps->getPermissionAssignments(); foreach ($permissions as $pk) { $paID = $assignments[$pk->getPermissionKeyID()]; $pk->setPermissionObject($c); $pt = $pk->getPermissionAssignmentObject(); $pt->clearPermissionAssignment(); if ($paID > 0) { $pa = PermissionAccess::getByID($paID, $pk); if (is_object($pa)) { $pt->assignPermissionAccess($pa); } } } $c->refreshCache(); $wpr = new WorkflowProgressResponse(); $wpr->setWorkflowProgressResponseURL(BASE_URL . DIR_REL . '/' . DISPATCHER_FILENAME . '?cID=' . $c->getCollectionID()); return $wpr; }
<?php $cat = PermissionKeyCategory::getByHandle($handle); ?> <form method="post" id="ccm-permission-list-form" action="<?php echo $cat->getToolsURL("save_permission_assignments"); ?> &treeNodeID=<?php echo $node->getTreeNodeID(); ?> "> <table class="ccm-permission-grid table table-striped"> <?php $permissions = PermissionKey::getList($handle); foreach ($permissions as $pk) { $pk->setPermissionObject($node); ?> <tr> <td class="ccm-permission-grid-name" id="ccm-permission-grid-name-<?php echo $pk->getPermissionKeyID(); ?> "><strong><?php if ($enablePermissions) { ?> <a dialog-title="<?php echo $pk->getPermissionKeyDisplayName(); ?> " data-pkID="<?php echo $pk->getPermissionKeyID();
$pe = PermissionAccessEntity::getByID($_REQUEST['peID']); $pa->removeListItem($pe); } if ($_REQUEST['task'] == 'save_permission' && Loader::helper("validation/token")->validate('save_permission')) { $pk = AreaPermissionKey::getByID($_REQUEST['pkID']); $pk->setPermissionObject($ax); $pa = PermissionAccess::getByID($_REQUEST['paID'], $pk); $pa->save($_POST); } if ($_REQUEST['task'] == 'display_access_cell' && Loader::helper("validation/token")->validate('display_access_cell')) { $pk = PermissionKey::getByID($_REQUEST['pkID']); $pa = PermissionAccess::getByID($_REQUEST['paID'], $pk); Loader::element('permission/labels', array('pk' => $pk, 'pa' => $pa)); } if ($_REQUEST['task'] == 'save_permission_assignments' && Loader::helper("validation/token")->validate('save_permission_assignments')) { $permissions = PermissionKey::getList('area'); foreach ($permissions as $pk) { $paID = $_POST['pkID'][$pk->getPermissionKeyID()]; $pk->setPermissionObject($ax); $pt = $pk->getPermissionAssignmentObject(); $pt->clearPermissionAssignment(); if ($paID > 0) { $pa = PermissionAccess::getByID($paID, $pk); if (is_object($pa)) { $pt->assignPermissionAccess($pa); } } } } } }
public function file_sets_edit(){ extract($this->getHelperObjects()); Loader::model('file_set'); //do my editing if (!$validation_token->validate("file_sets_edit")) { $this->set('error', array($validation_token->getErrorMessage())); $this->view(); return; } if(!$this->post('fsID')){ $this->set('error', array(t('Invalid ID'))); $this->view(); } $file_set = new FileSet(); $file_set->Load('fsID = ?', $this->post('fsID')); $file_set->fsName = $this->post('file_set_name'); $copyPermissionsFromBase = false; if ($file_set->fsOverrideGlobalPermissions == 0 && $this->post('fsOverrideGlobalPermissions') == 1) { // we are checking the checkbox for the first time $copyPermissionsFromBase = true; } if ($file_set->fsOverrideGlobalPermissions) { $permissions = PermissionKey::getList('file_set'); foreach($permissions as $pk) { $pk->setPermissionObject($file_set); $pt = $pk->getPermissionAssignmentObject(); $paID = $_POST['pkID'][$pk->getPermissionKeyID()]; $pt->clearPermissionAssignment(); if ($paID > 0) { $pa = PermissionAccess::getByID($paID, $pk); if (is_object($pa)) { $pt->assignPermissionAccess($pa); } } } } $file_set->fsOverrideGlobalPermissions = ($this->post('fsOverrideGlobalPermissions') == 1) ? 1 : 0; $file_set->save(); parse_str($this->post('fsDisplayOrder')); $file_set->updateFileSetDisplayOrder($fID); if ($file_set->fsOverrideGlobalPermissions == 0) { $file_set->resetPermissions(); } if ($copyPermissionsFromBase) { $file_set->acquireBaseFileSetPermissions(); } $this->redirect("/dashboard/files/sets", 'view_detail', $this->post('fsID'), 'file_set_updated'); }
<?php defined('C5_EXECUTE') or die("Access Denied."); ?> <?php $cat = PermissionKeyCategory::getByHandle('basic_workflow'); ?> <table class="ccm-permission-grid"> <?php $permissions = PermissionKey::getList('basic_workflow'); foreach ($permissions as $pk) { $pk->setPermissionObject($workflow); ?> <tr> <td class="ccm-permission-grid-name" id="ccm-permission-grid-name-<?php echo $pk->getPermissionKeyID(); ?> "><strong><?php if ($enablePermissions) { ?> <a dialog-title="<?php echo $pk->getPermissionKeyDisplayName(); ?> " data-pkID="<?php echo $pk->getPermissionKeyID(); ?> " data-paID="<?php echo $pk->getPermissionAccessID(); ?>
?> <div class="<?php if ($task == 'bulk_add_access') { ?> form-inline<?php } ?> "> <table class="ccm-permission-grid table"> <tr> <td class="ccm-permission-grid-name" id="ccm-permission-grid-name-0"> <select name="pkID"> <?php $permissions = PermissionKey::getList('page'); foreach ($permissions as $pk) { ?> <option value="<?php echo $pk->getPermissionKeyID(); ?> "><?php echo $pk->getPermissionKeyDisplayName(); ?> </option> <?php } ?> </select> </td> <td id="ccm-permission-grid-cell-0" class="ccm-permission-grid-cell-value" style="vertical-align: middle">
public function doOverrideAreaPermissions() { $db = Loader::db(); $c = $this->getBlockCollectionObject(); $v = array($c->getCollectionID(), $c->getVersionID(), $this->bID, $this->arHandle); $db->query("update CollectionVersionBlocks set cbOverrideAreaPermissions = 1 where cID = ? and (cvID = ? or cbIncludeAll = 1) and bID = ? and arHandle = ?", $v); $v = array($c->getCollectionID(), $c->getVersionID(), $this->bID); $db->query("delete from BlockPermissionAssignments where cID = ? and cvID = ? and bID = ?", $v); // copy permissions from the page to the area $permissions = PermissionKey::getList('block'); foreach($permissions as $pk) { $pk->setPermissionObject($this); $pk->copyFromPageOrAreaToBlock(); } $this->refreshCache(); }
<?php defined('C5_EXECUTE') or die("Access Denied."); ?> <table class="ccm-permission-grid table table-striped"> <?php $permissions = PermissionKey::getList('sitemap'); $permissions = array_merge($permissions, PermissionKey::getList('marketplace_newsflow')); $permissions = array_merge($permissions, PermissionKey::getList('admin')); foreach ($permissions as $pk) { ?> <tr> <td class="ccm-permission-grid-name" id="ccm-permission-grid-name-<?php echo $pk->getPermissionKeyID(); ?> "><strong><a dialog-title="<?php echo $pk->getPermissionKeyDisplayName(); ?> " data-pkID="<?php echo $pk->getPermissionKeyID(); ?> " data-paID="<?php echo $pk->getPermissionAccessID(); ?> " onclick="ccm_permissionLaunchDialog(this)" href="javascript:void(0)"><?php echo $pk->getPermissionKeyDisplayName(); ?> </a></strong></td> <td id="ccm-permission-grid-cell-<?php echo $pk->getPermissionKeyID();
public static function exportList($xml) { $categories = PermissionKeyCategory::getList(); $pxml = $xml->addChild('permissionkeys'); foreach ($categories as $cat) { $permissions = PermissionKey::getList($cat->getPermissionKeyCategoryHandle()); foreach ($permissions as $p) { $p->export($pxml); } } }
<?php defined('C5_EXECUTE') or die("Access Denied."); ?> <?php $cat = PermissionKeyCategory::getByHandle('conversation'); ?> <table class="ccm-permission-grid table table-striped"> <?php $cnvID = 0; if (is_object($conversation)) { $cnvID = $conversation->getConversationID(); } $permissions = PermissionKey::getList('conversation'); foreach ($permissions as $pk) { $pk->setPermissionObject($conversation); ?> <tr> <td class="ccm-permission-grid-name" id="ccm-permission-grid-name-<?php echo $pk->getPermissionKeyID(); ?> "><strong><a dialog-title="<?php echo $pk->getPermissionKeyDisplayName(); ?> " data-pkID="<?php echo $pk->getPermissionKeyID(); ?> " data-paID="<?php echo $pk->getPermissionAccessID();
public function resetPermissions($fOverrideSetPermissions = 0) { $db = Loader::db(); $db->Execute("delete from FilePermissionAssignments where fID = ?", array($this->fID)); $db->Execute("update Files set fOverrideSetPermissions = ? where fID = ?", array($fOverrideSetPermissions, $this->fID)); if ($fOverrideSetPermissions) { $permissions = PermissionKey::getList('file'); foreach($permissions as $pk) { $pk->setPermissionObject($this); $pk->copyFromFileSetToFile(); } } }
<? if ($editPermissions) { ?> <div class="dialog-buttons"> <a href="javascript:void(0)" onclick="jQuery.fn.dialog.closeTop()" class="btn"><?php echo t('Cancel'); ?> </a> <button onclick="$('#ccm-permission-list-form').submit()" class="btn primary ccm-button-right"><?php echo t('Save'); ?> <i class="icon-ok-sign icon-white"></i></button> </div> <? } ?> <? } else { ?> <? $pkl = PermissionKey::getList('page'); $pk = $pkl[0];?> <p><?php echo t('You may only set specific permissions for pages if they are set to override defaults or their parent pages.'); ?> </p> <? } ?> <div id="ccm-page-permissions-confirm-dialog" style="display: none"> <?php echo t('Changing this setting will affect this page immediately. Are you sure?'); ?> <div id="dialog-buttons-start"> <input type="button" class="btn" value="Cancel" onclick="jQuery.fn.dialog.closeTop()" /> <input type="button" class="btn error ccm-button-right" value="Ok" onclick="ccm_pagePermissionsConfirmInheritanceChange()" /> </div>
$pa->removeListItem($pe); } if ($_REQUEST['task'] == 'save_permission' && Loader::helper("validation/token")->validate('save_permission')) { $pk = PermissionKey::getByID($_REQUEST['pkID']); $pk->setPermissionObject($f); $pa = PermissionAccess::getByID($_REQUEST['paID'], $pk); $pa->save($_POST); } if ($_REQUEST['task'] == 'display_access_cell' && Loader::helper("validation/token")->validate('display_access_cell')) { $pk = PermissionKey::getByID($_REQUEST['pkID']); $pk->setPermissionObject($f); $pa = PermissionAccess::getByID($_REQUEST['paID'], $pk); Loader::element('permission/labels', array('pk' => $pk, 'pa' => $pa)); } if ($_REQUEST['task'] == 'save_permission_assignments' && Loader::helper("validation/token")->validate('save_permission_assignments')) { $permissions = PermissionKey::getList('file'); foreach ($permissions as $pk) { $paID = $_POST['pkID'][$pk->getPermissionKeyID()]; $pk->setPermissionObject($f); $pt = $pk->getPermissionAssignmentObject(); $pt->clearPermissionAssignment(); if ($paID > 0) { $pa = PermissionAccess::getByID($paID, $pk); if (is_object($pa)) { $pt->assignPermissionAccess($pa); } } } } if ($_REQUEST['task'] == 'save_workflows' && Loader::helper("validation/token")->validate('save_workflows')) { $pk = PermissionKey::getByID($_REQUEST['pkID']);
?> &arHandle=<?php echo urlencode($b->getAreaHandle()); ?> &cvID=<?php echo $c->getVersionID(); ?> &bID=<?php echo $b->getBlockID(); ?> "> <table class="ccm-permission-grid"> <?php $permissions = PermissionKey::getList('block'); foreach ($permissions as $pk) { $pk->setPermissionObject($b); ?> <tr> <td class="ccm-permission-grid-name" id="ccm-permission-grid-name-<?php echo $pk->getPermissionKeyID(); ?> "><strong><?php if ($enablePermissions) { ?> <a dialog-title="<?php echo $pk->getPermissionKeyDisplayName(); ?> " data-pkID="<?php echo $pk->getPermissionKeyID();
public function overridePagePermissions() { $db = Loader::db(); $cID = $this->getCollectionID(); $v = array($cID, $this->getAreaHandle()); // update the Area record itself. Hopefully it's been created. $db->query("update Areas set arOverrideCollectionPermissions = 1, arInheritPermissionsFromAreaOnCID = 0 where arID = ?", array($this->getAreaID())); // copy permissions from the page to the area $permissions = PermissionKey::getList('area'); foreach ($permissions as $pk) { $pk->setPermissionObject($this); $pk->copyFromPageToArea(); } // finally, we rescan subareas so that, if they are inheriting up the tree, they inherit from this place $this->arInheritPermissionsFromAreaOnCID = $this->getCollectionID(); // we don't need to actually save this on the area, but we need it for the rescan function $this->arOverrideCollectionPermissions = 1; // to match what we did above - useful for the rescan functions below $acobj = $this->getAreaCollectionObject(); if ($acobj->isMasterCollection()) { // if we're updating the area on a master collection we need to go through to all areas set on subpages that aren't set to override to change them to inherit from this area $this->rescanSubAreaPermissionsMasterCollection($acobj); } else { $this->rescanSubAreaPermissions(); } }
<? defined('C5_EXECUTE') or die("Access Denied."); ?> <table class="ccm-permission-grid"> <? $permissions = PermissionKey::getList('user'); foreach($permissions as $pk) { ?> <tr> <td class="ccm-permission-grid-name" id="ccm-permission-grid-name-<?php echo $pk->getPermissionKeyID(); ?> "><strong><a dialog-title="<?php echo $pk->getPermissionKeyName(); ?> " data-pkID="<?php echo $pk->getPermissionKeyID(); ?> " data-paID="<?php echo $pk->getPermissionAccessID(); ?> " onclick="ccm_permissionLaunchDialog(this)" href="javascript:void(0)"><?php echo $pk->getPermissionKeyName(); ?> </a></td> <td id="ccm-permission-grid-cell-<?php echo $pk->getPermissionKeyID(); ?> " class="ccm-permission-grid-cell"><?php echo Loader::element('permission/labels', array('pk' => $pk)); ?>
</a> <button onclick="$('#ccm-permission-list-form').submit()" class="btn primary ccm-button-right"><?php echo t('Save'); ?> <i class="icon-ok-sign icon-white"></i></button> </div> <?php } ?> <?php } else { ?> <?php $pkl = PermissionKey::getList('page'); $pk = $pkl[0]; ?> <p><?php echo t('You may only set specific permissions for pages if they are set to override defaults or their parent pages.'); ?> </p> <?php } ?> <div id="ccm-page-permissions-confirm-dialog" style="display: none"> <?php echo t('Changing this setting will affect this page immediately. Are you sure?'); ?>
<?php defined('C5_EXECUTE') or die("Access Denied."); ?> <table class="ccm-permission-grid table table-striped"> <?php $permissions = PermissionKey::getList('block_type'); foreach ($permissions as $pk) { ?> <tr> <td class="ccm-permission-grid-name" id="ccm-permission-grid-name-<?php echo $pk->getPermissionKeyID(); ?> "><strong><a dialog-title="<?php echo $pk->getPermissionKeyDisplayName(); ?> " data-pkID="<?php echo $pk->getPermissionKeyID(); ?> " data-paID="<?php echo $pk->getPermissionAccessID(); ?> " onclick="ccm_permissionLaunchDialog(this)" href="javascript:void(0)"><?php echo $pk->getPermissionKeyDisplayName(); ?> </a></strong></td> <td id="ccm-permission-grid-cell-<?php echo $pk->getPermissionKeyID(); ?> " class="ccm-permission-grid-cell"><?php