当前位置: 首页>>代码示例>>PHP>>正文


PHP PermissionDuration类代码示例

本文整理汇总了PHP中PermissionDuration的典型用法代码示例。如果您正苦于以下问题:PHP PermissionDuration类的具体用法?PHP PermissionDuration怎么用?PHP PermissionDuration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了PermissionDuration类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getAllowedFileExtensions

 public function getAllowedFileExtensions()
 {
     $u = new User();
     $extensions = array();
     if ($u->isSuperUser()) {
         $extensions = Loader::helper('concrete/file')->getAllowedFileExtensions();
         return $extensions;
     }
     $pae = $this->getPermissionAccessObject();
     if (!is_object($pae)) {
         return array();
     }
     $accessEntities = $u->getUserAccessEntityObjects();
     $accessEntities = $pae->validateAndFilterAccessEntities($accessEntities);
     $list = $this->getAccessListItems(FileSetPermissionKey::ACCESS_TYPE_ALL, $accessEntities);
     $list = PermissionDuration::filterByActive($list);
     foreach ($list as $l) {
         if ($l->getFileTypesAllowedPermission() == 'N') {
             $extensions = array();
         }
         if ($l->getFileTypesAllowedPermission() == 'C') {
             $extensions = array_unique(array_merge($extensions, $l->getFileTypesAllowedArray()));
         }
         if ($l->getFileTypesAllowedPermission() == 'A') {
             $extensions = Loader::helper('concrete/file')->getAllowedFileExtensions();
         }
     }
     return $extensions;
 }
开发者ID:Zyqsempai,项目名称:amanet,代码行数:29,代码来源:add_file.php

示例2: getAccessListItems

 public function getAccessListItems($accessType = PagePermissionKey::ACCESS_TYPE_INCLUDE, $filterEntities = array())
 {
     $db = Loader::db();
     $list = parent::getAccessListItems($accessType, $filterEntities);
     $list = PermissionDuration::filterByActive($list);
     foreach ($list as $l) {
         $pe = $l->getAccessEntityObject();
         $prow = $db->GetRow('select permission, externalLink from PagePermissionPageTypeAccessList where peID = ? and paID = ?', array($pe->getAccessEntityID(), $l->getPermissionAccessID()));
         if (is_array($prow) && $prow['permission']) {
             $l->setPageTypesAllowedPermission($prow['permission']);
             $l->setAllowExternalLinks($prow['externalLink']);
             $permission = $prow['permission'];
         } else {
             if ($l->getAccessType() == PagePermissionKey::ACCESS_TYPE_INCLUDE) {
                 $l->setPageTypesAllowedPermission('A');
                 $l->setAllowExternalLinks(1);
             } else {
                 $l->setPageTypesAllowedPermission('N');
                 $l->setAllowExternalLinks(0);
             }
         }
         if ($permission == 'C') {
             $ctIDs = $db->GetCol('select ctID from PagePermissionPageTypeAccessListCustom where peID = ? and paID = ?', array($pe->getAccessEntityID(), $l->getPermissionAccessID()));
             $l->setPageTypesAllowedArray($ctIDs);
         }
     }
     return $list;
 }
开发者ID:Zyqsempai,项目名称:amanet,代码行数:28,代码来源:add_subpage.php

示例3: getMyAssignment

 public function getMyAssignment()
 {
     $u = new User();
     $asl = new ViewUserAttributesUserPermissionAssignment();
     if ($u->isSuperUser()) {
         $asl->setAttributesAllowedPermission('A');
         return $asl;
     }
     $pae = $this->getPermissionAccessObject();
     if (!is_object($pae)) {
         return $asl;
     }
     $accessEntities = $u->getUserAccessEntityObjects();
     $accessEntities = $pae->validateAndFilterAccessEntities($accessEntities);
     $list = $this->getAccessListItems(UserPermissionKey::ACCESS_TYPE_ALL, $accessEntities);
     $list = PermissionDuration::filterByActive($list);
     foreach ($list as $l) {
         if ($l->getAttributesAllowedPermission() == 'N') {
             $asl->setAttributesAllowedPermission('N');
         }
         if ($l->getAttributesAllowedPermission() == 'C') {
             $asl->setAttributesAllowedPermission('C');
         }
         if ($l->getAttributesAllowedPermission() == 'A') {
             $asl->setAttributesAllowedPermission('A');
         }
     }
     $asl->setAttributesAllowedArray($this->getAllowedAttributeKeyIDs($list));
     return $asl;
 }
