/** * @param string $role * @return boolean */ protected function findIsSuperRole($role) { $context = $this->roleFacade->all(); $roleRecord = $this->roleFilter->filterId($context, $role)->select('super')->fetch(); if (!$roleRecord) { return false; } return (bool) $roleRecord->super; }
/** * @param int $id * @return array */ protected function isSuperRole($id) { $selection = $this->userFilter->filterId($this->userFacade->all(), $id); $this->roleFilter->filterSuper($selection, TRUE, ':user_has_role'); $record = $selection->fetch(); if (!$record) { return FALSE; } return TRUE; }
/** * Povoli pro roli vazbu zdroj => akce * Vstupni pole je ve formatu: * [ * 'resource' => ZDROJ * 'action' => AKCE * ] * * @param string $roleId * @param array[] $data */ public function setupResources($roleId, $data) { $oldRolesContext = $this->all(); $oldRoles = $this->roleFilter->filterId($oldRolesContext, $roleId); $this->processSetupResource($roleId, $oldRoles, $data, function ($role, $resource, $action) { $this->roleHasResourceRepository->delete($role, $resource, $action); }); $this->processSetupResource($roleId, $data, $oldRoles, function ($role, $resource, $action) { $this->roleHasResourceRepository->add($role, $resource, $action); }); }
/** * @param string $roleId * @return Selection */ public function findResources($roleId) { $context = $this->roleHasResourceService->all(); return $this->roleFilter->filterId($context, $roleId); }
/** * @param code $primary * @return \Nette\Database\Table\Selection */ private function getRoleData($primary) { return $this->roleFilter->filterId($this->roleFacade->all(), $primary); }
private function getRoleName($id) { return $this->roleFilter->filterId($this->roleFacade->all(), $id)->fetch()->name; }