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


PHP PermissionAccess类代码示例

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


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

示例1: assignPermissionAccess

 public function assignPermissionAccess(PermissionAccess $pa)
 {
     $db = Loader::db();
     $db->Replace('PagePermissionAssignments', array('cID' => $this->getPermissionObject()->getPermissionsCollectionID(), 'paID' => $pa->getPermissionAccessID(), 'pkID' => $this->pk->getPermissionKeyID()), array('cID', 'pkID'), true);
     $pa->markAsInUse();
     PermissionCache::clearAccessObject($this->pk, $this->getPermissionObject());
 }
开发者ID:ojalehto,项目名称:concrete5-legacy,代码行数:7,代码来源:page.php

示例2: assignPermissionAccess

 public function assignPermissionAccess(PermissionAccess $pa)
 {
     $db = Loader::db();
     $co = $this->permissionObject->getBlockCollectionObject();
     $arHandle = $this->permissionObject->getAreaHandle();
     $db->Replace('BlockPermissionAssignments', array('cID' => $co->getCollectionID(), 'paID' => $pa->getPermissionAccessID(), 'cvID' => $co->getVersionID(), 'bID' => $this->permissionObject->getBlockID(), 'pkID' => $this->pk->getPermissionKeyID()), array('cID', 'cvID', 'bID', 'pkID'), true);
     $pa->markAsInUse();
 }
开发者ID:Mihail9575,项目名称:concrete5,代码行数:8,代码来源:block.php

示例3: getAccessEntityUsers

 public function getAccessEntityUsers(PermissionAccess $pae)
 {
     if ($pae instanceof PagePermissionAccess) {
         $c = $pae->getPermissionObject();
     }
     if (is_object($c) && $c instanceof Page) {
         $pcID = $c->getCollectionParentID() ?: $c->getCollectionID();
         // Check against this page, if no parent set
         $ui = UserInfo::getByID($pcID);
         $users = array($ui);
         return $users;
     }
 }
开发者ID:r-bansal,项目名称:janeswalk-web-1,代码行数:13,代码来源:parent_page_owner.php

示例4: validate

 public function validate(PermissionAccess $pae)
 {
     if ($pae instanceof FileSetPermissionAccess) {
         return true;
     }
     if ($pae instanceof FilePermissionAccess) {
         $f = $pae->getPermissionObject();
     }
     if (is_object($f)) {
         $u = new User();
         return $u->getUserID() == $f->getUserID();
     }
     return false;
 }
开发者ID:ojalehto,项目名称:concrete5-legacy,代码行数:14,代码来源:file_uploader.php

示例5: getAccessEntityUsers

	public function getAccessEntityUsers(PermissionAccess $pae) {
		if ($pae instanceof PagePermissionAccess) {
			$c = $pae->getPermissionObject();
		} else if ($pae instanceof AreaPermissionAccess) {
			$c = $pae->getPermissionObject()->getAreaCollectionObject();
		} else if ($pae instanceof BlockPermissionAccess) {
			$a = $pae->getPermissionObject()->getBlockAreaObject();
			$c = $a->getAreaCollectionObject();
		}
		if (is_object($c) && ($c instanceof Page)) {
			$ui = UserInfo::getByID($c->getCollectionUserID());
			$users = array($ui);
			return $users;
		}
	}
开发者ID:nveid,项目名称:concrete5,代码行数:15,代码来源:page_owner.php

示例6: save

 public function save($args)
 {
     parent::save();
     $db = Loader::db();
     $db->Execute('delete from ' . $this->dbTableAccessList . ' where paID = ?', array($this->getPermissionAccessID()));
     $db->Execute('delete from ' . $this->dbTableAccessListCustom . ' where paID = ?', array($this->getPermissionAccessID()));
     if (is_array($args['groupsIncluded'])) {
         foreach ($args['groupsIncluded'] as $peID => $permission) {
             $v = array($peID, $this->getPermissionAccessID(), $permission);
             $db->Execute('insert into ' . $this->dbTableAccessList . ' (peID, paID, permission) values (?, ?, ?)', $v);
         }
     }
     if (is_array($args['groupsExcluded'])) {
         foreach ($args['groupsExcluded'] as $peID => $permission) {
             $v = array($peID, $this->getPermissionAccessID(), $permission);
             $db->Execute('insert into ' . $this->dbTableAccessList . ' (peID, paID, permission) values (?, ?, ?)', $v);
         }
     }
     if (is_array($args['gIDInclude'])) {
         foreach ($args['gIDInclude'] as $peID => $gIDs) {
             foreach ($gIDs as $gID) {
                 $v = array($peID, $this->getPermissionAccessID(), $gID);
                 $db->Execute('insert into ' . $this->dbTableAccessListCustom . ' (peID, paID, gID) values (?, ?, ?)', $v);
             }
         }
     }
     if (is_array($args['gIDExclude'])) {
         foreach ($args['gIDExclude'] as $peID => $gIDs) {
             foreach ($gIDs as $gID) {
                 $v = array($peID, $this->getPermissionAccessID(), $gID);
                 $db->Execute('insert into ' . $this->dbTableAccessListCustom . ' (peID, paID, gID) values (?, ?, ?)', $v);
             }
         }
     }
 }
