@param string|array|\Konekt\Acl\Contracts\Permission|\Illuminate\Support\Collection $permissions

@return \Konekt\Acl\Contracts\Permission|\Konekt\Acl\Contracts\Permission|\Illuminate\Support\Collection
516195
protected function getStoredPermission($permissions)
    {
        if (is_string($permissions)) {
            return PermissionProxy::findByName($permissions, $this->getDefaultGuardName());
        }

        if (is_array($permissions)) {
            return PermissionProxy::whereIn('name', $permissions)
                ->whereIn('guard_name', $this->getGuardNames())
                ->get();
        }

        return $permissions;
    }
981436
protected function getBypassedAccess($permissions, array $context): bool
    {
        $newPermissions = [false];
        if (is_array($permissions) && array_key_exists('NO_BYPASS', $permissions)) {
            $newPermissions['NO_BYPASS'] = $permissions['NO_BYPASS'];
        }

        try {
            return $this->lpProxy->checkAccess($newPermissions, $context);
        } catch (\Exception $e) {
        }

        return false;
    }
870263
protected function setPermissions($permissions)
    {
        foreach ($permissions as $action => $permission) {
            $this->setPermission($action, $permission);
        }
    }
165374
protected function dispatch($permissions, $type = NULL, $context = NULL) {
    if(is_bool($permissions)) {
      return $this->dispatchBoolean($permissions, $type, $context);
    }

    if(is_string($permissions)) {
      return $this->dispatchString($permissions, $type, $context);
    }

    if(is_array($permissions)) {
      return $this->dispatchArray($permissions, $type, $context);
    }

    throw new InvalidArgumentTypeException("A permission must either be a boolean, a string or an array. Evaluated permissions: " . print_r($permissions, TRUE));
  }
1140517
protected function canOne(array $permissions)
    {
        foreach ($permissions as $permission) {
            if ($this->hasPermission($permission)) {
                return true;
            }
        }

        return false;
    }
834657
public function create($permissions = 0755)
    {
        Filesystem::checkNotExists($this->path);
        Filesystem::checkWritable(dirname($this->path));
        mkdir($this->path, $permissions, true);
    }
903705
public function getPermissionCommands($path, $permissions = array('644', '755'), $isSudo = false, $isFile = null, $changeOwner = true)
    {
        if (is_string($path)) {
            $path = array_fill(0, 2, $path);
        }
        list($chmodPath, $chownPath) = $path;

        $commands = array();
        $commands[] = $this->getChmodCommand($chmodPath, $permissions, $isSudo, $isFile);

        if ($changeOwner) {
            $chown = $this->getChownCommand($chownPath, $isSudo, false);
            if (isset($chown)) {
                $commands[] = $chown;
            }
        }
        return implode(' ' . $this->combineOperator . ' ', $commands).';';
    }
989138
public function setPermissions($permissions)
    {
        if (! is_array($permissions)) {
            $permissions = [$permissions];
        }

        $this->permissions = $permissions;

        return $this;
    }
822101
protected function userHasAllPermissions(array $permissions)
    {
        if ( ! count($permissions)) {
            return true;
        }

        return ! count(
            array_filter($permissions, function ($permission) {
                return ! array_get($this->userPermissions, $permission);
            })
        );
    }
952061
public function hookUserRolePermissions(array &$permissions)
    {
        $permissions['module_file_manager'] = gplcart_text('File manager: access');

        foreach ($this->getHandlers() as $command_id => $command) {
            $permissions["module_file_manager_$command_id"] = gplcart_text('File manager: perform command @name', array(
                '@name' => $command['name']));
        }
    }
90361
public function canAll($permissions, &$failed = null)
    {
        $this->canAny($permissions, $failed);

        return $failed->isEmpty();
    }
1222815
public function setPermissions($permissions)
	{
		if (is_string($permissions))
		{
			$permissions = '0'.ltrim($permissions, '0');
			$permissions = octdec($permissions);
		}

		return chmod($this->path, $permissions);
	}
1305761
public function getMask(array $permissions)
    {
        $maskBuilder = new MaskBuilder();

        foreach ($permissions as $permission) {
            try {
                $maskBuilder->add($permission);
            } catch (InvalidArgumentException $e) {
                throw new InvalidPermissionException('Invalid permission mask: '.$permission, $permission, $e);
            }
        }

        return $maskBuilder->get();
    }
1180726
public function hasPermission(array $permissions) {
    $sentry = App::make('sentry');
    $current_user = $sentry->getUser();
    if (!$current_user) {
      return false;
    }
    if ($permissions && (!$current_user->hasAnyAccess($permissions))) {
      return false;
    }

    return true;
  }
1014724
public function beforePermission($permissions)
    {
        $permissions = is_array($permissions) ? $permissions : func_get_args();

        $this->beforeFilter(function () use ($permissions) {
            Trusty::filterByPermission($permissions);
        });
    }
516358
public static function createFromData($permissions)
    {
        return array_map(function ($permission) {
            if (is_array($permission)) {
                return PermissionFactory::createFromArray($permission);
            } else {
                return PermissionFactory::createFromObject($permission);
            }
        }, $permissions);
    }
490875
public function getPermissionsAttribute()
    {
        $permissions = new Collection();

        foreach ($this->roles as $role) {
            foreach ($role->permissions as $permission) {
                $permissions->push($permission);
            }
        }

        return $permissions;
    }