Ejemplo n.º 1
0
 /**
  * Deletes the given role
  *
  * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to delete this role
  *
  * @param \eZ\Publish\API\Repository\Values\User\Role $role
  */
 public function deleteRole(APIRole $role)
 {
     if ($this->repository->hasAccess('role', 'delete') !== true) {
         throw new UnauthorizedException('role', 'delete');
     }
     $loadedRole = $this->loadRole($role->id);
     $this->repository->beginTransaction();
     try {
         $this->userHandler->deleteRole($loadedRole->id);
         $this->repository->commit();
     } catch (Exception $e) {
         $this->repository->rollback();
         throw $e;
     }
 }