public function allow(string $role, string $permission, string $resource, bool $status=null)
    {
        $status = $status ?? true;
        if (!$this->roleRegistry->exists($role)) {
            throw new \Exception(
                sprintf(
                    "The role: %s doesnt exist",
                    (string)$role
                )
            );
        }

        if (!$this->permissionRegistry->exists($permission)) {
            throw new \Exception(
                sprintf(
                    "The permission: %s doesnt exist",
                    (string)$permission
                )
            );
        }

        if (!$this->resourceRegistry->exists($resource)) {
            throw new \Exception(
                sprintf(
                    "The resource: %s doesnt exist",
                    (string)$resource
                )
            );
        }

        $this->globalRegistry->save($role, $resource, $permission, $status);
    }
public function allow(string $role, string $permission, string $resource, bool $status=null)
    {
        $status = $status ?? true;
        if (!$this->roleRegistry->exists($role)) {
            throw new \Exception(
                sprintf(
                    "The role: %s doesnt exist",
                    (string)$role
                )
            );
        }

        if (!$this->permissionRegistry->exists($permission)) {
            throw new \Exception(
                sprintf(
                    "The permission: %s doesnt exist",
                    (string)$permission
                )
            );
        }

        if (!$this->resourceRegistry->exists($resource)) {
            throw new \Exception(
                sprintf(
                    "The resource: %s doesnt exist",
                    (string)$resource
                )
            );
        }

        $this->globalRegistry->save($role, $resource, $permission, $status);
    }
public function allow ( string $ role , string $ permission , string $ resource , bool $ status = null ) { $ status = $ status ?? true ; if ( ! $ this -> roleRegistry -> exists ( $ role ) ) { throw new \ Exception ( sprintf ( "The role: %s doesnt exist" , ( string ) $ role ) ) ; } if ( ! $ this -> permissionRegistry -> exists ( $ permission ) ) { throw new \ Exception ( sprintf ( "The permission: %s doesnt exist" , ( string ) $ permission ) ) ; } if ( ! $ this -> resourceRegistry -> exists ( $ resource ) ) { throw new \ Exception ( sprintf ( "The resource: %s doesnt exist" , ( string ) $ resource ) ) ; } $ this -> globalRegistry -> save ( $ role , $ resource , $ permission , $ status ) ; }
Change the status option of an assigned permission to true

@param string $role;
@param string $permission
@param string $resource
@param boolean $status Optional
@throws \Exception
@return void
Change the status option of an assigned permission to true