Example #1
0
 public override bool DeleteRole(string roleName, bool throwOnPopulatedRole)
 {
     if (!RoleExists(roleName))
     {
         throw new InvalidOperationException("Role does not exists");
     }
     if (throwOnPopulatedRole && GetUsersInRole(roleName).Length > 0)
     {
         throw new InvalidOperationException("Cannot delete a role with related users");
     }
     using (SecurityDAO secDAO = new SecurityDAO())
     {
         secDAO.DeleteRole(secDAO.ReadRoleByName(roleName));
     }
     return true;
 }