开发者ID:ojalehto,项目名称:concrete5-legacy,代码行数:30,代码来源:view_user_attributes.php

示例4: loadPermissionDurationObject

 public function loadPermissionDurationObject($pdID)
 {
     if ($pdID > 0) {
         $pd = PermissionDuration::getByID($pdID);
         $this->duration = $pd;
     }
 }
开发者ID:ojalehto,项目名称:concrete5-legacy,代码行数:7,代码来源:list_item.php

示例5: validate

 public function validate()
 {
     $u = new User();
     if ($u->isSuperUser()) {
         return true;
     }
     $pae = $this->getPermissionAccessObject();
     if (!is_object($pae)) {
         return false;
     }
     $accessEntities = $u->getUserAccessEntityObjects();
     $accessEntities = $pae->validateAndFilterAccessEntities($accessEntities);
     $valid = false;
     $list = $this->getAccessListItems(PermissionKey::ACCESS_TYPE_ALL, $accessEntities);
     $list = PermissionDuration::filterByActive($list);
     foreach ($list as $l) {
         if ($l->getAccessType() == PermissionKey::ACCESS_TYPE_INCLUDE) {
             $valid = true;
         }
         if ($l->getAccessType() == PermissionKey::ACCESS_TYPE_EXCLUDE) {
             $valid = false;
         }
     }
     return $valid;
 }
开发者ID:ojalehto,项目名称:concrete5-legacy,代码行数:25,代码来源:file.php

示例6: getCurrentlyActiveUsers

 public function getCurrentlyActiveUsers(WorkflowProgress $wp)
 {
     $paa = $this->getPermissionAccessObject();
     if (!$paa) {
         return array();
     }
     $paa->setWorkflowProgressObject($wp);
     $included = $this->getAccessListItems(PermissionKey::ACCESS_TYPE_INCLUDE);
     $excluded = $this->getAccessListItems(PermissionKey::ACCESS_TYPE_EXCLUDE);
     $included = PermissionDuration::filterByActive($included);
     $excluded = PermissionDuration::filterByActive($excluded);
     $users = array();
     $usersExcluded = array();
     foreach ($included as $inc) {
         $pae = $inc->getAccessEntityObject();
         $users = array_merge($users, $pae->getAccessEntityUsers($paa));
     }
     $users = array_unique($users);
     foreach ($excluded as $inc) {
         $pae = $inc->getAccessEntityObject();
         $usersExcluded = array_merge($usersExcluded, $pae->getAccessEntityUsers($paa));
     }
     $users = array_diff($users, $usersExcluded);
     return $users;
 }
开发者ID:Zyqsempai,项目名称:amanet,代码行数:25,代码来源:workflow.php

示例7: getAllowedPageTypeIDs

 protected function getAllowedPageTypeIDs()
 {
     $u = new User();
     $pae = $this->getPermissionAccessObject();
     if (!is_object($pae)) {
         return array();
     }
     $accessEntities = $u->getUserAccessEntityObjects();
     $accessEntities = $pae->validateAndFilterAccessEntities($accessEntities);
     $list = $this->getAccessListItems(PagePermissionKey::ACCESS_TYPE_ALL, $accessEntities);
     $list = PermissionDuration::filterByActive($list);
     $db = Loader::db();
     $allCTIDs = $db->GetCol('select ctID from PageTypes where ctIsInternal = 0');
     $ctIDs = array();
     foreach ($list as $l) {
         if ($l->getPageTypesAllowedPermission() == 'N') {
             $ctIDs = array();
         }
         if ($l->getPageTypesAllowedPermission() == 'C') {
             if ($l->getAccessType() == PagePermissionKey::ACCESS_TYPE_EXCLUDE) {
                 $ctIDs = array_values(array_diff($ctIDs, $l->getPageTypesAllowedArray()));
             } else {
                 $ctIDs = array_unique(array_merge($ctIDs, $l->getPageTypesAllowedArray()));
             }
         }
         if ($l->getPageTypesAllowedPermission() == 'A') {
             $ctIDs = $allCTIDs;
         }
     }
     return $ctIDs;
 }
