/// <summary> /// Deletes a given role /// </summary> /// <param name="roleName">Role name to delete</param> /// <param name="throwOnPopulatedRole">Specifies whether the function should throw /// if there are assigned users to this role</param> /// <returns>True if successful. Defaults to false</returns> public override bool DeleteRole(string roleName, bool throwOnPopulatedRole) { // Return status. Defaults to false. bool ret = false; // You can only delete an existing role if (RoleExists(roleName)) { if (throwOnPopulatedRole) { if (BusinessUtil.GetUsersInRole(roleName).Any()) { throw new ProviderException("Cannot delete roles with users assigned to them"); } } BusinessUtil.DeleteRole(roleName); ret = true; } return(ret); }
/// <summary> /// Gets all the users in a particular role /// </summary> public override string[] GetUsersInRole(string roleName) { return(BusinessUtil.GetUsersInRole(roleName)); }