/** * * @param TblRole $tblRole * * @return bool|TblRoleLevel[] */ public function getLevelAllByRole(TblRole $tblRole) { /** @var TblRoleLevel[] $EntityList */ $EntityList = $this->Connection->getEntityManager()->getEntity('TblRoleLevel')->findBy(array(TblRoleLevel::ATTR_TBL_ROLE => $tblRole->getId())); array_walk($EntityList, function (TblRoleLevel &$V) { $V = $V->getTblLevel(); }); return null === $EntityList ? false : $EntityList; }
/** * @param null|\SPHERE\Application\Platform\Gatekeeper\Authorization\Access\Service\Entity\TblRole $tblRole */ public function setServiceTblRole(TblRole $tblRole = null) { $this->serviceTblRole = null === $tblRole ? null : $tblRole->getId(); }
/** * @param TblAccount $tblAccount * @param TblRole $tblRole * * @return bool */ public function removeAccountAuthorization(TblAccount $tblAccount, TblRole $tblRole) { $Manager = $this->Connection->getEntityManager(); /** @var TblAuthorization $Entity */ $Entity = $Manager->getEntity('TblAccountRole')->findOneBy(array(TblAuthorization::ATTR_TBL_ACCOUNT => $tblAccount->getId(), TblAuthorization::SERVICE_TBL_ROLE => $tblRole->getId())); if (null !== $Entity) { Protocol::useService()->createDeleteEntry($this->Connection->getDatabase(), $Entity); $Manager->killEntity($Entity); return true; } return false; }
/** * * @param TblRole $tblRole * * @return bool|TblRoleLevel[] */ public function getLevelAllByRole(TblRole $tblRole) { $EntityList = $this->getCachedEntityListBy(__METHOD__, $this->Connection->getEntityManager(), 'TblRoleLevel', array(TblRoleLevel::ATTR_TBL_ROLE => $tblRole->getId())); if ($EntityList) { array_walk($EntityList, function (TblRoleLevel &$V) { $V = $V->getTblLevel(); }); } return $EntityList; }
/** * @param null|TblRole $tblRole */ public function setTblRole(TblRole $tblRole = null) { $this->tblRole = null === $tblRole ? null : $tblRole->getId(); }