Salva os dados da última verificação por privilégios
Na verificação: users.edit = {$role}.{$permission}

@param string $role
@param string $permission
@param boolean $granted
182526
public static function traceCurrentAbility(string $role, string $permission, bool $granted)
    {
        self::$debug['current_ability'] = [
            'role'       => $role,
            'permission' => $permission,
            'granted'    => $granted,
            ];
    }
477689
private function checkPermission(Node $node, $permission)
    {
        if (false === $this->authorizationChecker->isGranted($permission, $node)) {
            throw new AccessDeniedException();
        }
    }
1350993
private function checkIfUserHasPermission($permission)
    {
        if (!$this->isGranted($permission, $this->entityClass)) {
            throw $this->createAccessDeniedException(
                sprintf('You do not have "%s" permission on "%s" class objects.', $permission, $this->entityClass)
            );
        }
    }
1372939
public function isAllowed($permission = null, $role = null)
    {
        if ($permission && strpos($permission, '/') !== false) {
            list($controllerClassName, $action) = $this->inferControllerAction($permission);
            $controllerClassName = $this->alias->resolveNS($controllerClassName);
            if (!isset($this->_acl[$controllerClassName])) {
                /** @var \ManaPHP\Rest\Controller $controllerInstance */
                $controllerInstance = new $controllerClassName;
                $this->_acl[$controllerClassName] = $controllerInstance->getAcl();
            }
        } else {
            $controllerInstance = $this->dispatcher->getControllerInstance();
            $controllerClassName = get_class($controllerInstance);
            $action = $permission ? lcfirst(Text::camelize($permission)) : $this->dispatcher->getAction();

            if (!isset($this->_acl[$controllerClassName])) {
                $this->_acl[$controllerClassName] = $controllerInstance->getAcl();
            }
        }

        $acl = $this->_acl[$controllerClassName];

        $role = $role ?: $this->identity->getRole();
        if (strpos($role, ',') === false) {
            return $this->isAclAllow($acl, $role, $action);
        } else {
            foreach (explode($role, ',') as $r) {
                if ($this->isAclAllow($acl, $r, $action)) {
                    return true;
                }
            }

            return false;
        }
    }
910423
public function hasPermission($permission)
    {
        $perm_id = $this->getPermissionId($permission);
        $roles = $this->getRolesWithPermission($perm_id);

        foreach ($roles as $role)
            if ($this->hasRole($role))
                return true;

        return false;
    }
1252024
public function isGranted(string $permission, array $roles): bool
    {
        foreach ($this->flattenRoles($roles) as $role) {
            if ($role->hasPermission($permission)) {
                return true;
            }
        }

        return false;
    }
955454
public function roleHasPermission($permission, $force = false)
    {
        if (! is_null($this->getUser())) {
            return $this->getUser()->roleHasPermission($permission, $force);
        }

        return false;
    }
1213715
public function grant($permission)
    {
        $commandClass = $this->getCommandClass('grant');
        $this->command = new $commandClass($permission);

        return $this->command;
    }
110666
public function hasPermissionTo($permission): bool
    {
        // Check role flags
        if ($this->hasPermissionFlags()) {
            return $this->hasPermissionThroughFlag();
        }

        // Check role permissions
        if ($this->hasPermissionThroughRole($permission)) {
            return true;
        }

        // Check user permission
        if ($this->hasPermission($permission)) {
            return true;
        }

        return false;
    }
767386
public function addPermissions($permissions) {
		foreach ($permissions as $permission) {
			$per                                 = new permission($permission);
			$this->role->sharedPermissionList [] = $per->get();
		}
		R::store($this->role);
	}
117454
public function rolePermissionAdd(Role $role, Permission $permission)
    {
        return $this->storage->rolePermissionAdd($role, $permission);
    }
616727
public function addPermission($permission) {
		$per                                 = new permission($permission);
		$this->role->sharedPermissionList [] = $per->get();
		R::store($this->role);
	}
1054906
public function setPermissionsAttribute($permission)
    {
        if (! ($permission instanceof RolePermission)) {
            $permissionPart = $this->factory->create(RolePermission::class);
            $permissionPart->decodeBitwise($permission);

            $permission = $permissionPart;
        }

        $this->attributes['permissions'] = $permission;
    }
339588
public function giveRolePermission($role, $permission, $level = 'allow')
    {
        $this->checkPermissionLevel($level);

        $role       =   $this->findRoleByKey($role);
        $permission =   $this->findPermissionByKey($permission);

        return $role->give($permission, $level);
    }
927432
public function grantPermissions(RolePermission $request)
    {

        $this->giveRolePermissions(
            $request->input('role_id'),
            $request->input('permissions'),
            $request->input('inverse') ? true : false);

        return redirect()->back()
            ->with('success', trans('web::seat.permissions_granted'));
    }
407789
public function getRolePermissions(Role $role)
    {
        $key = $this->getRoleKey($role);

        return array_key_exists($key, $this->permissions) ? $this->permissions[$key] : [];
    }
469182
public function isAllowed($role, $resource, $privilege): bool
    {
        // collect current acl
        $this->listCurrentAcl[$role . $resource . $privilege] = [
            'role'      => $role,
            'resource'  => $resource,
            'privilege' => $privilege,
        ];

        // for policy none
        if ($this->policy == self::POLICY_NONE) {
            return true;
        }

        // auto-fix missing resource in acl
        if ($resource && !isset($this->resource[$resource])) {
            $this->saveResource(['id' => null, 'resource' => $resource]);
        }
        return $this->permission->isAllowed($role, $resource, $privilege);
    }