コード例 #1
0
ファイル: Access.php プロジェクト: WillemAnchor/concrete5
 public static function getByID($paID, PermissionKey $pk, $checkPA = true)
 {
     $cache = Core::make('cache/request');
     $identifier = sprintf('permission/access/%s/%s', $pk->getPermissionKeyID(), $paID);
     $item = $cache->getItem($identifier);
     if (!$item->isMiss()) {
         return $item->get();
     }
     $db = Database::connection();
     $handle = $pk->getPermissionKeyCategoryHandle();
     if ($pk->permissionKeyHasCustomClass()) {
         $handle = $pk->getPermissionKeyHandle() . '_' . $handle;
     }
     $class = '\\Core\\Permission\\Access\\' . Core::make('helper/text')->camelcase($handle) . 'Access';
     $class = core_class($class, $pk->getPackageHandle());
     $obj = null;
     if ($checkPA) {
         $row = $db->GetRow('select paID, paIsInUse from PermissionAccess where paID = ?', array($paID));
         if ($row && $row['paID']) {
             $obj = Core::make($class);
             $obj->setPropertiesFromArray($row);
         }
     } else {
         // we got here from an assignment object so we already know its in use.
         $obj = Core::make($class);
         $obj->paID = $paID;
         $obj->paIsInUse = true;
     }
     if (isset($obj)) {
         $obj->setPermissionKey($pk);
     }
     $item->set($obj);
     return $obj;
 }
コード例 #2
0
 /**
  * Returns the ID for this permission key.
  */
 public function getPermissionKeyID()
 {
     return parent::getPermissionKeyID();
 }