开发者ID:ronlobo,项目名称:concrete5-de,代码行数:31,代码来源:add_subpage.php

示例8: validateAccessEntities

	public function validateAccessEntities($accessEntities) {
		$valid = false;
		$accessEntities = $this->validateAndFilterAccessEntities($accessEntities);
		$list = $this->getAccessListItems(PermissionKey::ACCESS_TYPE_ALL, $accessEntities);
		$list = PermissionDuration::filterByActive($list);
		foreach($list as $l) {
			if ($l->getAccessType() == PermissionKey::ACCESS_TYPE_INCLUDE) {
				$valid = true;
			}
			if ($l->getAccessType() == PermissionKey::ACCESS_TYPE_EXCLUDE) {
				$valid = false;
			}
		}
		return $valid;
	}
开发者ID:nveid,项目名称:concrete5,代码行数:15,代码来源:model.php

示例9: getAllowedBlockTypeIDs

 protected function getAllowedBlockTypeIDs()
 {
     $u = new User();
     $pae = $this->getPermissionAccessObject();
     if (!is_object($pae)) {
         return array();
     }
     $accessEntities = $u->getUserAccessEntityObjects();
     $accessEntities = $pae->validateAndFilterAccessEntities($accessEntities);
     $list = $this->getAccessListItems(AreaPermissionKey::ACCESS_TYPE_ALL, $accessEntities);
     $list = PermissionDuration::filterByActive($list);
     $db = Loader::db();
     $btIDs = array();
     if (count($list) > 0) {
         $dsh = Loader::helper('concrete/dashboard');
         if ($dsh->inDashboard()) {
             $allBTIDs = $db->GetCol('select btID from BlockTypes');
         } else {
             $allBTIDs = $db->GetCol('select btID from BlockTypes where btIsInternal = 0');
         }
         foreach ($list as $l) {
             if ($l->getBlockTypesAllowedPermission() == 'N') {
                 $btIDs = array();
             }
             if ($l->getBlockTypesAllowedPermission() == 'C') {
                 if ($l->getAccessType() == AreaPermissionKey::ACCESS_TYPE_EXCLUDE) {
                     $btIDs = array_values(array_diff($btIDs, $l->getBlockTypesAllowedArray()));
                 } else {
                     $btIDs = array_unique(array_merge($btIDs, $l->getBlockTypesAllowedArray()));
                 }
             }
             if ($l->getBlockTypesAllowedPermission() == 'A') {
                 $btIDs = $allBTIDs;
             }
         }
     }
     return $btIDs;
 }
开发者ID:ojalehto,项目名称:concrete5-legacy,代码行数:38,代码来源:add_block_to_area.php

