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


PHP PermissionAccess::getByID方法代码示例

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


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

示例1: getPermissionAccessObject

 public function getPermissionAccessObject()
 {
     $db = Loader::db();
     if ($this->permissionObjectToCheck instanceof Block) {
         $co = $this->permissionObjectToCheck->getBlockCollectionObject();
         $arHandle = $this->permissionObjectToCheck->getAreaHandle();
         $paID = $db->GetOne('select paID from BlockPermissionAssignments where cID = ? and cvID = ? and bID = ? and pkID = ? ' . $filterString, array($co->getCollectionID(), $co->getVersionID(), $this->permissionObject->getBlockID(), $this->pk->getPermissionKeyID()));
         if ($paID) {
             $pae = PermissionAccess::getByID($paID, $this->pk, false);
         }
     } else {
         if ($this->permissionObjectToCheck instanceof Area && isset($this->inheritedAreaPermissions[$this->pk->getPermissionKeyHandle()])) {
             $pk = PermissionKey::getByHandle($this->inheritedAreaPermissions[$this->pk->getPermissionKeyHandle()]);
             $pk->setPermissionObject($this->permissionObjectToCheck);
             $pae = $pk->getPermissionAccessObject();
         } else {
             if ($this->permissionObjectToCheck instanceof Page && isset($this->inheritedPagePermissions[$this->pk->getPermissionKeyHandle()])) {
                 $pk = PermissionKey::getByHandle($this->inheritedPagePermissions[$this->pk->getPermissionKeyHandle()]);
                 $pk->setPermissionObject($this->permissionObjectToCheck);
                 $pae = $pk->getPermissionAccessObject();
             }
         }
     }
     return $pae;
 }
开发者ID:Mihail9575,项目名称:concrete5,代码行数:25,代码来源:block.php

示例2: 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

示例3: 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

示例4: getPermissionAccessObject

 public function getPermissionAccessObject()
 {
     $db = Loader::db();
     if ($this->permissionObjectToCheck instanceof Area) {
         $r = $db->GetOne('select paID from AreaPermissionAssignments where cID = ? and arHandle = ? and pkID = ? ' . $filterString, array($this->permissionObjectToCheck->getCollectionID(), $this->permissionObjectToCheck->getAreaHandle(), $this->pk->getPermissionKeyID()));
         if ($r) {
             return PermissionAccess::getByID($r, $this->pk, false);
         }
     } else {
         if (isset($this->inheritedPermissions[$this->pk->getPermissionKeyHandle()])) {
             // this is a page
             $pk = PermissionKey::getByHandle($this->inheritedPermissions[$this->pk->getPermissionKeyHandle()]);
             $pk->setPermissionObject($this->permissionObjectToCheck);
             $pae = $pk->getPermissionAccessObject();
             return $pae;
         } else {
             if (isset($this->blockTypeInheritedPermissions[$this->pk->getPermissionKeyHandle()])) {
                 $pk = PermissionKey::getByHandle($this->blockTypeInheritedPermissions[$this->pk->getPermissionKeyHandle()]);
                 $pae = $pk->getPermissionAccessObject();
                 return $pae;
             }
         }
     }
     return false;
 }
开发者ID:Zyqsempai,项目名称:amanet,代码行数:25,代码来源:area.php

示例5: 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

示例6: 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

示例7: getPermissionAccessObject

 public function getPermissionAccessObject()
 {
     $pa = PermissionCache::getAccessObject($this->pk, $this->getPermissionObject());
     if ($pa === -1) {
         return false;
     }
     if (!is_object($pa)) {
         $db = Loader::db();
         $r = $db->GetOne('select paID from PagePermissionAssignments where cID = ? and pkID = ?', array($this->getPermissionObject()->getPermissionsCollectionID(), $this->pk->getPermissionKeyID()));
         if ($r) {
             $pa = PermissionAccess::getByID($r, $this->pk, false);
         }
         if (is_object($pa)) {
             PermissionCache::addAccessObject($this->pk, $this->getPermissionObject(), $pa);
         } else {
             PermissionCache::addAccessObject($this->pk, $this->getPermissionObject(), -1);
         }
     }
     return $pa;
 }
