/** * Deletes the given access entity in the database. * * @access public * @param \Zepi\Core\AccessControl\Entity\AccessEntity $accessEntity * @return boolean */ public function deleteAccessEntity(AccessEntity $accessEntity) { try { $em = $this->entityManager->getDoctrineEntityManager(); $em->remove($accessEntity); $em->flush(); return true; } catch (\Exception $e) { throw new Exception('Cannot delete the access entitiy "' . $uuid . '".', 0, $e); } }
/** * Revokes the permission for the given access level. * * @access public * @param string $accessLevel * @return boolean * * @throws \Zepi\Core\AccessControl\Exception Cannot revoke the access levels "{accessLevel}". */ public function revokePermissions($accessLevel) { // Do not revoke the permissions if we haven't all data if ($accessLevel == '') { return false; } try { $em = $this->entityManager->getDoctrineEntityManager(); $permissions = $em->getRepository('\\Zepi\\Core\\AccessControl\\Entity\\Permission')->findBy(array('accessLevelKey' => $accessLevel)); foreach ($permissions as $permission) { $em->remove($permission); } $em->flush(); } catch (\Exception $e) { throw new Exception('Cannot revoke the access levels "' . $accessLevel . '".', 0, $e); } }