示例10: getAccessListItems

 public function getAccessListItems($accessType = UserPermissionKey::ACCESS_TYPE_INCLUDE, $filterEntities = array())
 {
     $db = Loader::db();
     $list = parent::getAccessListItems($accessType, $filterEntities);
     $list = PermissionDuration::filterByActive($list);
     foreach ($list as $l) {
         $pe = $l->getAccessEntityObject();
         $prow = $db->GetRow('select attributePermission, uName, uPassword, uEmail, uAvatar, uTimezone, uDefaultLanguage from UserPermissionEditPropertyAccessList where peID = ? and paID = ?', array($pe->getAccessEntityID(), $this->getPermissionAccessID()));
         if (is_array($prow) && $prow['attributePermission']) {
             $l->setAttributesAllowedPermission($prow['attributePermission']);
             $l->setAllowEditUserName($prow['uName']);
             $l->setAllowEditEmail($prow['uEmail']);
             $l->setAllowEditPassword($prow['uPassword']);
             $l->setAllowEditAvatar($prow['uAvatar']);
             $l->setAllowEditTimezone($prow['uTimezone']);
             $l->setAllowEditDefaultLanguage($prow['uDefaultLanguage']);
             $attributePermission = $prow['attributePermission'];
         } else {
             if ($l->getAccessType() == UserPermissionKey::ACCESS_TYPE_INCLUDE) {
                 $l->setAttributesAllowedPermission('A');
                 $l->setAllowEditUserName(1);
                 $l->setAllowEditEmail(1);
                 $l->setAllowEditPassword(1);
                 $l->setAllowEditAvatar(1);
                 $l->setAllowEditTimezone(1);
                 $l->setAllowEditDefaultLanguage(1);
             } else {
                 $l->setAttributesAllowedPermission('N');
                 $l->setAllowEditUserName(0);
                 $l->setAllowEditEmail(0);
                 $l->setAllowEditPassword(0);
                 $l->setAllowEditAvatar(0);
                 $l->setAllowEditTimezone(0);
                 $l->setAllowEditDefaultLanguage(0);
             }
         }
         if ($attributePermission == 'C') {
             $akIDs = $db->GetCol('select akID from UserPermissionEditPropertyAttributeAccessListCustom where peID = ? and paID = ?', array($pe->getAccessEntityID(), $this->getPermissionAccessID()));
             $l->setAttributesAllowedArray($akIDs);
         }
     }
     return $list;
 }
开发者ID:Zyqsempai,项目名称:amanet,代码行数:43,代码来源:edit_user_properties.php

示例11: getMyAssignment

 public function getMyAssignment()
 {
     $u = new User();
     $asl = new EditUserPropertiesUserPermissionAccessListItem();
     $db = Loader::db();
     $allAKIDs = $db->GetCol('select akID from UserAttributeKeys order by akID asc');
     if ($u->isSuperUser()) {
         $asl->setAllowEditUserName(1);
         $asl->setAllowEditEmail(1);
         $asl->setAllowEditPassword(1);
         $asl->setAllowEditAvatar(1);
         $asl->setAllowEditTimezone(1);
         $asl->setAllowEditDefaultLanguage(1);
         $asl->setAttributesAllowedArray($allAKIDs);
         $asl->setAttributesAllowedPermission('A');
         return $asl;
     }
     $pae = $this->getPermissionAccessObject();
     if (!is_object($pae)) {
         return $asl;
     }
     $accessEntities = $u->getUserAccessEntityObjects();
     $accessEntities = $pae->validateAndFilterAccessEntities($accessEntities);
     $list = $this->getAccessListItems(UserPermissionKey::ACCESS_TYPE_ALL, $accessEntities);
     $list = PermissionDuration::filterByActive($list);
     $properties = array();
     $excluded = array();
     $akIDs = array();
     $u = new User();
     foreach ($list as $l) {
         if ($l->allowEditUserName() && !in_array('uName', $excluded)) {
             $asl->setAllowEditUserName(1);
         }
         if ($l->allowEditEmail() && !in_array('uEmail', $excluded)) {
             $asl->setAllowEditEmail(1);
         }
         if ($l->allowEditPassword() && !in_array('uPassword', $excluded)) {
             $asl->setAllowEditPassword(1);
         }
         if ($l->allowEditAvatar() && !in_array('uAvatar', $excluded)) {
             $asl->setAllowEditAvatar(1);
         }
         if ($l->allowEditTimezone() && !in_array('uTimezone', $excluded)) {
             $asl->allowEditTimezone(1);
         }
         if ($l->allowEditDefaultLanguage() && !in_array('uDefaultLanguage', $excluded)) {
             $asl->setAllowEditDefaultLanguage(1);
         }
         if ($l->getAccessType() == UserPermissionKey::ACCESS_TYPE_EXCLUDE && !$l->allowEditUserName()) {
             $asl->setAllowEditUserName(0);
             $excluded[] = 'uName';
         }
         if ($l->getAccessType() == UserPermissionKey::ACCESS_TYPE_EXCLUDE && !$l->allowEditEmail()) {
             $asl->setAllowEditEmail(0);
             $excluded[] = 'uEmail';
         }
         if ($l->getAccessType() == UserPermissionKey::ACCESS_TYPE_EXCLUDE && !$l->allowEditPassword()) {
             $asl->setAllowEditPassword(0);
             $excluded[] = 'uPassword';
         }
         if ($l->getAccessType() == UserPermissionKey::ACCESS_TYPE_EXCLUDE && !$l->allowEditAvatar()) {
             $asl->setAllowEditAvatar(0);
             $excluded[] = 'uAvatar';
         }
         if ($l->getAccessType() == UserPermissionKey::ACCESS_TYPE_EXCLUDE && !$l->allowEditTimezone()) {
             $asl->setAllowEditTimezone(0);
             $excluded[] = 'uTimezone';
         }
         if ($l->getAccessType() == UserPermissionKey::ACCESS_TYPE_EXCLUDE && !$l->allowEditDefaultLanguage()) {
             $asl->setAllowEditDefaultLanguage(0);
             $excluded[] = 'uDefaultLanguage';
         }
         if ($l->getAttributesAllowedPermission() == 'N') {
             $akIDs = array();
             $asl->setAttributesAllowedPermission('N');
         }
         if ($l->getAttributesAllowedPermission() == 'C') {
             $asl->setAttributesAllowedPermission('C');
             if ($l->getAccessType() == UserPermissionKey::ACCESS_TYPE_EXCLUDE) {
                 $akIDs = array_values(array_diff($akIDs, $l->getAttributesAllowedArray()));
             } else {
                 $akIDs = array_unique(array_merge($akIDs, $l->getAttributesAllowedArray()));
             }
         }
         if ($l->getAttributesAllowedPermission() == 'A') {
             $akIDs = $allAKIDs;
             $asl->setAttributesAllowedPermission('A');
         }
     }
     $asl->setAttributesAllowedArray($akIDs);
     return $asl;
 }