开发者ID:Zyqsempai,项目名称:amanet,代码行数:35,代码来源:access_user_search.php

示例7: save

 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());
     }
 }
开发者ID:ricardomccerqueira,项目名称:rcerqueira.portfolio,代码行数:25,代码来源:tasks.php

示例8: save

 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());
     }
 }
开发者ID:ricardomccerqueira,项目名称:rcerqueira.portfolio,代码行数:25,代码来源:files.php

示例9: updateDetails

	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);
				}			
			}		
		}			
	}
开发者ID:nveid,项目名称:concrete5,代码行数:15,代码来源:basic.php

示例10: copyFromFileSetToFile

 public function copyFromFileSetToFile()
 {
     $db = Loader::db();
     $paID = $this->getPermissionAccessID();
     if (is_array($paID)) {
         // we have to merge the permissions access object into a new one.
         $pa = PermissionAccess::create($this);
         foreach ($paID as $paID) {
             $pax = PermissionAccess::getByID($paID, $this);
             $pax->duplicate($pa);
         }
         $paID = $pa->getPermissionAccessID();
     }
     if ($paID) {
         $db = Loader::db();
         $db->Replace('FilePermissionAssignments', array('fID' => $this->permissionObject->getFileID(), 'pkID' => $this->getPermissionKeyID(), 'paID' => $paID), array('fID', 'paID', 'pkID'), true);
     }
 }
开发者ID:ojalehto,项目名称:concrete5-legacy,代码行数:18,代码来源:file.php

示例11: approve

 public function approve(WorkflowProgress $wp)
 {
     $c = Page::getByID($this->getRequestedPageID());
     $ps = $this->getPagePermissionSet();
     $assignments = $ps->getPermissionAssignments();
     foreach ($assignments as $pkID => $paID) {
         $pk = PermissionKey::getByID($pkID);
         $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;
 }
开发者ID:ojalehto,项目名称:concrete5-legacy,代码行数:22,代码来源:change_page_permissions.php

示例12: run

 public function run()
 {
     $bt = BlockType::getByHandle('guestbook');
     if (is_object($bt)) {
         $bt->refresh();
     }
     // add user export users task permission
     $pk = PermissionKey::getByHandle('access_user_search_export');
     if (!$pk instanceof PermissionKey) {
         $pk = PermissionKey::add('user', 'access_user_search_export', 'Export Site Users', 'Controls whether a user can export site users or not', false, false);
         $pa = $pk->getPermissionAccessObject();
         if (!is_object($pa)) {
             $pa = PermissionAccess::create($pk);
         }
         $adminGroup = Group::getByID(ADMIN_GROUP_ID);
         //Make sure "Adminstrators" group still exists
         if ($adminGroup) {
             $adminGroupEntity = GroupPermissionAccessEntity::getOrCreate($adminGroup);
             $pa->addListItem($adminGroupEntity);
             $pt = $pk->getPermissionAssignmentObject();
             $pt->assignPermissionAccess($pa);
         }
     }
     if (!Config::get('SECURITY_TOKEN_JOBS')) {
         Config::save('SECURITY_TOKEN_JOBS', Loader::helper('validation/identifier')->getString(64));
     }
     if (!Config::get('SECURITY_TOKEN_ENCRYPTION')) {
         Config::save('SECURITY_TOKEN_ENCRYPTION', Loader::helper('validation/identifier')->getString(64));
     }
     if (!Config::get('SECURITY_TOKEN_VALIDATION')) {
         Config::save('SECURITY_TOKEN_VALIDATION', Loader::helper('validation/identifier')->getString(64));
     }
     $sp = Page::getByPath('/dashboard/system/mail/method/test_settings');
     if (!is_object($sp) || $sp->isError()) {
         $sp = SinglePage::add('/dashboard/system/mail/method/test_settings');
         $sp->update(array('cName' => t('Test Mail Settings')));
         $sp->setAttribute('meta_keywords', 'test smtp, test mail');
     }
 }
开发者ID:Zyqsempai,项目名称:amanet,代码行数:39,代码来源:version_563.php

示例13: assignPermissions

 public function assignPermissions($userOrGroup, $permissions = array(), $accessType = PagePermissionKey::ACCESS_TYPE_INCLUDE)
 {
     if ($this->cInheritPermissionsFrom != 'OVERRIDE') {
         $this->setPermissionsToManualOverride();
         $this->clearPagePermissions();
     }
     if (is_array($userOrGroup)) {
         $pe = GroupCombinationPermissionAccessEntity::getOrCreate($userOrGroup);
         // group combination
     } else {
         if ($userOrGroup instanceof User || $userOrGroup instanceof UserInfo) {
             $pe = UserPermissionAccessEntity::getOrCreate($userOrGroup);
         } else {
             // group;
             $pe = GroupPermissionAccessEntity::getOrCreate($userOrGroup);
         }
     }
     foreach ($permissions as $pkHandle) {
         $pk = PagePermissionKey::getByHandle($pkHandle);
         $pk->setPermissionObject($this);
         $pa = $pk->getPermissionAccessObject();
         if (!is_object($pa)) {
             $pa = PermissionAccess::create($pk);
         }
         $pa->addListItem($pe, false, $accessType);
         $pt = $pk->getPermissionAssignmentObject();
         $pt->assignPermissionAccess($pa);
         $this->loadPermissionAssignments();
     }
 }
开发者ID:ronlobo,项目名称:concrete5-de,代码行数:30,代码来源:page.php

示例14: array

            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']);
            $pk->setPermissionObject($f);
            $pa = PermissionAccess::getByID($_REQUEST['paID'], $pk);
            $pk->clearWorkflows();
            foreach ($_POST['wfID'] as $wfID) {
                $wf = Workflow::getByID($wfID);
                if (is_object($wf)) {
                    $pk->attachWorkflow($wf);
                }
            }
        }
    }
}
开发者ID:ppiedaderawnet,项目名称:concrete5,代码行数:31,代码来源:file.php

