Пример #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;
 }
Пример #2
0
 public override bool RoleExists(string roleName)
 {
     using (SecurityDAO dao = new SecurityDAO())
     {
         return dao.ReadRoleByName(roleName) != null;
     }
 }