开发者ID:ronlobo,项目名称:concrete5-de,代码行数:92,代码来源:edit_user_properties.php

示例12: setupFilePermissions

 protected function setupFilePermissions()
 {
     $u = new User();
     if ($this->permissionLevel == false || $u->isSuperUser()) {
         return false;
     }
     $accessEntities = $u->getUserAccessEntityObjects();
     foreach ($accessEntities as $pae) {
         $peIDs[] = $pae->getAccessEntityID();
     }
     $db = Loader::db();
     // figure out which sets can read files in, not read files in, and read only my files in.
     $fsIDs = $db->GetCol('select fsID from FileSets where fsOverrideGlobalPermissions = 1');
     $viewableSets = array(-1);
     $nonviewableSets = array(-1);
     $myviewableSets = array(-1);
     $owpae = FileUploaderPermissionAccessEntity::getOrCreate();
     if (count($fsIDs) > 0) {
         $pk = PermissionKey::getByHandle($this->permissionLevel);
         foreach ($fsIDs as $fsID) {
             $fs = FileSet::getByID($fsID);
             $pk->setPermissionObject($fs);
             $list = $pk->getAccessListItems(PermissionKey::ACCESS_TYPE_ALL, $accessEntities);
             $list = PermissionDuration::filterByActive($list);
             if (count($list) > 0) {
                 foreach ($list as $l) {
                     $pae = $l->getAccessEntityObject();
                     if ($pae->getAccessEntityID() == $owpae->getAccessEntityID()) {
                         $myviewableSets[] = $fs->getFileSetID();
                     } else {
                         if ($l->getAccessType() == PermissionKey::ACCESS_TYPE_INCLUDE) {
                             $viewableSets[] = $fs->getFileSetID();
                         }
                         if ($l->getAccessType() == PermissionKey::ACCESS_TYPE_EXCLUDE) {
                             $nonviewableSets[] = $fs->getFileSetID();
                         }
                     }
                 }
             } else {
                 $nonviewableSets[] = $fs->getFileSetID();
             }
         }
     }
     $fs = FileSet::getGlobal();
     $fk = PermissionKey::getByHandle('search_file_set');
     $fk->setPermissionObject($fs);
     $accessEntities[] = $owpae;
     $list = $fk->getAccessListItems(PermissionKey::ACCESS_TYPE_ALL, $accessEntities);
     $list = PermissionDuration::filterByActive($list);
     foreach ($list as $l) {
         $pae = $l->getAccessEntityObject();
         if ($pae->getAccessEntityID() == $owpae->getAccessEntityID()) {
             $valid = 'mine';
         } else {
             if ($l->getAccessType() == PermissionKey::ACCESS_TYPE_INCLUDE) {
                 $valid = PermissionKey::ACCESS_TYPE_INCLUDE;
             }
             if ($l->getAccessType() == PermissionKey::ACCESS_TYPE_EXCLUDE) {
                 $valid = PermissionKey::ACCESS_TYPE_EXCLUDE;
             }
         }
     }
     $uID = $u->isRegistered() ? $u->getUserID() : 0;
     // This excludes all files found in sets where I may only read mine, and I did not upload the file
     $this->filter(false, '(f.uID = ' . $uID . ' or (select count(fID) from FileSetFiles where FileSetFiles.fID = f.fID and fsID in (' . implode(',', $myviewableSets) . ')) = 0)');
     if ($valid == 'mine') {
         // this means that we're only allowed to read files we've uploaded (unless, of course, those files are in previously covered sets)
         $this->filter(false, '(f.uID = ' . $uID . ' or (select count(fID) from FileSetFiles where FileSetFiles.fID = f.fID and fsID in (' . implode(',', $viewableSets) . ')) > 0)');
     }
     // this excludes all file that are found in sets that I can't find
     $this->filter(false, '((select count(fID) from FileSetFiles where FileSetFiles.fID = f.fID and fsID in (' . implode(',', $nonviewableSets) . ')) = 0)');
     $uID = $u->isRegistered() ? $u->getUserID() : 0;
     // This excludes all files found in sets where I may only read mine, and I did not upload the file
     $this->filter(false, '(f.uID = ' . $uID . ' or (select count(fID) from FileSetFiles where FileSetFiles.fID = f.fID and fsID in (' . implode(',', $myviewableSets) . ')) = 0)');
     $db = Loader::db();
     $vpvPKID = $db->GetOne('select pkID from PermissionKeys where pkHandle = \'view_file\'');
     if ($this->permissionLevel == 'search_file_set') {
         $vpPKID = $db->GetOne('select pkID from PermissionKeys where pkHandle = \'view_file_in_file_manager\'');
     } else {
         $vpPKID = $vpvPKID;
     }
     $pdIDs = $db->GetCol("select distinct pdID from FilePermissionAssignments fpa inner join PermissionAccessList pal on fpa.paID = pal.paID where pkID in (?, ?) and pdID > 0", array($vpPKID, $vpvPKID));
     $activePDIDs = array();
     if (count($pdIDs) > 0) {
         // then we iterate through all of them and find any that are active RIGHT NOW
         foreach ($pdIDs as $pdID) {
             $pd = PermissionDuration::getByID($pdID);
             if ($pd->isActive()) {
                 $activePDIDs[] = $pd->getPermissionDurationID();
             }
         }
     }
     $activePDIDs[] = 0;
     // exclude files where its overridden but I don't have the ability to read
     $this->filter(false, "(f.fOverrideSetPermissions = 0 or (select count(fID) from FilePermissionAssignments fpa inner join PermissionAccessList fpal on fpa.paID = fpal.paID where fpa.fID = f.fID and fpal.accessType = " . PermissionKey::ACCESS_TYPE_INCLUDE . " and fpal.pdID in (" . implode(',', $activePDIDs) . ") and fpal.peID in (" . implode(',', $peIDs) . ") and (if(fpal.peID = " . $owpae->getAccessEntityID() . " and f.uID <> " . $uID . ", false, true)) and (fpa.pkID = " . $vpPKID . ")) > 0)");
     // exclude detail files where read is excluded
     $this->filter(false, "f.fID not in (select ff.fID from Files ff inner join FilePermissionAssignments fpaExclude on ff.fID = fpaExclude.fID inner join PermissionAccessList palExclude on fpaExclude.paID = palExclude.paID where fOverrideSetPermissions = 1 and palExclude.accessType = " . PermissionKey::ACCESS_TYPE_EXCLUDE . " and palExclude.pdID in (" . implode(',', $activePDIDs) . ")\n\t\t\tand palExclude.peID in (" . implode(',', $peIDs) . ") and fpaExclude.pkID in (" . $vpPKID . "," . $vpvPKID . "))");
 }