示例15: migrateBlockPermissions

    protected function migrateBlockPermissions()
    {
        if (PERMISSIONS_MODEL == 'simple') {
            return;
        }
        $db = Loader::db();
        $tables = $db->MetaTables();
        if (!in_array('CollectionVersionBlockPermissions', $tables)) {
            return false;
        }
        // permissions
        $permissionMap = array('r' => array(PermissionKey::getByHandle('view_block')), 'wa' => array(PermissionKey::getByHandle('edit_block'), PermissionKey::getByHandle('edit_block_custom_template'), PermissionKey::getByHandle('edit_block_design')), 'db' => array(PermissionKey::getByHandle('delete_block'), PermissionKey::getByHandle('schedule_guest_access'), PermissionKey::getByHandle('edit_block_permissions')));
        $r = $db->Execute('select * from CollectionVersionBlockPermissions order by cID asc');
        while ($row = $r->FetchRow()) {
            $pe = $this->migrateAccessEntity($row);
            if (!$pe) {
                continue;
            }
            $permissions = $this->getPermissionsArray($row['cbgPermissions']);
            $co = Page::getByID($row['cID'], $row['cvID']);
            if (!is_object($co) || $co->isError()) {
                continue;
            }
            $arHandle = $db->GetOne('select arHandle from CollectionVersionBlocks cvb where cvb.cID = ? and 
				cvb.cvID = ? and cvb.bID = ?', array($row['cID'], $row['cvID'], $row['bID']));
            $a = Area::get($co, $arHandle);
            $bo = Block::getByID($row['bID'], $co, $a);
            if (is_object($bo)) {
                foreach ($permissions as $p) {
                    $permissionsToApply = $permissionMap[$p];
                    foreach ($permissionsToApply as $pko) {
                        $pko->setPermissionObject($bo);
                        $pt = $pko->getPermissionAssignmentObject();
                        $pa = $pko->getPermissionAccessObject();
                        if (!is_object($pa)) {
                            $pa = PermissionAccess::create($pko);
                        } else {
                            if ($pa->isPermissionAccessInUse()) {
                                $pa = $pa->duplicate();
                            }
                        }
                        $pa->addListItem($pe, false, BlockPermissionKey::ACCESS_TYPE_INCLUDE);
                        $pt->assignPermissionAccess($pa);
                    }
                }
            }
        }
    }
开发者ID:Zyqsempai,项目名称:amanet,代码行数:48,代码来源:version_560.php


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