mirror of
https://github.com/Kareadita/Kavita.git
synced 2025-05-24 00:52:23 -04:00
* Implemented a new role "Change Password". This role allows you to change your own password. By default, all users will have it. A user can have it removed arbitrarliy. Removed components that are no longer going to be used. * Cleaned up some code
19 lines
550 B
C#
19 lines
550 B
C#
using System.Threading.Tasks;
|
|
using API.Constants;
|
|
using API.Entities;
|
|
using Microsoft.AspNetCore.Identity;
|
|
|
|
namespace API.Data;
|
|
|
|
public static class MigrateChangePasswordRoles
|
|
{
|
|
public static async Task Migrate(IUnitOfWork unitOfWork, UserManager<AppUser> userManager)
|
|
{
|
|
foreach (var user in await unitOfWork.UserRepository.GetAllUsers())
|
|
{
|
|
await userManager.RemoveFromRoleAsync(user, "ChangePassword");
|
|
await userManager.AddToRoleAsync(user, PolicyConstants.ChangePasswordRole);
|
|
}
|
|
}
|
|
}
|