开发者ID:ronlobo,项目名称:concrete5,代码行数:98,代码来源:file_list.php

示例13: getMyAssignment

 public function getMyAssignment()
 {
     $u = new User();
     $asl = new EditPagePropertiesPagePermissionAccessListItem();
     if ($u->isSuperUser()) {
         $asl->setAllowEditName(1);
         $asl->setAllowEditDateTime(1);
         $asl->setAllowEditUserID(1);
         $asl->setAllowEditDescription(1);
         $asl->setAllowEditPaths(1);
         $asl->setAttributesAllowedArray($this->getAllAttributeKeyIDs());
         $asl->setAttributesAllowedPermission('A');
         return $asl;
     }
     $pae = $this->getPermissionAccessObject();
     if (!is_object($pae)) {
         return $asl;
     }
     $accessEntities = $u->getUserAccessEntityObjects();
     $accessEntities = $pae->validateAndFilterAccessEntities($accessEntities);
     $list = $pae->getAccessListItems(PagePermissionKey::ACCESS_TYPE_ALL, $accessEntities);
     $list = PermissionDuration::filterByActive($list);
     $properties = array();
     $excluded = array();
     $akIDs = array();
     $u = new User();
     if (count($list) > 0) {
         $allAKIDs = $this->getAllAttributeKeyIDs();
     }
     foreach ($list as $l) {
         if ($l->allowEditName() && !in_array('name', $excluded)) {
             $asl->setAllowEditName(1);
         }
         if ($l->allowEditDateTime() && !in_array('date', $excluded)) {
             $asl->setAllowEditDateTime(1);
         }
         if ($l->allowEditUserID() && !in_array('uID', $excluded)) {
             $asl->setAllowEditUserID(1);
         }
         if ($l->allowEditDescription() && !in_array('description', $excluded)) {
             $asl->setAllowEditDescription(1);
         }
         if ($l->allowEditPaths() && !in_array('paths', $excluded)) {
             $asl->setAllowEditPaths(1);
         }
         if ($l->getAccessType() == PagePermissionKey::ACCESS_TYPE_EXCLUDE && !$l->allowEditName()) {
             $asl->setAllowEditName(0);
             $excluded[] = 'name';
         }
         if ($l->getAccessType() == PagePermissionKey::ACCESS_TYPE_EXCLUDE && !$l->allowEditDateTime()) {
             $asl->setAllowEditDateTime(0);
             $excluded[] = 'date';
         }
         if ($l->getAccessType() == PagePermissionKey::ACCESS_TYPE_EXCLUDE && !$l->allowEditUserID()) {
             $asl->setAllowEditUserID(0);
             $excluded[] = 'uID';
         }
         if ($l->getAccessType() == PagePermissionKey::ACCESS_TYPE_EXCLUDE && !$l->allowEditDescription()) {
             $asl->setAllowEditDescription(0);
             $excluded[] = 'description';
         }
         if ($l->getAccessType() == PagePermissionKey::ACCESS_TYPE_EXCLUDE && !$l->allowEditPaths()) {
             $asl->setAllowEditPaths(0);
             $excluded[] = 'paths';
         }
         if ($l->getAttributesAllowedPermission() == 'N') {
             $akIDs = array();
             $asl->setAttributesAllowedPermission('N');
         }
         if ($l->getAttributesAllowedPermission() == 'C') {
             $asl->setAttributesAllowedPermission('C');
             if ($l->getAccessType() == PagePermissionKey::ACCESS_TYPE_EXCLUDE) {
                 $akIDs = array_values(array_diff($akIDs, $l->getAttributesAllowedArray()));
             } else {
                 $akIDs = array_unique(array_merge($akIDs, $l->getAttributesAllowedArray()));
             }
         }
         if ($l->getAttributesAllowedPermission() == 'A') {
             $akIDs = $allAKIDs;
             $asl->setAttributesAllowedPermission('A');
         }
     }
     $asl->setAttributesAllowedArray($akIDs);
     return $asl;
 }
