Example #1
0
 /**
  * @param string $rootDir
  * @param int $writeFlags
  * @param int $linkHandling
  * @param array $permissions
  * @throws InstantiationException
  */
 public function __construct($rootDir = null, $writeFlags = LOCK_EX, $linkHandling = parent::DISALLOW_LINKS, $permissions = [])
 {
     static::$permissions = ['file' => ['public' => 0744, 'private' => 0700], 'dir' => ['public' => 0755, 'private' => 0700]];
     try {
         parent::__construct($rootDir, $writeFlags, $linkHandling, $permissions);
     } catch (Error $ex) {
         throw new InstantiationException("AdapterLocal could not be initalized.", $ex);
     } catch (Exception $ex) {
         throw new InstantiationException("AdapterLocal could not be initalized.", $ex);
     }
 }
 /**
  * getMenuPermissions
  *
  * @return MenuPermission[]
  * @throws \Xpressengine\Permission\Exceptions\WrongInstanceException
  */
 public function getMenuPermissions()
 {
     if (count(static::$permissions) == 0) {
         static::$permissions = $this->permission->makesByType('menu');
     }
     return static::$permissions;
 }
Example #3
0
 public function removeAll()
 {
     $result = $this->connection->createCommand()->delete($this->itemsTable)->execute();
     static::$items = static::$roles = static::$permissions = null;
     return (bool) $result;
 }
Example #4
0
 /**
  * {@inheritdoc}
  */
 public static function globalPermissionsRequiredTo($action)
 {
     $instance = new static();
     $query = $instance->permissions();
     $query->wheres = [];
     $query->where('action', $action)->where('resource_type', get_called_class())->whereNull('resource_id');
     return $query->get();
 }
Example #5
0
 public function removeAll()
 {
     static::$items = static::$roles = static::$permissions = null;
     $this->saveToFile([], $this->path);
     return true;
 }