deleteRole() abstract public method

If it's not a draft, the role assignments will also be deleted.
abstract public deleteRole ( mixed $roleId, integer $status = Role::STATUS_DEFINED )
$roleId mixed
$status integer One of Role::STATUS_DEFINED|Role::STATUS_DRAFT
Example #1
0
 /**
  * Delete the specified role (draft).
  *
  * @param mixed $roleId
  * @param int $status One of Role::STATUS_DEFINED|Role::STATUS_DRAFT
  */
 public function deleteRole($roleId, $status = Role::STATUS_DEFINED)
 {
     $role = $this->loadRole($roleId, $status);
     foreach ($role->policies as $policy) {
         $this->roleGateway->removePolicy($policy->id);
     }
     $this->roleGateway->deleteRole($role->id, $status);
 }
Example #2
0
 /**
  * Delete the specified role.
  *
  * @param mixed $roleId
  */
 public function deleteRole($roleId)
 {
     $role = $this->loadRole($roleId);
     foreach ($role->policies as $policy) {
         $this->roleGateway->removePolicy($policy->id);
     }
     $this->roleGateway->deleteRole($role->id);
 }
 /**
  * Delete the specified role (draft).
  * If it's not a draft, the role assignments will also be deleted.
  *
  * @param mixed $roleId
  * @param int $status One of Role::STATUS_DEFINED|Role::STATUS_DRAFT
  */
 public function deleteRole($roleId, $status = Role::STATUS_DEFINED)
 {
     try {
         return $this->innerGateway->deleteRole($roleId, $status);
     } catch (DBALException $e) {
         throw new RuntimeException('Database error', 0, $e);
     } catch (PDOException $e) {
         throw new RuntimeException('Database error', 0, $e);
     }
 }
 /**
  * Delete the specified role including all of its assignments
  *
  * @param mixed $roleId
  */
 public function deleteRole($roleId)
 {
     try {
         return $this->innerGateway->deleteRole($roleId);
     } catch (DBALException $e) {
         throw new RuntimeException('Database error', 0, $e);
     } catch (PDOException $e) {
         throw new RuntimeException('Database error', 0, $e);
     }
 }