开发者ID:Zyqsempai,项目名称:amanet,代码行数:85,代码来源:edit_page_properties.php

示例14: getAccessListItems

 public function getAccessListItems($accessType = PagePermissionKey::ACCESS_TYPE_INCLUDE, $filterEntities = array())
 {
     $db = Loader::db();
     $list = parent::getAccessListItems($accessType, $filterEntities);
     $list = PermissionDuration::filterByActive($list);
     foreach ($list as $l) {
         $pe = $l->getAccessEntityObject();
         $prow = $db->GetRow('select attributePermission, name, publicDateTime, uID, description, paths from PagePermissionPropertyAccessList where peID = ? and paID = ?', array($pe->getAccessEntityID(), $l->getPermissionAccessID()));
         if (is_array($prow) && $prow['attributePermission']) {
             $l->setAttributesAllowedPermission($prow['attributePermission']);
             $l->setAllowEditName($prow['name']);
             $l->setAllowEditDateTime($prow['publicDateTime']);
             $l->setAllowEditUserID($prow['uID']);
             $l->setAllowEditDescription($prow['description']);
             $l->setAllowEditPaths($prow['paths']);
             $attributePermission = $prow['attributePermission'];
         } else {
             if ($l->getAccessType() == PagePermissionKey::ACCESS_TYPE_INCLUDE) {
                 $l->setAttributesAllowedPermission('A');
                 $l->setAllowEditName(1);
                 $l->setAllowEditDateTime(1);
                 $l->setAllowEditUserID(1);
                 $l->setAllowEditDescription(1);
                 $l->setAllowEditPaths(1);
             } else {
                 $l->setAttributesAllowedPermission('N');
                 $l->setAllowEditName(0);
                 $l->setAllowEditDateTime(0);
                 $l->setAllowEditUserID(0);
                 $l->setAllowEditDescription(0);
                 $l->setAllowEditPaths(0);
             }
         }
         if ($attributePermission == 'C') {
             $akIDs = $db->GetCol('select akID from PagePermissionPropertyAttributeAccessListCustom where peID = ? and paID = ?', array($pe->getAccessEntityID(), $l->getPermissionAccessID()));
             $l->setAttributesAllowedArray($akIDs);
         }
     }
     return $list;
 }