开发者ID:ojalehto,项目名称:concrete5-legacy,代码行数:20,代码来源:page.php

示例8: getPermissionAccessObject

 public function getPermissionAccessObject()
 {
     $db = Loader::db();
     if ($this->permissionObjectToCheck instanceof File) {
         $r = $db->GetCol('select paID from FilePermissionAssignments where fID = ? and pkID = ?', array($this->permissionObject->getFileID(), $this->pk->getPermissionKeyID()));
     } else {
         if (is_array($this->permissionObjectToCheck)) {
             // sets
             $sets = array();
             foreach ($this->permissionObjectToCheck as $fs) {
                 $sets[] = $fs->getFileSetID();
             }
             $inheritedPKID = $db->GetOne('select pkID from PermissionKeys where pkHandle = ?', array($this->inheritedPermissions[$this->pk->getPermissionKeyHandle()]));
             $r = $db->GetCol('select distinct paID from FileSetPermissionAssignments where fsID in (' . implode(',', $sets) . ') and pkID = ? ' . $filterString, array($inheritedPKID));
         } else {
             if ($this->permissionObjectToCheck instanceof FileSet && isset($this->inheritedPermissions[$this->pk->getPermissionKeyHandle()])) {
                 $inheritedPKID = $db->GetOne('select pkID from PermissionKeys where pkHandle = ?', array($this->inheritedPermissions[$this->pk->getPermissionKeyHandle()]));
                 $r = $db->GetCol('select distinct paID from FileSetPermissionAssignments where fsID = ? and pkID = ?', array($this->permissionObjectToCheck->getFileSetID(), $inheritedPKID));
             } else {
                 return false;
             }
         }
     }
     if (count($r) == 1) {
         $permID = $r[0];
     }
     if (count($r) > 1) {
         $permID = $r;
     }
     if (is_array($permID)) {
         foreach ($permID as $paID) {
             $pa = PermissionAccess::getByID($paID, $this->pk);
             if (is_object($pa)) {
                 $perms[] = $pa;
             }
         }
         return PermissionAccess::createByMerge($perms);
     } else {
         return PermissionAccess::getByID($permID, $this->pk);
     }
 }
开发者ID:ronlobo,项目名称:concrete5-de,代码行数:41,代码来源:file.php

示例9: 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

示例10: create

	public static function create(PermissionKey $pk) {
		$db = Loader::db();
		$db->Execute('insert into PermissionAccess (paIsInUse) values (0)');
		return PermissionAccess::getByID($db->Insert_ID(), $pk);
	}
开发者ID:nveid,项目名称:concrete5,代码行数:5,代码来源:model.php

示例11: loadPermissionAssignments

 protected function loadPermissionAssignments()
 {
     $db = Loader::db();
     $r = $db->Execute('select pkID, paID from PagePermissionAssignments where cID = ?', array($this->getPermissionsCollectionID()));
     while ($row = $r->FetchRow()) {
         $pk = PermissionKey::getByID($row['pkID']);
         $pk->setPermissionObject($this);
         $this->permissionAssignments[$row['pkID']] = PermissionAccess::getByID($row['paID'], $pk);
     }
 }
开发者ID:ronlobo,项目名称:concrete5-de,代码行数:10,代码来源:page.php

示例12: 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

示例13: getPermissionAccessObject

 public function getPermissionAccessObject()
 {
     $db = Loader::db();
     $r = $db->GetOne('select paID from FileSetPermissionAssignments where fsID = ? and pkID = ?', array($this->permissionObjectToCheck->getFileSetID(), $this->pk->getPermissionKeyID()));
     return PermissionAccess::getByID($r, $this->pk);
 }
开发者ID:ojalehto,项目名称:concrete5-legacy,代码行数:6,代码来源:file_set.php

示例14: array

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

示例15: file_sets_edit

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


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