CakePdf\Pdf\CakePdf::permissions PHP Метод

permissions() публичный Метод

all: allow all permissions none: allow no permissions array: list of permissions that are allowed
public permissions ( null | boolean | array $permissions = null ) : mixed
$permissions null | boolean | array Permissions to set
Результат mixed
    public function permissions($permissions = null)
    {
        if (!$this->protect()) {
            return $this;
        }
        if ($permissions === null) {
            return $this->_allow;
        }
        if (is_string($permissions) && $permissions == 'all') {
            $permissions = true;
        }
        if (is_string($permissions) && $permissions == 'none') {
            $permissions = false;
        }
        if (is_array($permissions)) {
            foreach ($permissions as $permission) {
                if (!in_array($permission, $this->_availablePermissions)) {
                    throw new Exception(sprintf('Invalid permission: %s', $permission));
                }
                if (!$this->crypto()->permissionImplemented($permission)) {
                    throw new Exception(sprintf('Permission not implemented in crypto engine: %s', $permission));
                }
            }
        }
        $this->_allow = $permissions;
        return $this;
    }