开发者ID:ronlobo,项目名称:concrete5-de,代码行数:40,代码来源:edit_page_properties.php

示例15: defined

<?php

defined('C5_EXECUTE') or die("Access Denied.");
$p = new Permissions();
if ($p->canAccessTaskPermissions()) {
    if ($_REQUEST['task'] == 'add_access_entity' && Loader::helper("validation/token")->validate('add_access_entity')) {
        $pk = PermissionKey::getByID($_REQUEST['pkID']);
        $pa = PermissionAccess::getByID($_REQUEST['paID'], $pk);
        $pe = PermissionAccessEntity::getByID($_REQUEST['peID']);
        $pd = PermissionDuration::getByID($_REQUEST['pdID']);
        $pa->addListITem($pe, $pd, $_REQUEST['accessType']);
    }
    if ($_REQUEST['task'] == 'remove_access_entity' && Loader::helper("validation/token")->validate('remove_access_entity')) {
        $pk = PermissionKey::getByID($_REQUEST['pkID']);
        $pa = PermissionAccess::getByID($_REQUEST['paID'], $pk);
        $pe = PermissionAccessEntity::getByID($_REQUEST['peID']);
        $pa->removeListItem($pe);
    }
    if ($_REQUEST['task'] == 'save_permission' && Loader::helper("validation/token")->validate('save_permission')) {
        $pk = PermissionKey::getByID($_REQUEST['pkID']);
        $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));
    }
}
开发者ID:Zyqsempai,项目名称:amanet,代码行数:29,代码来源:block_type.php


注:本文中的PermissionDuration类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。