mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-01 20:01:10 +00:00
Adds authorization permissions administrator dashboard
This commit is contained in:
1 parent
152cb48050
commit
583b8db865
106 files changed
+5916
-2085
No files matched your search
+2
-2
@@ -19,9 +19,9 @@ public class UserAuthorizationEntity
|
||||
public required Guid UserId { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the collection of roles associated to the user.
|
||||
/// Gets the role associated to the user.
|
||||
/// </summary>
|
||||
public required IReadOnlySet<string> Roles { get; init; }
|
||||
public required string? Role { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the collection of permissions associated to the user.
|
||||
|
||||
@@ -51,9 +51,9 @@ public class UserEntity : IStorageEntity, IAuditableEntity
|
||||
public required ICollection<LibraryEntity> Libraries { get; init; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// Gets the collection of user roles associations that include this user.
|
||||
/// Gets the user roles association that includes this user.
|
||||
/// </summary>
|
||||
public required ICollection<UserRoleEntity> UserRoles { get; init; } = [];
|
||||
public required UserRoleEntity? UserRole { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the collection of user permission associations that include this user.
|
||||
|
||||
@@ -25,5 +25,7 @@ public static partial class Errors
|
||||
public static Error PermissionIdCannotBeEmpty => Error.Validation(description: nameof(PermissionIdCannotBeEmpty));
|
||||
public static Error RoleNameCannotBeEmpty => Error.Validation(description: nameof(RoleNameCannotBeEmpty));
|
||||
public static Error RoleNameCannotBeNull => Error.Validation(description: nameof(RoleNameCannotBeNull));
|
||||
public static Error CannotRemoveLastAdmin => Error.Forbidden(description: nameof(CannotRemoveLastAdmin));
|
||||
public static Error UserMustHaveRoleOrDirectPermissions => Error.Forbidden(description: nameof(UserMustHaveRoleOrDirectPermissions));
|
||||
}
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Application.Core.UsersManagement.Authorization.Queries.GetUserPermissions;
|
||||
using Lumina.Contracts.Requests.Authorization;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Common.Mapping.Authorization;
|
||||
|
||||
/// <summary>
|
||||
/// Extension methods for converting <see cref="GetUserPermissionsRequest"/>.
|
||||
/// </summary>
|
||||
public static class GetUserPermissionsRequestMapping
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts <paramref name="request"/> to <see cref="GetUserPermissionsQuery"/>.
|
||||
/// </summary>
|
||||
/// <param name="request">The request to be converted.</param>
|
||||
/// <returns>The converted query.</returns>
|
||||
public static GetUserPermissionsQuery ToQuery(this GetUserPermissionsRequest request)
|
||||
{
|
||||
return new GetUserPermissionsQuery(
|
||||
request.UserId
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Application.Core.UsersManagement.Authorization.Queries.GetUserRole;
|
||||
using Lumina.Contracts.Requests.Authorization;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Common.Mapping.Authorization;
|
||||
|
||||
/// <summary>
|
||||
/// Extension methods for converting <see cref="GetUserRoleRequest"/>.
|
||||
/// </summary>
|
||||
public static class GetUserRoleRequestMapping
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts <paramref name="request"/> to <see cref="GetUserRoleQuery"/>.
|
||||
/// </summary>
|
||||
/// <param name="request">The request to be converted.</param>
|
||||
/// <returns>The converted query.</returns>
|
||||
public static GetUserRoleQuery ToQuery(this GetUserRoleRequest request)
|
||||
{
|
||||
return new GetUserRoleQuery(
|
||||
request.UserId
|
||||
);
|
||||
}
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Application.Core.UsersManagement.Authorization.Commands.UpdateUserRoleAndPermissions;
|
||||
using Lumina.Contracts.Requests.Authorization;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Common.Mapping.Authorization;
|
||||
|
||||
/// <summary>
|
||||
/// Extension methods for converting <see cref="UpdateUserRoleAndPermissionsRequest"/>.
|
||||
/// </summary>
|
||||
public static class UpdateUserRoleAndPermissionsRequestMapping
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts <paramref name="request"/> to <see cref="UpdateUserRoleAndPermissionsCommand"/>.
|
||||
/// </summary>
|
||||
/// <param name="request">The request to be converted.</param>
|
||||
/// <returns>The converted command.</returns>
|
||||
public static UpdateUserRoleAndPermissionsCommand ToCommand(this UpdateUserRoleAndPermissionsRequest request)
|
||||
{
|
||||
return new UpdateUserRoleAndPermissionsCommand(
|
||||
request.UserId!.Value,
|
||||
request.RoleId,
|
||||
request.Permissions!
|
||||
);
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -19,7 +19,7 @@ public static class UserAuthorizationEntityMapping
|
||||
{
|
||||
return new AuthorizationResponse(
|
||||
repositoryEntity.UserId,
|
||||
repositoryEntity.Roles,
|
||||
repositoryEntity.Role,
|
||||
repositoryEntity.Permissions
|
||||
);
|
||||
}
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ namespace Lumina.Application.Core.Admin.Authorization.Roles.Commands.UpdateRole;
|
||||
/// </summary>
|
||||
/// <param name="RoleId">The Id of the role.</param>
|
||||
/// <param name="RoleName">The name of the role.</param>
|
||||
/// <param name="Permissions">The collection or permissions of the role.</param>
|
||||
/// <param name="Permissions">The collection of Ids of the permissions of the role.</param>
|
||||
[DebuggerDisplay("RoleName: {RoleName}")]
|
||||
public record UpdateRoleCommand(
|
||||
Guid RoleId,
|
||||
|
||||
+1
@@ -51,6 +51,7 @@ public class GetRolePermissionsQueryHandler : IRequestHandler<GetRolePermissions
|
||||
bool isAdmin = await _authorizationService.IsInRoleAsync(_currentUserService.UserId!.Value, "Admin", cancellationToken).ConfigureAwait(false);
|
||||
if (!isAdmin)
|
||||
return Errors.Authorization.NotAuthorized;
|
||||
// get the role from the repository and return its role permissions
|
||||
ErrorOr<RoleEntity?> getRoleResult = await _roleRepository.GetByIdAsync(request.RoleId, cancellationToken).ConfigureAwait(false);
|
||||
if (getRoleResult.IsError)
|
||||
return getRoleResult.Errors;
|
||||
|
||||
+2
-2
@@ -87,8 +87,8 @@ public class SetupApplicationCommandHandler : IRequestHandler<SetupApplicationCo
|
||||
Password = Uri.EscapeDataString(_hashService.HashString(request.Password!)),
|
||||
CreatedOnUtc = _dateTimeProvider.UtcNow,
|
||||
Libraries = [],
|
||||
UserPermissions = [],
|
||||
UserRoles = [],
|
||||
UserPermissions = [],
|
||||
UserRole = null,
|
||||
CreatedBy = id
|
||||
};
|
||||
// if the user enabled two factor auth, include a QR with the totp secret
|
||||
|
||||
+2
-2
@@ -18,8 +18,8 @@ public class AddLibraryCommandValidator : AbstractValidator<AddLibraryCommand>
|
||||
public AddLibraryCommandValidator()
|
||||
{
|
||||
RuleFor(x => x.UserId)
|
||||
.NotEmpty().WithMessage(Errors.Library.UserIdCannotBeEmpty.Description)
|
||||
.Must(id => id != Guid.Empty).WithMessage(Errors.Library.UserIdCannotBeEmpty.Description);
|
||||
.NotEmpty().WithMessage(Errors.Users.UserIdCannotBeEmpty.Description)
|
||||
.Must(id => id != Guid.Empty).WithMessage(Errors.Users.UserIdCannotBeEmpty.Description);
|
||||
|
||||
RuleFor(x => x.LibraryType)
|
||||
.NotNull().WithMessage(Errors.Library.LibraryTypeCannotBeNull.Description)
|
||||
|
||||
+4
-4
@@ -22,12 +22,12 @@ public class UpdateLibraryCommandValidator : AbstractValidator<UpdateLibraryComm
|
||||
.Must(id => id != Guid.Empty).WithMessage(Errors.Library.LibraryIdCannotBeEmpty.Description);
|
||||
|
||||
RuleFor(x => x.CurrentUserId)
|
||||
.NotEmpty().WithMessage(Errors.Library.UserIdCannotBeEmpty.Description)
|
||||
.Must(id => id != Guid.Empty).WithMessage(Errors.Library.UserIdCannotBeEmpty.Description);
|
||||
.NotEmpty().WithMessage(Errors.Users.UserIdCannotBeEmpty.Description)
|
||||
.Must(id => id != Guid.Empty).WithMessage(Errors.Users.UserIdCannotBeEmpty.Description);
|
||||
|
||||
RuleFor(x => x.OwnerId)
|
||||
.NotEmpty().WithMessage(Errors.Library.UserIdCannotBeEmpty.Description)
|
||||
.Must(id => id != Guid.Empty).WithMessage(Errors.Library.UserIdCannotBeEmpty.Description);
|
||||
.NotEmpty().WithMessage(Errors.Users.UserIdCannotBeEmpty.Description)
|
||||
.Must(id => id != Guid.Empty).WithMessage(Errors.Users.UserIdCannotBeEmpty.Description);
|
||||
|
||||
RuleFor(x => x.LibraryType)
|
||||
.NotNull().WithMessage(Errors.Library.LibraryTypeCannotBeNull.Description)
|
||||
|
||||
+2
-2
@@ -21,7 +21,7 @@ public class GetLibraryQueryValidator : AbstractValidator<GetLibraryQuery>
|
||||
.Must(id => id != Guid.Empty).WithMessage(Errors.Library.LibraryIdCannotBeEmpty.Description);
|
||||
|
||||
RuleFor(x => x.UserId)
|
||||
.NotEmpty().WithMessage(Errors.Library.UserIdCannotBeEmpty.Description)
|
||||
.Must(id => id != Guid.Empty).WithMessage(Errors.Library.UserIdCannotBeEmpty.Description);
|
||||
.NotEmpty().WithMessage(Errors.Users.UserIdCannotBeEmpty.Description)
|
||||
.Must(id => id != Guid.Empty).WithMessage(Errors.Users.UserIdCannotBeEmpty.Description);
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -80,7 +80,7 @@ public class RegisterUserCommandHandler : IRequestHandler<RegisterUserCommand, E
|
||||
CreatedOnUtc = _dateTimeProvider.UtcNow,
|
||||
Libraries = [],
|
||||
UserPermissions = [],
|
||||
UserRoles = [],
|
||||
UserRole = null,
|
||||
CreatedBy = id
|
||||
};
|
||||
// if the user enabled two factor auth, include a QR with the totp secret
|
||||
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using Lumina.Contracts.Responses.Authorization;
|
||||
using Mediator;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Core.UsersManagement.Authorization.Commands.UpdateUserRoleAndPermissions;
|
||||
|
||||
/// <summary>
|
||||
/// Command for updating the authorization role and permissions of a user.
|
||||
/// </summary>
|
||||
/// <param name="UserId">The Id of the user.</param>
|
||||
/// <param name="RoleId">The Id of the role.</param>
|
||||
/// <param name="Permissions">The collection of Ids of the permissions of the user.</param>
|
||||
[DebuggerDisplay("UserId: {UserId}")]
|
||||
public record UpdateUserRoleAndPermissionsCommand(
|
||||
Guid UserId,
|
||||
Guid? RoleId,
|
||||
List<Guid> Permissions
|
||||
) : IRequest<ErrorOr<AuthorizationResponse>>;
|
||||
+146
@@ -0,0 +1,146 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using Lumina.Application.Common.DataAccess.Entities.Authorization;
|
||||
using Lumina.Application.Common.DataAccess.Entities.UsersManagement;
|
||||
using Lumina.Application.Common.DataAccess.Repositories.Authorization;
|
||||
using Lumina.Application.Common.DataAccess.Repositories.Users;
|
||||
using Lumina.Application.Common.DataAccess.UoW;
|
||||
using Lumina.Application.Common.Infrastructure.Authentication;
|
||||
using Lumina.Application.Common.Infrastructure.Authorization;
|
||||
using Lumina.Contracts.Responses.Authorization;
|
||||
using Mediator;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using ApplicationErrors = Lumina.Application.Common.Errors.Errors;
|
||||
using DomainErrors = Lumina.Domain.Common.Errors.Errors;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Core.UsersManagement.Authorization.Commands.UpdateUserRoleAndPermissions;
|
||||
|
||||
/// <summary>
|
||||
/// Handler for the command to update an authorization role.
|
||||
/// </summary>
|
||||
public class UpdateUserRoleAndPermissionsCommandHandler : IRequestHandler<UpdateUserRoleAndPermissionsCommand, ErrorOr<AuthorizationResponse>>
|
||||
{
|
||||
private readonly IUnitOfWork _unitOfWork;
|
||||
private readonly IAuthorizationService _authorizationService;
|
||||
private readonly ICurrentUserService _currentUserService;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UpdateUserRoleAndPermissionsCommandHandler"/> class.
|
||||
/// </summary>
|
||||
/// <param name="authorizationService">Injected service for authorization related functionality.</param>
|
||||
/// <param name="currentUserService">Injected service to retrieve the current user information.</param>
|
||||
/// <param name="unitOfWork">Injected unit of work for interacting with the data access layer repositories.</param>
|
||||
public UpdateUserRoleAndPermissionsCommandHandler(IAuthorizationService authorizationService, ICurrentUserService currentUserService, IUnitOfWork unitOfWork)
|
||||
{
|
||||
_unitOfWork = unitOfWork;
|
||||
_authorizationService = authorizationService;
|
||||
_currentUserService = currentUserService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the command to update an authorization role.
|
||||
/// </summary>
|
||||
/// <param name="request">The request to be handled.</param>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
/// <returns>
|
||||
/// An <see cref="ErrorOr{TValue}"/> containing either a successfully updated <see cref="RoleResponse"/>, or an error message.
|
||||
/// </returns>
|
||||
public async ValueTask<ErrorOr<AuthorizationResponse>> Handle(UpdateUserRoleAndPermissionsCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
// only admins can update user authorizations
|
||||
bool isAdmin = await _authorizationService.IsInRoleAsync(_currentUserService.UserId!.Value, "Admin", cancellationToken).ConfigureAwait(false);
|
||||
if (!isAdmin)
|
||||
return ApplicationErrors.Authorization.NotAuthorized;
|
||||
|
||||
// get repositories
|
||||
IUserRepository userRepository = _unitOfWork.GetRepository<IUserRepository>();
|
||||
IRoleRepository roleRepository = _unitOfWork.GetRepository<IRoleRepository>();
|
||||
IPermissionRepository permissionRepository = _unitOfWork.GetRepository<IPermissionRepository>();
|
||||
|
||||
// get the user to update
|
||||
ErrorOr<UserEntity?> getUserResult = await userRepository.GetByIdAsync(request.UserId, cancellationToken).ConfigureAwait(false);
|
||||
if (getUserResult.IsError || getUserResult.Value is null)
|
||||
return DomainErrors.Users.UserDoesNotExist;
|
||||
|
||||
ErrorOr<RoleEntity?> getRoleResult = default;
|
||||
if (request.RoleId is not null)
|
||||
{
|
||||
// get the new role
|
||||
getRoleResult = await roleRepository.GetByIdAsync(request.RoleId!.Value, cancellationToken).ConfigureAwait(false);
|
||||
if (getRoleResult.IsError || getRoleResult.Value is null)
|
||||
return ApplicationErrors.Authorization.RoleNotFound;
|
||||
|
||||
// check if we're changing an admin's role and if this would leave us without admins
|
||||
if (getUserResult.Value.UserRole?.Role.RoleName == "Admin" && getRoleResult.Value.RoleName != "Admin")
|
||||
{
|
||||
// count how many admins we have
|
||||
ErrorOr<IEnumerable<UserEntity>> getAllUsersResult = await userRepository.GetAllAsync(cancellationToken).ConfigureAwait(false);
|
||||
if (getAllUsersResult.IsError)
|
||||
return getAllUsersResult.Errors;
|
||||
|
||||
int adminCount = getAllUsersResult.Value.Count(user => user.UserRole?.Role.RoleName == "Admin");
|
||||
if (adminCount <= 1)
|
||||
return ApplicationErrors.Authorization.CannotRemoveLastAdmin;
|
||||
}
|
||||
}
|
||||
// get the permissions to assign
|
||||
ErrorOr<IEnumerable<PermissionEntity>> getPermissionsResult =
|
||||
await permissionRepository.GetByIdsAsync(request.Permissions, cancellationToken).ConfigureAwait(false);
|
||||
if (getPermissionsResult.IsError)
|
||||
return getPermissionsResult.Errors;
|
||||
|
||||
// update the user
|
||||
UserEntity userToUpdate = getUserResult.Value;
|
||||
|
||||
UserRoleEntity? userRole = default!;
|
||||
if (request.RoleId is not null)
|
||||
{
|
||||
userRole = new()
|
||||
{
|
||||
UserId = userToUpdate.Id,
|
||||
RoleId = request.RoleId.Value,
|
||||
Role = getRoleResult.Value!,
|
||||
User = userToUpdate
|
||||
};
|
||||
}
|
||||
|
||||
UserEntity updatedUser = new()
|
||||
{
|
||||
Id = userToUpdate.Id,
|
||||
Username = userToUpdate.Username,
|
||||
Password = userToUpdate.Password,
|
||||
TempPassword = userToUpdate.TempPassword,
|
||||
TotpSecret = userToUpdate.TotpSecret,
|
||||
TempPasswordCreated = userToUpdate.TempPasswordCreated,
|
||||
Libraries = userToUpdate.Libraries,
|
||||
UserRole = userRole,
|
||||
UserPermissions = request.Permissions.Select(permissionId => new UserPermissionEntity
|
||||
{
|
||||
UserId = userToUpdate.Id,
|
||||
PermissionId = permissionId,
|
||||
Permission = getPermissionsResult.Value.First(permission => permission.Id == permissionId),
|
||||
User = userToUpdate
|
||||
}).ToList()
|
||||
};
|
||||
|
||||
// save changes and return result
|
||||
ErrorOr<Updated> updateResult = await userRepository.UpdateAsync(updatedUser, cancellationToken).ConfigureAwait(false);
|
||||
if (updateResult.IsError)
|
||||
return updateResult.Errors;
|
||||
|
||||
await _unitOfWork.SaveChangesAsync(cancellationToken).ConfigureAwait(false);
|
||||
|
||||
return new AuthorizationResponse(
|
||||
userToUpdate.Id,
|
||||
getRoleResult.Value?.RoleName,
|
||||
userToUpdate.UserPermissions
|
||||
.Select(up => up.Permission.PermissionName)
|
||||
.ToHashSet()
|
||||
);
|
||||
}
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using FluentValidation;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using ApplicationErrors = Lumina.Application.Common.Errors.Errors;
|
||||
using DomainErrors = Lumina.Domain.Common.Errors.Errors;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Core.UsersManagement.Authorization.Commands.UpdateUserRoleAndPermissions;
|
||||
|
||||
/// <summary>
|
||||
/// Validates the needed validation rules for <see cref="UpdateUserRoleAndPermissionsCommand"/>.
|
||||
/// </summary>
|
||||
public class UpdateUserRoleAndPermissionsCommandValidator : AbstractValidator<UpdateUserRoleAndPermissionsCommand>
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UpdateUserRoleAndPermissionsCommandValidator"/> class.
|
||||
/// </summary>
|
||||
public UpdateUserRoleAndPermissionsCommandValidator()
|
||||
{
|
||||
RuleFor(x => x.UserId)
|
||||
.NotEmpty().WithMessage(DomainErrors.Users.UserIdCannotBeEmpty.Description)
|
||||
.Must(id => id != Guid.Empty).WithMessage(DomainErrors.Users.UserIdCannotBeEmpty.Description);
|
||||
|
||||
// validate Permissions only if provided
|
||||
When(x => x.Permissions != null && x.Permissions.Count != 0, () =>
|
||||
{
|
||||
RuleForEach(x => x.Permissions)
|
||||
.NotEmpty().WithMessage(ApplicationErrors.Authorization.PermissionIdCannotBeEmpty.Description)
|
||||
.Must(id => id != Guid.Empty).WithMessage(ApplicationErrors.Authorization.PermissionIdCannotBeEmpty.Description);
|
||||
});
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -51,7 +51,7 @@ public class GetAuthorizationQueryHandler : IRequestHandler<GetAuthorizationQuer
|
||||
if (getCurrentUserPermissionResult.IsError)
|
||||
return getCurrentUserPermissionResult.Errors;
|
||||
// if the current user is not an Admin, and the account for whom they request the permissions list is not theirs, deny the request
|
||||
if (!getCurrentUserPermissionResult.Value.Roles.Any(role => role == "Admin"))
|
||||
if (getCurrentUserPermissionResult.Value.Role != "Admin")
|
||||
return Errors.Authorization.NotAuthorized;
|
||||
}
|
||||
ErrorOr<UserAuthorizationEntity> getUserPermissionResult = await _authorizationService.GetUserAuthorizationAsync(request.UserId!.Value, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using Lumina.Contracts.Responses.Authorization;
|
||||
using Mediator;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Core.UsersManagement.Authorization.Queries.GetUserPermissions;
|
||||
|
||||
/// <summary>
|
||||
/// Query for retrieving the authorization permissions of a user identified by <paramref name="UserId"/>.
|
||||
/// </summary>
|
||||
/// <param name="UserId">The Id of the user for whom to get the authorization permissions.</param>
|
||||
[DebuggerDisplay("UserId: {UserId}")]
|
||||
public record GetUserPermissionsQuery(
|
||||
Guid? UserId
|
||||
) : IRequest<ErrorOr<IEnumerable<PermissionResponse>>>;
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using Lumina.Application.Common.DataAccess.Entities.UsersManagement;
|
||||
using Lumina.Application.Common.DataAccess.Repositories.Users;
|
||||
using Lumina.Application.Common.DataAccess.UoW;
|
||||
using Lumina.Application.Common.Errors;
|
||||
using Lumina.Application.Common.Infrastructure.Authentication;
|
||||
using Lumina.Application.Common.Infrastructure.Authorization;
|
||||
using Lumina.Application.Common.Mapping.Authorization;
|
||||
using Lumina.Contracts.Responses.Authorization;
|
||||
using Mediator;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Core.UsersManagement.Authorization.Queries.GetUserPermissions;
|
||||
|
||||
/// <summary>
|
||||
/// Handler for the query to retrieve the authorization permissions of a user.
|
||||
/// </summary>
|
||||
public class GetUserPermissionsQueryHandler : IRequestHandler<GetUserPermissionsQuery, ErrorOr<IEnumerable<PermissionResponse>>>
|
||||
{
|
||||
private readonly ICurrentUserService _currentUserService;
|
||||
private readonly IAuthorizationService _authorizationService;
|
||||
private readonly IUserRepository _userRepository;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GetUserPermissionsQueryHandler"/> class.
|
||||
/// </summary>
|
||||
/// <param name="authorizationService">Injected service for authorization related functionality.</param>
|
||||
/// <param name="currentUserService">Injected service to retrieve the current user information.</param>
|
||||
/// <param name="unitOfWork">Injected unit of work for interacting with the data access layer repositories.</param>
|
||||
public GetUserPermissionsQueryHandler(IAuthorizationService authorizationService, ICurrentUserService currentUserService, IUnitOfWork unitOfWork)
|
||||
{
|
||||
_authorizationService = authorizationService;
|
||||
_currentUserService = currentUserService;
|
||||
_userRepository = unitOfWork.GetRepository<IUserRepository>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the query to retrieve the authorization permissions of a user.
|
||||
/// </summary>
|
||||
/// <param name="request">The request to be handled.</param>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
/// <returns>
|
||||
/// An <see cref="ErrorOr{TValue}"/> containing either a collection of <see cref="PermissionResponse"/>, or an error message.
|
||||
/// </returns>
|
||||
public async ValueTask<ErrorOr<IEnumerable<PermissionResponse>>> Handle(GetUserPermissionsQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
// only admins can see the list of authorization permissions
|
||||
bool isAdmin = await _authorizationService.IsInRoleAsync(_currentUserService.UserId!.Value, "Admin", cancellationToken).ConfigureAwait(false);
|
||||
if (!isAdmin)
|
||||
return Errors.Authorization.NotAuthorized;
|
||||
// get the user from the repository and return its permissions
|
||||
ErrorOr<UserEntity?> getUserResult = await _userRepository.GetByIdAsync(request.UserId!.Value, cancellationToken).ConfigureAwait(false);
|
||||
if (getUserResult.IsError)
|
||||
return getUserResult.Errors;
|
||||
else if (getUserResult.Value is null)
|
||||
return Errors.Authentication.UsernameDoesNotExist;
|
||||
return ErrorOrFactory.From(getUserResult.Value.UserPermissions.Select(userPermission => userPermission.Permission).ToResponses());
|
||||
}
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using FluentValidation;
|
||||
using Lumina.Domain.Common.Errors;
|
||||
using System;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Core.UsersManagement.Authorization.Queries.GetUserPermissions;
|
||||
|
||||
/// <summary>
|
||||
/// Validates the needed validation rules for <see cref="GetUserPermissionsQuery"/>.
|
||||
/// </summary>
|
||||
public class GetUserPermissionsQueryValidator : AbstractValidator<GetUserPermissionsQuery>
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GetUserPermissionsQueryValidator"/> class.
|
||||
/// </summary>
|
||||
public GetUserPermissionsQueryValidator()
|
||||
{
|
||||
RuleFor(x => x.UserId)
|
||||
.NotEmpty().WithMessage(Errors.Users.UserIdCannotBeEmpty.Description)
|
||||
.Must(id => id != Guid.Empty).WithMessage(Errors.Users.UserIdCannotBeEmpty.Description);
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using Lumina.Contracts.Responses.Authorization;
|
||||
using Mediator;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Core.UsersManagement.Authorization.Queries.GetUserRole;
|
||||
|
||||
/// <summary>
|
||||
/// Query for retrieving the authorization role of a user identified by <paramref name="UserId"/>.
|
||||
/// </summary>
|
||||
/// <param name="UserId">The Id of the user for whom to get the authorization role.</param>
|
||||
[DebuggerDisplay("UserId: {UserId}")]
|
||||
public record GetUserRoleQuery(
|
||||
Guid? UserId
|
||||
) : IRequest<ErrorOr<RoleResponse?>>;
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using Lumina.Application.Common.DataAccess.Entities.UsersManagement;
|
||||
using Lumina.Application.Common.DataAccess.Repositories.Users;
|
||||
using Lumina.Application.Common.DataAccess.UoW;
|
||||
using Lumina.Application.Common.Errors;
|
||||
using Lumina.Application.Common.Infrastructure.Authentication;
|
||||
using Lumina.Application.Common.Infrastructure.Authorization;
|
||||
using Lumina.Application.Common.Mapping.Authorization;
|
||||
using Lumina.Contracts.Responses.Authorization;
|
||||
using Mediator;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Core.UsersManagement.Authorization.Queries.GetUserRole;
|
||||
|
||||
/// <summary>
|
||||
/// Handler for the query to retrieve the authorization role of a user.
|
||||
/// </summary>
|
||||
public class GetUserRoleQueryHandler : IRequestHandler<GetUserRoleQuery, ErrorOr<RoleResponse?>>
|
||||
{
|
||||
private readonly ICurrentUserService _currentUserService;
|
||||
private readonly IAuthorizationService _authorizationService;
|
||||
private readonly IUserRepository _userRepository;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GetUserRoleQueryHandler"/> class.
|
||||
/// </summary>
|
||||
/// <param name="authorizationService">Injected service for authorization related functionality.</param>
|
||||
/// <param name="currentUserService">Injected service to retrieve the current user information.</param>
|
||||
/// <param name="unitOfWork">Injected unit of work for interacting with the data access layer repositories.</param>
|
||||
public GetUserRoleQueryHandler(IAuthorizationService authorizationService, ICurrentUserService currentUserService, IUnitOfWork unitOfWork)
|
||||
{
|
||||
_authorizationService = authorizationService;
|
||||
_currentUserService = currentUserService;
|
||||
_userRepository = unitOfWork.GetRepository<IUserRepository>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the query to retrieve the authorization role of a user.
|
||||
/// </summary>
|
||||
/// <param name="request">The request to be handled.</param>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
/// <returns>
|
||||
/// An <see cref="ErrorOr{TValue}"/> containing either a <see cref="RoleResponse"/>, or an error message.
|
||||
/// </returns>
|
||||
public async ValueTask<ErrorOr<RoleResponse?>> Handle(GetUserRoleQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
// only admins can see the authorization role
|
||||
bool isAdmin = await _authorizationService.IsInRoleAsync(_currentUserService.UserId!.Value, "Admin", cancellationToken).ConfigureAwait(false);
|
||||
if (!isAdmin)
|
||||
return Errors.Authorization.NotAuthorized;
|
||||
// get the user from the repository and return its roles
|
||||
ErrorOr<UserEntity?> getUserResult = await _userRepository.GetByIdAsync(request.UserId!.Value, cancellationToken).ConfigureAwait(false);
|
||||
if (getUserResult.IsError)
|
||||
return getUserResult.Errors;
|
||||
else if (getUserResult.Value is null)
|
||||
return Errors.Authentication.UsernameDoesNotExist;
|
||||
return ErrorOrFactory.From(getUserResult.Value.UserRole?.Role.ToResponse());
|
||||
}
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using FluentValidation;
|
||||
using Lumina.Domain.Common.Errors;
|
||||
using System;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Core.UsersManagement.Authorization.Queries.GetUserRole;
|
||||
|
||||
/// <summary>
|
||||
/// Validates the needed validation rules for <see cref="GetUserRoleQuery"/>.
|
||||
/// </summary>
|
||||
public class GetUserRoleQueryValidator : AbstractValidator<GetUserRoleQuery>
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GetUserRoleQueryValidator"/> class.
|
||||
/// </summary>
|
||||
public GetUserRoleQueryValidator()
|
||||
{
|
||||
RuleFor(x => x.UserId)
|
||||
.NotEmpty().WithMessage(Errors.Users.UserIdCannotBeEmpty.Description)
|
||||
.Must(id => id != Guid.Empty).WithMessage(Errors.Users.UserIdCannotBeEmpty.Description);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using System;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Requests.Authorization;
|
||||
|
||||
/// <summary>
|
||||
/// Represents the request model for retrieving the authorization permissions of a user identified by <paramref name="UserId"/>.
|
||||
/// </summary>
|
||||
/// <param name="UserId">The Id of the user for whom to get the authorization permissions. Required.</param>
|
||||
public record GetUserPermissionsRequest(
|
||||
Guid? UserId
|
||||
);
|
||||
@@ -0,0 +1,13 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using System;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Requests.Authorization;
|
||||
|
||||
/// <summary>
|
||||
/// Represents the request model for retrieving the authorization role of a user identified by <paramref name="UserId"/>.
|
||||
/// </summary>
|
||||
/// <param name="UserId">The Id of the user for whom to get the authorization role. Required.</param>
|
||||
public record GetUserRoleRequest(
|
||||
Guid? UserId
|
||||
);
|
||||
@@ -11,7 +11,7 @@ namespace Lumina.Contracts.Requests.Authorization;
|
||||
/// </summary>
|
||||
/// <param name="RoleId">The Id of the role. Required.</param>
|
||||
/// <param name="RoleName">The name of the role. Required.</param>
|
||||
/// <param name="Permissions">The collection or permissions of the role. Required.</param>
|
||||
/// <param name="Permissions">The collection of Ids of the permissions of the role. Required.</param>
|
||||
[DebuggerDisplay("RoleName: {RoleName}")]
|
||||
public record UpdateRoleRequest(
|
||||
Guid? RoleId,
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Requests.Authorization;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a request for updating the authorization role and permissions of a user.
|
||||
/// </summary>
|
||||
/// <param name="RoleId">The Id of the user. Required.</param>
|
||||
/// <param name="RoleId">The Id of the role. Required.</param>
|
||||
/// <param name="Permissions">The collection of Ids of the permissions of the role. Required.</param>
|
||||
[DebuggerDisplay("UserId: {UserId}")]
|
||||
public record UpdateUserRoleAndPermissionsRequest(
|
||||
Guid? UserId,
|
||||
Guid? RoleId,
|
||||
List<Guid>? Permissions
|
||||
);
|
||||
@@ -11,11 +11,11 @@ namespace Lumina.Contracts.Responses.Authorization;
|
||||
/// Represents the response model for an account authorization request.
|
||||
/// </summary>
|
||||
/// <param name="UserId">The Id of the user for whom the authorization is retrieved.</param>
|
||||
/// <param name="Roles">The collection of roles associated to the user.</param>
|
||||
/// <param name="Role">The collection of roles associated to the user.</param>
|
||||
/// <param name="Permissions">The collection of permissions associated to the user.</param>
|
||||
[DebuggerDisplay("UserId: {UserId}")]
|
||||
public record AuthorizationResponse(
|
||||
Guid UserId,
|
||||
IReadOnlySet<string> Roles,
|
||||
string? Role,
|
||||
IReadOnlySet<AuthorizationPermission> Permissions
|
||||
);
|
||||
@@ -1,4 +1,5 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Application.Common.DataAccess.Entities.Authorization;
|
||||
using Lumina.Application.Common.DataAccess.Entities.UsersManagement;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
@@ -51,10 +52,11 @@ public class UserConfiguration : IEntityTypeConfiguration<UserEntity>
|
||||
.IsRequired() // a library must have a user
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
builder.HasMany(user => user.UserRoles)
|
||||
.WithOne(userRole => userRole.User)
|
||||
.HasForeignKey(userRole => userRole.UserId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
builder.HasOne(user => user.UserRole)
|
||||
.WithOne(userRole => userRole.User)
|
||||
.HasForeignKey<UserRoleEntity>(userRole => userRole.UserId)
|
||||
.IsRequired()
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
builder.HasMany(user => user.UserPermissions)
|
||||
.WithOne(userPermission => userPermission.User)
|
||||
|
||||
@@ -19,19 +19,19 @@ public class UserRoleConfiguration : IEntityTypeConfiguration<UserRoleEntity>
|
||||
{
|
||||
builder.ToTable("UserRoles");
|
||||
|
||||
// composite primary key
|
||||
builder.HasKey(userRole => new { userRole.UserId, userRole.RoleId });
|
||||
// primary key
|
||||
builder.HasKey(userRole => userRole.UserId );
|
||||
|
||||
builder.Ignore(userRole => userRole.Id); // Id is only needed as a generic constraint for the repository, but this entity uses a composite key as Id
|
||||
|
||||
// foreign key: User
|
||||
// foreign key: User (one-to-one relationship)
|
||||
builder.HasOne(userRole => userRole.User)
|
||||
.WithMany(user => user.UserRoles)
|
||||
.HasForeignKey(userRole => userRole.UserId)
|
||||
.WithOne(user => user.UserRole)
|
||||
.HasForeignKey<UserRoleEntity>(userRole => userRole.UserId)
|
||||
.IsRequired()
|
||||
.OnDelete(DeleteBehavior.Cascade); // deleting a User deletes associated UserRoles
|
||||
.OnDelete(DeleteBehavior.Cascade); // deleting a User deletes associated UserRole
|
||||
|
||||
// foreign key: Role
|
||||
// foreign key: Role (many-to-one relationship)
|
||||
builder.HasOne(userRole => userRole.Role)
|
||||
.WithMany(role => role.UserRoles)
|
||||
.HasForeignKey(userRole => userRole.RoleId)
|
||||
|
||||
Generated
+698
@@ -0,0 +1,698 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Lumina.DataAccess.Core.UoW;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Lumina.DataAccess.Common.Migrations
|
||||
{
|
||||
[DbContext(typeof(LuminaDbContext))]
|
||||
[Migration("20241219160437_ChangesUserRolesToUserRole")]
|
||||
partial class ChangesUserRolesToUserRole
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder.HasAnnotation("ProductVersion", "9.0.0");
|
||||
|
||||
modelBuilder.Entity("BookGenres", b =>
|
||||
{
|
||||
b.Property<Guid>("BookId")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("GenreId")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("BookId", "GenreId");
|
||||
|
||||
b.HasIndex("GenreId");
|
||||
|
||||
b.ToTable("BookGenres", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BookTags", b =>
|
||||
{
|
||||
b.Property<Guid>("BookId")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("TagId")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("BookId", "TagId");
|
||||
|
||||
b.HasIndex("TagId");
|
||||
|
||||
b.ToTable("BookTags", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.Authorization.PermissionEntity", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(0);
|
||||
|
||||
b.Property<Guid>("CreatedBy")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(4);
|
||||
|
||||
b.Property<DateTime>("CreatedOnUtc")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(3);
|
||||
|
||||
b.Property<string>("PermissionName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(1);
|
||||
|
||||
b.Property<Guid?>("UpdatedBy")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(6);
|
||||
|
||||
b.Property<DateTime?>("UpdatedOnUtc")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(5);
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Permissions", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.Authorization.RoleEntity", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(0);
|
||||
|
||||
b.Property<Guid>("CreatedBy")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(4);
|
||||
|
||||
b.Property<DateTime>("CreatedOnUtc")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(3);
|
||||
|
||||
b.Property<string>("RoleName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(1);
|
||||
|
||||
b.Property<Guid?>("UpdatedBy")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(6);
|
||||
|
||||
b.Property<DateTime?>("UpdatedOnUtc")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(5);
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Roles", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.Authorization.RolePermissionEntity", b =>
|
||||
{
|
||||
b.Property<Guid>("RoleId")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<Guid>("PermissionId")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<Guid>("CreatedBy")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(2);
|
||||
|
||||
b.Property<DateTime>("CreatedOnUtc")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(1);
|
||||
|
||||
b.Property<Guid?>("UpdatedBy")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(4);
|
||||
|
||||
b.Property<DateTime?>("UpdatedOnUtc")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(3);
|
||||
|
||||
b.HasKey("RoleId", "PermissionId");
|
||||
|
||||
b.HasIndex("PermissionId");
|
||||
|
||||
b.HasIndex("RoleId", "PermissionId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("RolePermissions", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.Authorization.UserPermissionEntity", b =>
|
||||
{
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<Guid>("PermissionId")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<Guid>("CreatedBy")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(2);
|
||||
|
||||
b.Property<DateTime>("CreatedOnUtc")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(1);
|
||||
|
||||
b.Property<Guid?>("UpdatedBy")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(4);
|
||||
|
||||
b.Property<DateTime?>("UpdatedOnUtc")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(3);
|
||||
|
||||
b.HasKey("UserId", "PermissionId");
|
||||
|
||||
b.HasIndex("PermissionId");
|
||||
|
||||
b.HasIndex("UserId", "PermissionId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("UserPermissions", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.Authorization.UserRoleEntity", b =>
|
||||
{
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<Guid>("CreatedBy")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(2);
|
||||
|
||||
b.Property<DateTime>("CreatedOnUtc")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(1);
|
||||
|
||||
b.Property<Guid>("RoleId")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<Guid?>("UpdatedBy")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(4);
|
||||
|
||||
b.Property<DateTime?>("UpdatedOnUtc")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(3);
|
||||
|
||||
b.HasKey("UserId");
|
||||
|
||||
b.HasIndex("RoleId");
|
||||
|
||||
b.HasIndex("UserId", "RoleId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("UserRoles", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.Common.GenreEntity", b =>
|
||||
{
|
||||
b.Property<string>("Name")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Name");
|
||||
|
||||
b.ToTable("Genres", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.Common.TagEntity", b =>
|
||||
{
|
||||
b.Property<string>("Name")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Name");
|
||||
|
||||
b.ToTable("Tags", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.Management.LibraryEntity", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(0);
|
||||
|
||||
b.Property<DateTime>("Created")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("LibraryType")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(2);
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(1);
|
||||
|
||||
b.Property<DateTime?>("Updated")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Libraries", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.WrittenContentLibrary.BookLibrary.BookEntity", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(0);
|
||||
|
||||
b.Property<string>("ASIN")
|
||||
.HasMaxLength(10)
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(21);
|
||||
|
||||
b.Property<string>("AppleBooksId")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(29);
|
||||
|
||||
b.Property<string>("BarnesAndNobleId")
|
||||
.HasMaxLength(10)
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(28);
|
||||
|
||||
b.Property<DateTime>("Created")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(30);
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasMaxLength(2000)
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(3);
|
||||
|
||||
b.Property<string>("Edition")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(19);
|
||||
|
||||
b.Property<string>("Format")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(18);
|
||||
|
||||
b.Property<string>("GoodreadsId")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(22);
|
||||
|
||||
b.Property<string>("GoogleBooksId")
|
||||
.HasMaxLength(12)
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(27);
|
||||
|
||||
b.Property<string>("LCCN")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(23);
|
||||
|
||||
b.Property<string>("LanguageCode")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(10);
|
||||
|
||||
b.Property<string>("LanguageName")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(11);
|
||||
|
||||
b.Property<string>("LanguageNativeName")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(12);
|
||||
|
||||
b.Property<string>("LibraryThingId")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(26);
|
||||
|
||||
b.Property<string>("OCLCNumber")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(24);
|
||||
|
||||
b.Property<string>("OpenLibraryId")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(25);
|
||||
|
||||
b.Property<string>("OriginalLanguageCode")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(13);
|
||||
|
||||
b.Property<string>("OriginalLanguageName")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(14);
|
||||
|
||||
b.Property<string>("OriginalLanguageNativeName")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(15);
|
||||
|
||||
b.Property<DateOnly?>("OriginalReleaseDate")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(4);
|
||||
|
||||
b.Property<int?>("OriginalReleaseYear")
|
||||
.HasColumnType("INTEGER")
|
||||
.HasColumnOrder(5);
|
||||
|
||||
b.Property<string>("OriginalTitle")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(2);
|
||||
|
||||
b.Property<int?>("PageCount")
|
||||
.HasColumnType("INTEGER")
|
||||
.HasColumnOrder(17);
|
||||
|
||||
b.Property<string>("Publisher")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(16);
|
||||
|
||||
b.Property<DateOnly?>("ReReleaseDate")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(6);
|
||||
|
||||
b.Property<int?>("ReReleaseYear")
|
||||
.HasColumnType("INTEGER")
|
||||
.HasColumnOrder(7);
|
||||
|
||||
b.Property<string>("ReleaseCountry")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(8);
|
||||
|
||||
b.Property<string>("ReleaseVersion")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(9);
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(1);
|
||||
|
||||
b.Property<DateTime?>("Updated")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(31);
|
||||
|
||||
b.Property<int?>("VolumeNumber")
|
||||
.HasColumnType("INTEGER")
|
||||
.HasColumnOrder(20);
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Books", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.UsersManagement.UserEntity", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(0);
|
||||
|
||||
b.Property<Guid>("CreatedBy")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(7);
|
||||
|
||||
b.Property<DateTime>("CreatedOnUtc")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(6);
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(2);
|
||||
|
||||
b.Property<string>("TempPassword")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(3);
|
||||
|
||||
b.Property<DateTime?>("TempPasswordCreated")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(5);
|
||||
|
||||
b.Property<string>("TotpSecret")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(4);
|
||||
|
||||
b.Property<Guid?>("UpdatedBy")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(9);
|
||||
|
||||
b.Property<DateTime?>("UpdatedOnUtc")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(8);
|
||||
|
||||
b.Property<string>("Username")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(1);
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Username")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Users", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BookGenres", b =>
|
||||
{
|
||||
b.HasOne("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.WrittenContentLibrary.BookLibrary.BookEntity", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("BookId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Lumina.Application.Common.DataAccess.Entities.Common.GenreEntity", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("GenreId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BookTags", b =>
|
||||
{
|
||||
b.HasOne("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.WrittenContentLibrary.BookLibrary.BookEntity", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("BookId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Lumina.Application.Common.DataAccess.Entities.Common.TagEntity", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("TagId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.Authorization.RolePermissionEntity", b =>
|
||||
{
|
||||
b.HasOne("Lumina.Application.Common.DataAccess.Entities.Authorization.PermissionEntity", "Permission")
|
||||
.WithMany("RolePermissions")
|
||||
.HasForeignKey("PermissionId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Lumina.Application.Common.DataAccess.Entities.Authorization.RoleEntity", "Role")
|
||||
.WithMany("RolePermissions")
|
||||
.HasForeignKey("RoleId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Permission");
|
||||
|
||||
b.Navigation("Role");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.Authorization.UserPermissionEntity", b =>
|
||||
{
|
||||
b.HasOne("Lumina.Application.Common.DataAccess.Entities.Authorization.PermissionEntity", "Permission")
|
||||
.WithMany("UserPermissions")
|
||||
.HasForeignKey("PermissionId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Lumina.Application.Common.DataAccess.Entities.UsersManagement.UserEntity", "User")
|
||||
.WithMany("UserPermissions")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Permission");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.Authorization.UserRoleEntity", b =>
|
||||
{
|
||||
b.HasOne("Lumina.Application.Common.DataAccess.Entities.Authorization.RoleEntity", "Role")
|
||||
.WithMany("UserRoles")
|
||||
.HasForeignKey("RoleId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Lumina.Application.Common.DataAccess.Entities.UsersManagement.UserEntity", "User")
|
||||
.WithOne("UserRole")
|
||||
.HasForeignKey("Lumina.Application.Common.DataAccess.Entities.Authorization.UserRoleEntity", "UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Role");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.Management.LibraryEntity", b =>
|
||||
{
|
||||
b.HasOne("Lumina.Application.Common.DataAccess.Entities.UsersManagement.UserEntity", "User")
|
||||
.WithMany("Libraries")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.OwnsMany("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.Management.LibraryContentLocationEntity", "ContentLocations", b1 =>
|
||||
{
|
||||
b1.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b1.Property<Guid>("LibraryId")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b1.Property<string>("Path")
|
||||
.IsRequired()
|
||||
.HasMaxLength(260)
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnName("Path");
|
||||
|
||||
b1.HasKey("Id");
|
||||
|
||||
b1.HasIndex("LibraryId");
|
||||
|
||||
b1.ToTable("LibraryContentLocations", (string)null);
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("LibraryId");
|
||||
});
|
||||
|
||||
b.Navigation("ContentLocations");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.WrittenContentLibrary.BookLibrary.BookEntity", b =>
|
||||
{
|
||||
b.OwnsMany("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.WrittenContentLibrary.BookLibrary.BookRatingEntity", "Ratings", b1 =>
|
||||
{
|
||||
b1.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b1.Property<Guid>("BookId")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b1.Property<decimal>("MaxValue")
|
||||
.HasColumnType("decimal(3,2)");
|
||||
|
||||
b1.Property<string>("Source")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b1.Property<decimal>("Value")
|
||||
.HasColumnType("decimal(3,2)");
|
||||
|
||||
b1.Property<int?>("VoteCount")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b1.HasKey("Id");
|
||||
|
||||
b1.HasIndex("BookId");
|
||||
|
||||
b1.ToTable("BookRatings", (string)null);
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("BookId");
|
||||
});
|
||||
|
||||
b.OwnsMany("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.WrittenContentLibrary.BookLibrary.IsbnEntity", "ISBNs", b1 =>
|
||||
{
|
||||
b1.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b1.Property<Guid>("BookId")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b1.Property<string>("Format")
|
||||
.IsRequired()
|
||||
.HasMaxLength(6)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b1.Property<string>("Value")
|
||||
.IsRequired()
|
||||
.HasMaxLength(13)
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnName("ISBN");
|
||||
|
||||
b1.HasKey("Id");
|
||||
|
||||
b1.HasIndex("BookId");
|
||||
|
||||
b1.ToTable("BookISBNs", (string)null);
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("BookId");
|
||||
});
|
||||
|
||||
b.Navigation("ISBNs");
|
||||
|
||||
b.Navigation("Ratings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.Authorization.PermissionEntity", b =>
|
||||
{
|
||||
b.Navigation("RolePermissions");
|
||||
|
||||
b.Navigation("UserPermissions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.Authorization.RoleEntity", b =>
|
||||
{
|
||||
b.Navigation("RolePermissions");
|
||||
|
||||
b.Navigation("UserRoles");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.UsersManagement.UserEntity", b =>
|
||||
{
|
||||
b.Navigation("Libraries");
|
||||
|
||||
b.Navigation("UserPermissions");
|
||||
|
||||
b.Navigation("UserRole")
|
||||
.IsRequired();
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Lumina.DataAccess.Common.Migrations;
|
||||
|
||||
/// <inheritdoc />
|
||||
public partial class ChangesUserRolesToUserRole : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropPrimaryKey(
|
||||
name: "PK_UserRoles",
|
||||
table: "UserRoles");
|
||||
|
||||
migrationBuilder.AddPrimaryKey(
|
||||
name: "PK_UserRoles",
|
||||
table: "UserRoles",
|
||||
column: "UserId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropPrimaryKey(
|
||||
name: "PK_UserRoles",
|
||||
table: "UserRoles");
|
||||
|
||||
migrationBuilder.AddPrimaryKey(
|
||||
name: "PK_UserRoles",
|
||||
table: "UserRoles",
|
||||
columns: new[] { "UserId", "RoleId" });
|
||||
}
|
||||
}
|
||||
@@ -188,9 +188,6 @@ namespace Lumina.DataAccess.Common.Migrations
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<Guid>("RoleId")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<Guid>("CreatedBy")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(2);
|
||||
@@ -199,6 +196,9 @@ namespace Lumina.DataAccess.Common.Migrations
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(1);
|
||||
|
||||
b.Property<Guid>("RoleId")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<Guid?>("UpdatedBy")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(4);
|
||||
@@ -207,7 +207,7 @@ namespace Lumina.DataAccess.Common.Migrations
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(3);
|
||||
|
||||
b.HasKey("UserId", "RoleId");
|
||||
b.HasKey("UserId");
|
||||
|
||||
b.HasIndex("RoleId");
|
||||
|
||||
@@ -548,8 +548,8 @@ namespace Lumina.DataAccess.Common.Migrations
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Lumina.Application.Common.DataAccess.Entities.UsersManagement.UserEntity", "User")
|
||||
.WithMany("UserRoles")
|
||||
.HasForeignKey("UserId")
|
||||
.WithOne("UserRole")
|
||||
.HasForeignKey("Lumina.Application.Common.DataAccess.Entities.Authorization.UserRoleEntity", "UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
@@ -686,7 +686,8 @@ namespace Lumina.DataAccess.Common.Migrations
|
||||
|
||||
b.Navigation("UserPermissions");
|
||||
|
||||
b.Navigation("UserRoles");
|
||||
b.Navigation("UserRole")
|
||||
.IsRequired();
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using Lumina.Application.Common.DataAccess.Entities.Authorization;
|
||||
using Lumina.Application.Common.DataAccess.Entities.UsersManagement;
|
||||
using Lumina.Application.Common.DataAccess.Repositories.Users;
|
||||
using Lumina.DataAccess.Core.UoW;
|
||||
@@ -7,6 +8,7 @@ using Lumina.Domain.Common.Errors;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
#endregion
|
||||
@@ -65,13 +67,11 @@ internal sealed class UserRepository : IUserRepository
|
||||
{
|
||||
return await _luminaDbContext.Users
|
||||
.Include(user => user.Libraries)
|
||||
.ThenInclude(library => library.ContentLocations)
|
||||
.ThenInclude(library => library.ContentLocations)
|
||||
.Include(user => user.UserPermissions)
|
||||
.ThenInclude(userPermission => userPermission.Permission)
|
||||
.Include(user => user.UserRoles)
|
||||
.ThenInclude(userRole => userRole.Role)
|
||||
.ThenInclude(role => role.RolePermissions)
|
||||
.ThenInclude(rolePermission => rolePermission.Permission)
|
||||
.ThenInclude(userPermission => userPermission.Permission)
|
||||
.Include(user => user.UserRole!.Role.RolePermissions)
|
||||
.ThenInclude(rolePermission => rolePermission.Permission)
|
||||
.FirstOrDefaultAsync(user => user.Username == username, cancellationToken)
|
||||
.ConfigureAwait(false);
|
||||
}
|
||||
@@ -86,21 +86,52 @@ internal sealed class UserRepository : IUserRepository
|
||||
{
|
||||
UserEntity? foundUser = await _luminaDbContext.Users
|
||||
.Include(user => user.Libraries)
|
||||
.ThenInclude(library => library.ContentLocations)
|
||||
.ThenInclude(library => library.ContentLocations)
|
||||
.Include(user => user.UserPermissions)
|
||||
.ThenInclude(userPermission => userPermission.Permission)
|
||||
.Include(user => user.UserRoles)
|
||||
.ThenInclude(userRole => userRole.Role)
|
||||
.ThenInclude(role => role.RolePermissions)
|
||||
.ThenInclude(rolePermission => rolePermission.Permission)
|
||||
.ThenInclude(userPermission => userPermission.Permission)
|
||||
.Include(user => user.UserRole!.Role.RolePermissions)
|
||||
.ThenInclude(rolePermission => rolePermission.Permission)
|
||||
.FirstOrDefaultAsync(user => user.Username == data.Username, cancellationToken)
|
||||
.ConfigureAwait(false);
|
||||
if (foundUser is null)
|
||||
return Errors.Users.UserDoesNotExist;
|
||||
|
||||
// update scalar properties
|
||||
_luminaDbContext.Entry(foundUser).CurrentValues.SetValues(data);
|
||||
|
||||
// update user permissions
|
||||
List<UserPermissionEntity> existingPermissions = [.. foundUser.UserPermissions];
|
||||
foreach (UserPermissionEntity permission in existingPermissions)
|
||||
_luminaDbContext.UserPermissions.Remove(permission);
|
||||
|
||||
foreach (UserPermissionEntity permission in data.UserPermissions)
|
||||
{
|
||||
_luminaDbContext.UserPermissions.Add(new UserPermissionEntity
|
||||
{
|
||||
UserId = foundUser.Id,
|
||||
PermissionId = permission.PermissionId,
|
||||
Permission = permission.Permission,
|
||||
User = foundUser
|
||||
});
|
||||
}
|
||||
|
||||
// update user role
|
||||
if (foundUser.UserRole != null)
|
||||
_luminaDbContext.UserRoles.Remove(foundUser.UserRole);
|
||||
if (data.UserRole is not null)
|
||||
{
|
||||
_luminaDbContext.UserRoles.Add(new UserRoleEntity
|
||||
{
|
||||
UserId = foundUser.Id,
|
||||
RoleId = data.UserRole.RoleId,
|
||||
Role = data.UserRole.Role,
|
||||
User = foundUser
|
||||
});
|
||||
}
|
||||
return Result.Updated;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="UserEntity"/> identified by <paramref name="id"/> from the storage medium.
|
||||
/// </summary>
|
||||
@@ -111,13 +142,11 @@ internal sealed class UserRepository : IUserRepository
|
||||
{
|
||||
return await _luminaDbContext.Users
|
||||
.Include(user => user.Libraries)
|
||||
.ThenInclude(library => library.ContentLocations)
|
||||
.ThenInclude(library => library.ContentLocations)
|
||||
.Include(user => user.UserPermissions)
|
||||
.ThenInclude(userPermission => userPermission.Permission)
|
||||
.Include(user => user.UserRoles)
|
||||
.ThenInclude(userRole => userRole.Role)
|
||||
.ThenInclude(role => role.RolePermissions)
|
||||
.ThenInclude(rolePermission => rolePermission.Permission)
|
||||
.ThenInclude(userPermission => userPermission.Permission)
|
||||
.Include(user => user.UserRole!.Role.RolePermissions)
|
||||
.ThenInclude(rolePermission => rolePermission.Permission)
|
||||
.FirstOrDefaultAsync(user => user.Id == id, cancellationToken)
|
||||
.ConfigureAwait(false);
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@ public static partial class Errors
|
||||
public static class Library
|
||||
{
|
||||
public static Error LibraryIdCannotBeEmpty => Error.Forbidden(description: nameof(LibraryIdCannotBeEmpty));
|
||||
public static Error UserIdCannotBeEmpty => Error.Forbidden(description: nameof(UserIdCannotBeEmpty));
|
||||
public static Error LibraryAlreadyExists => Error.Conflict(description: nameof(LibraryAlreadyExists));
|
||||
public static Error LibraryNotFound => Error.NotFound(description: nameof(LibraryNotFound));
|
||||
public static Error LibraryTypeCannotBeNull => Error.Validation(description: nameof(LibraryTypeCannotBeNull));
|
||||
|
||||
@@ -55,9 +55,8 @@ public class AuthorizationService : IAuthorizationService
|
||||
return true;
|
||||
|
||||
// check if any of the user's roles grant the permission
|
||||
return getUserResult.Value.UserRoles
|
||||
.SelectMany(userRole => userRole.Role.RolePermissions)
|
||||
.Any(rolePermission => rolePermission.Permission.PermissionName == permission);
|
||||
return getUserResult.Value.UserRole?.Role.RolePermissions
|
||||
.Any(rolePermission => rolePermission.Permission.PermissionName == permission) == true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -72,7 +71,7 @@ public class AuthorizationService : IAuthorizationService
|
||||
ErrorOr<UserEntity?> getUserResult = await _userRepository.GetByIdAsync(userId, cancellationToken).ConfigureAwait(false);
|
||||
if (getUserResult.IsError || getUserResult.Value is null)
|
||||
return false;
|
||||
return getUserResult.Value.UserRoles.Any(userRole => userRole.Role.RoleName == role);
|
||||
return getUserResult.Value.UserRole?.Role.RoleName == role;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -106,9 +105,7 @@ public class AuthorizationService : IAuthorizationService
|
||||
return Errors.Users.UserDoesNotExist;
|
||||
|
||||
// get all roles
|
||||
HashSet<string> roles = getUserResult.Value.UserRoles
|
||||
.Select(userRole => userRole.Role.RoleName)
|
||||
.ToHashSet();
|
||||
string? role = getUserResult.Value.UserRole?.Role.RoleName;
|
||||
|
||||
// get direct user permissions
|
||||
HashSet<AuthorizationPermission> directPermissions = getUserResult.Value.UserPermissions
|
||||
@@ -116,20 +113,17 @@ public class AuthorizationService : IAuthorizationService
|
||||
.ToHashSet();
|
||||
|
||||
// get permissions from roles
|
||||
HashSet<AuthorizationPermission> rolePermissions = getUserResult.Value.UserRoles
|
||||
.SelectMany(userRole => userRole.Role.RolePermissions)
|
||||
HashSet<AuthorizationPermission>? rolePermissions = getUserResult.Value.UserRole?.Role.RolePermissions
|
||||
.Select(rolePermission => rolePermission.Permission.PermissionName)
|
||||
.ToHashSet();
|
||||
|
||||
// combine all permissions
|
||||
HashSet<AuthorizationPermission> allPermissions = directPermissions
|
||||
.Union(rolePermissions)
|
||||
.ToHashSet();
|
||||
HashSet<AuthorizationPermission> allPermissions = rolePermissions is not null ? directPermissions.Union(rolePermissions).ToHashSet() : directPermissions;
|
||||
|
||||
return new UserAuthorizationEntity
|
||||
{
|
||||
UserId = userId,
|
||||
Roles = roles,
|
||||
Role = role,
|
||||
Permissions = allPermissions
|
||||
};
|
||||
}
|
||||
|
||||
@@ -10,6 +10,9 @@ public static partial class ApiRoutes
|
||||
/// </summary>
|
||||
public static class Authorization
|
||||
{
|
||||
public const string UPDATE_USER_ROLE_AND_PERMISSIONS_BY_USER_ID = "/auth/users/{userId}/role-and-permissions";
|
||||
public const string GET_USER_PERMISSIONS_BY_USER_ID = "/auth/users/{userId}/permissions";
|
||||
public const string GET_USER_ROLE_BY_USER_ID = "/auth/users/{userId}/role";
|
||||
public const string GET_AUTHORIZATION = "/auth/get-authorization";
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -36,7 +36,7 @@ public class UpdateRoleEndpointSummary : Summary<UpdateRoleEndpoint, UpdateRoleR
|
||||
|
||||
RequestParam(r => r.RoleId, "The Id of the role. Required.");
|
||||
RequestParam(r => r.RoleName, "The name of the role. Required.");
|
||||
RequestParam(r => r.Permissions, "The collection or permissions of the role. Required.");
|
||||
RequestParam(r => r.Permissions, "The collection of Ids of the permissions of the role. Required.");
|
||||
|
||||
ResponseParam<RolePermissionsResponse>(r => r.Role, "The authorization role entity.");
|
||||
ResponseParam<RolePermissionsResponse>(r => r.Permissions, "The list of permissions of the role entity.");
|
||||
|
||||
+3
-3
@@ -22,7 +22,7 @@ public class GetAuthorizationEndpointSummary : Summary<GetAuthorizationEndpoint,
|
||||
public GetAuthorizationEndpointSummary()
|
||||
{
|
||||
Summary = "Gets the authorization details of an account.";
|
||||
Description = "Gets the authorization roles and permissions of an account.";
|
||||
Description = "Gets the authorization role and permissions of an account.";
|
||||
|
||||
ExampleRequest = new GetAuthorizationRequest(
|
||||
UserId: Guid.NewGuid()
|
||||
@@ -30,10 +30,10 @@ public class GetAuthorizationEndpointSummary : Summary<GetAuthorizationEndpoint,
|
||||
|
||||
RequestParam(r => r.UserId, "The Id of the user for whom to get the authorization. Required.");
|
||||
|
||||
Response(200, "The authorization roles and permissions of the account are returned.",
|
||||
Response(200, "The authorization role and permissions of the account are returned.",
|
||||
example: new AuthorizationResponse(
|
||||
UserId: Guid.NewGuid(),
|
||||
Roles: new HashSet<string>() { "Admin" },
|
||||
Role: "Admin",
|
||||
Permissions: new HashSet<AuthorizationPermission>() { AuthorizationPermission.CanRegisterUsers, AuthorizationPermission.CanDeleteUsers }
|
||||
));
|
||||
|
||||
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using FastEndpoints;
|
||||
using Lumina.Application.Common.Mapping.Authentication;
|
||||
using Lumina.Application.Common.Mapping.Authorization;
|
||||
using Lumina.Contracts.Requests.Authorization;
|
||||
using Lumina.Contracts.Responses.Authorization;
|
||||
using Lumina.Presentation.Api.Common.Routes.UsersManagement;
|
||||
using Lumina.Presentation.Api.Core.Endpoints.Common;
|
||||
using Mediator;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Api.Core.Endpoints.UsersManagement.Authorization.GetUserPermissions;
|
||||
|
||||
/// <summary>
|
||||
/// API endpoint for the <c>/auth/users/{userId}/permissions</c> route.
|
||||
/// </summary>
|
||||
public class GetUserPermissionsEndpoint : BaseEndpoint<GetUserPermissionsRequest, IResult>
|
||||
{
|
||||
private readonly ISender _sender;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GetUserPermissionsEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="sender">Injected service for mediating commands and queries.</param>
|
||||
public GetUserPermissionsEndpoint(ISender sender)
|
||||
{
|
||||
_sender = sender;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Configures the API endpoint.
|
||||
/// </summary>
|
||||
public override void Configure()
|
||||
{
|
||||
Verbs(Http.GET);
|
||||
Routes(ApiRoutes.Authorization.GET_USER_PERMISSIONS_BY_USER_ID);
|
||||
Version(1);
|
||||
DontCatchExceptions();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the authorization permissions of a user.
|
||||
/// </summary>
|
||||
/// <param name="request">The request containing the user for whom to get the authorization permissions.</param>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
public override async Task<IResult> ExecuteAsync(GetUserPermissionsRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
ErrorOr<IEnumerable<PermissionResponse>> result = await _sender.Send(request.ToQuery(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.Ok(success), Problem);
|
||||
}
|
||||
}
|
||||
+115
@@ -0,0 +1,115 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using FastEndpoints;
|
||||
using Lumina.Contracts.Requests.Authorization;
|
||||
using Lumina.Contracts.Responses.Authorization;
|
||||
using Lumina.Domain.Common.Enums.Authorization;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Api.Core.Endpoints.UsersManagement.Authorization.GetUserPermissions;
|
||||
|
||||
/// <summary>
|
||||
/// Class used for providing a textual description for the <see cref="GetUserPermissionsEndpoint"/> API endpoint, for OpenAPI.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetUserPermissionsEndpointSummary : Summary<GetUserPermissionsEndpoint, GetUserPermissionsRequest>
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GetUserPermissionsEndpointSummary"/> class.
|
||||
/// </summary>
|
||||
public GetUserPermissionsEndpointSummary()
|
||||
{
|
||||
Summary = "Gets the authorization permissions of a user.";
|
||||
Description = "Gets the authorization ropermissionsle of a user.";
|
||||
|
||||
ExampleRequest = new GetUserPermissionsRequest(
|
||||
UserId: Guid.NewGuid()
|
||||
);
|
||||
|
||||
RequestParam(r => r.UserId, "The Id of the user for whom to get the authorization permissions. Required.");
|
||||
|
||||
Response(200, "The authorization permissions of the user are returned.",
|
||||
example: new[] {
|
||||
new PermissionResponse(Id: Guid.NewGuid(), AuthorizationPermission.CanViewUsers),
|
||||
new PermissionResponse(Id: Guid.NewGuid(), AuthorizationPermission.CanDeleteUsers),
|
||||
new PermissionResponse(Id: Guid.NewGuid(), AuthorizationPermission.CanRegisterUsers)
|
||||
});
|
||||
|
||||
Response(401, "Authentication required.", "application/problem+json",
|
||||
example: new[]
|
||||
{
|
||||
new
|
||||
{
|
||||
type = "https://tools.ietf.org/html/rfc7235#section-3.1",
|
||||
status = 401,
|
||||
title = "Unauthorized",
|
||||
detail = "You are not authorized",
|
||||
instance = "/auth/users/{userId}/permissions"
|
||||
},
|
||||
new
|
||||
{
|
||||
type = "https://tools.ietf.org/html/rfc7235#section-3.1",
|
||||
status = 401,
|
||||
title = "Unauthorized",
|
||||
detail = "Invalid token: The token expired at '01/01/2024 01:00:00'",
|
||||
instance = "/auth/users/{userId}/permissions"
|
||||
},
|
||||
new
|
||||
{
|
||||
type = "https://tools.ietf.org/html/rfc7235#section-3.1",
|
||||
status = 401,
|
||||
title = "Unauthorized",
|
||||
detail = "The token is invalid",
|
||||
instance = "/auth/users/{userId}/permissions"
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
Response(403, "The request failed because the current user is not an Admin.", "application/problem+json",
|
||||
example: new
|
||||
{
|
||||
type = "https://tools.ietf.org/html/rfc9110#section-15.5.4",
|
||||
title = "General.Failure",
|
||||
status = 403,
|
||||
detail = "NotAuthorized",
|
||||
instance = "/auth/users/{userId}/permissions",
|
||||
traceId = "00-a712bbf99ca8ab485f86a762ae5ae74d-b3a2eb78813b0a5d-00"
|
||||
}
|
||||
);
|
||||
|
||||
Response(404, "The request failed because the provided user does not exist.", "application/problem+json",
|
||||
example: new
|
||||
{
|
||||
type = "https://tools.ietf.org/html/rfc9110#section-15.5.5",
|
||||
title = "General.NotFound",
|
||||
status = 404,
|
||||
detail = "UsernameDoesNotExist",
|
||||
instance = "/auth/users/{userId}/permissions",
|
||||
traceId = "00-57d15dadd702dbd4aeb5dc9b7cee68ee-9330237dbb2ce0e5-00"
|
||||
}
|
||||
);
|
||||
|
||||
Response(422, "The request did not pass validation checks.", "application/problem+json",
|
||||
example: new
|
||||
{
|
||||
type = "https://tools.ietf.org/html/rfc4918#section-11.2",
|
||||
title = "General.Validation",
|
||||
status = 422,
|
||||
detail = "OneOrMoreValidationErrorsOccurred",
|
||||
instance = "/auth/users/{userId}/permissions",
|
||||
errors = new Dictionary<string, string[]>
|
||||
{
|
||||
{
|
||||
"General.Validation", new[]
|
||||
{
|
||||
"UserIdCannotBeEmpty"
|
||||
}
|
||||
}
|
||||
},
|
||||
traceId = "00-839f81e411d7eb91ed5aa91e56b00bbb-7c8bd5dfabdaf2dc-00"
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using FastEndpoints;
|
||||
using Lumina.Application.Common.Mapping.Authentication;
|
||||
using Lumina.Application.Common.Mapping.Authorization;
|
||||
using Lumina.Contracts.Requests.Authorization;
|
||||
using Lumina.Contracts.Responses.Authorization;
|
||||
using Lumina.Presentation.Api.Common.Routes.UsersManagement;
|
||||
using Lumina.Presentation.Api.Core.Endpoints.Common;
|
||||
using Mediator;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Api.Core.Endpoints.UsersManagement.Authorization.GetUserRole;
|
||||
|
||||
/// <summary>
|
||||
/// API endpoint for the <c>/auth/users/{userId}/role</c> route.
|
||||
/// </summary>
|
||||
public class GetUserRoleEndpoint : BaseEndpoint<GetUserRoleRequest, IResult>
|
||||
{
|
||||
private readonly ISender _sender;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GetUserRoleEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="sender">Injected service for mediating commands and queries.</param>
|
||||
public GetUserRoleEndpoint(ISender sender)
|
||||
{
|
||||
_sender = sender;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Configures the API endpoint.
|
||||
/// </summary>
|
||||
public override void Configure()
|
||||
{
|
||||
Verbs(Http.GET);
|
||||
Routes(ApiRoutes.Authorization.GET_USER_ROLE_BY_USER_ID);
|
||||
Version(1);
|
||||
DontCatchExceptions();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the authorization role of a user.
|
||||
/// </summary>
|
||||
/// <param name="request">The request containing the user for whom to get the authorization role.</param>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
public override async Task<IResult> ExecuteAsync(GetUserRoleRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
ErrorOr<RoleResponse?> result = await _sender.Send(request.ToQuery(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.Ok(success), Problem);
|
||||
}
|
||||
}
|
||||
+114
@@ -0,0 +1,114 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using FastEndpoints;
|
||||
using Lumina.Contracts.Requests.Authorization;
|
||||
using Lumina.Contracts.Responses.Authorization;
|
||||
using Lumina.Domain.Common.Enums.Authorization;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Api.Core.Endpoints.UsersManagement.Authorization.GetUserRole;
|
||||
|
||||
/// <summary>
|
||||
/// Class used for providing a textual description for the <see cref="GetUserRoleEndpoint"/> API endpoint, for OpenAPI.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetUserRoleEndpointSummary : Summary<GetUserRoleEndpoint, GetUserRoleRequest>
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GetUserRoleEndpointSummary"/> class.
|
||||
/// </summary>
|
||||
public GetUserRoleEndpointSummary()
|
||||
{
|
||||
Summary = "Gets the authorization role of a user.";
|
||||
Description = "Gets the authorization role of a user.";
|
||||
|
||||
ExampleRequest = new GetUserRoleRequest(
|
||||
UserId: Guid.NewGuid()
|
||||
);
|
||||
|
||||
RequestParam(r => r.UserId, "The Id of the user for whom to get the authorization role. Required.");
|
||||
|
||||
Response(200, "The authorization role of the user is returned.",
|
||||
example: new RoleResponse(
|
||||
Id: Guid.NewGuid(),
|
||||
RoleName: "Admin"
|
||||
));
|
||||
|
||||
Response(401, "Authentication required.", "application/problem+json",
|
||||
example: new[]
|
||||
{
|
||||
new
|
||||
{
|
||||
type = "https://tools.ietf.org/html/rfc7235#section-3.1",
|
||||
status = 401,
|
||||
title = "Unauthorized",
|
||||
detail = "You are not authorized",
|
||||
instance = "/api/v1/auth/users/{userId}/role"
|
||||
},
|
||||
new
|
||||
{
|
||||
type = "https://tools.ietf.org/html/rfc7235#section-3.1",
|
||||
status = 401,
|
||||
title = "Unauthorized",
|
||||
detail = "Invalid token: The token expired at '01/01/2024 01:00:00'",
|
||||
instance = "/api/v1/auth/users/{userId}/role"
|
||||
},
|
||||
new
|
||||
{
|
||||
type = "https://tools.ietf.org/html/rfc7235#section-3.1",
|
||||
status = 401,
|
||||
title = "Unauthorized",
|
||||
detail = "The token is invalid",
|
||||
instance = "/api/v1/auth/users/{userId}/role"
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
Response(403, "The request failed because the current user is not an Admin.", "application/problem+json",
|
||||
example: new
|
||||
{
|
||||
type = "https://tools.ietf.org/html/rfc9110#section-15.5.4",
|
||||
title = "General.Failure",
|
||||
status = 403,
|
||||
detail = "NotAuthorized",
|
||||
instance = "/api/v1/auth/users/{userId}/role",
|
||||
traceId = "00-a712bbf99ca8ab485f86a762ae5ae74d-b3a2eb78813b0a5d-00"
|
||||
}
|
||||
);
|
||||
|
||||
Response(404, "The request failed because the provided user does not exist.", "application/problem+json",
|
||||
example: new
|
||||
{
|
||||
type = "https://tools.ietf.org/html/rfc9110#section-15.5.5",
|
||||
title = "General.NotFound",
|
||||
status = 404,
|
||||
detail = "UsernameDoesNotExist",
|
||||
instance = "/api/v1/auth/users/{userId}/role",
|
||||
traceId = "00-57d15dadd702dbd4aeb5dc9b7cee68ee-9330237dbb2ce0e5-00"
|
||||
}
|
||||
);
|
||||
|
||||
Response(422, "The request did not pass validation checks.", "application/problem+json",
|
||||
example: new
|
||||
{
|
||||
type = "https://tools.ietf.org/html/rfc4918#section-11.2",
|
||||
title = "General.Validation",
|
||||
status = 422,
|
||||
detail = "OneOrMoreValidationErrorsOccurred",
|
||||
instance = "/api/v1/auth/users/{userId}/role",
|
||||
errors = new Dictionary<string, string[]>
|
||||
{
|
||||
{
|
||||
"General.Validation", new[]
|
||||
{
|
||||
"UserIdCannotBeEmpty"
|
||||
}
|
||||
}
|
||||
},
|
||||
traceId = "00-839f81e411d7eb91ed5aa91e56b00bbb-7c8bd5dfabdaf2dc-00"
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using FastEndpoints;
|
||||
using Lumina.Application.Common.Mapping.Authorization;
|
||||
using Lumina.Contracts.Requests.Authorization;
|
||||
using Lumina.Contracts.Responses.Authorization;
|
||||
using Lumina.Presentation.Api.Common.Routes.UsersManagement;
|
||||
using Lumina.Presentation.Api.Core.Endpoints.Common;
|
||||
using Mediator;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Api.Core.Endpoints.UsersManagement.Authorization.UpdateUserRoleAndPermissions;
|
||||
|
||||
/// <summary>
|
||||
/// API endpoint for the <c>/auth/users/{userId}/role-and-permissions</c> route.
|
||||
/// </summary>
|
||||
public class UpdateUserRoleAndPermissionsEndpoint : BaseEndpoint<UpdateUserRoleAndPermissionsRequest, IResult>
|
||||
{
|
||||
private readonly ISender _sender;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UpdateUserRoleAndPermissionsEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="sender">Injected service for mediating commands and queries.</param>
|
||||
public UpdateUserRoleAndPermissionsEndpoint(ISender sender)
|
||||
{
|
||||
_sender = sender;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Configures the API endpoint.
|
||||
/// </summary>
|
||||
public override void Configure()
|
||||
{
|
||||
Verbs(Http.PUT);
|
||||
Routes(ApiRoutes.Authorization.UPDATE_USER_ROLE_AND_PERMISSIONS_BY_USER_ID);
|
||||
Version(1);
|
||||
DontCatchExceptions();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates an the authorization role and permissions of a user.
|
||||
/// </summary>
|
||||
/// <param name="request">The request containing the authorization role and permission of the user to be updated.</param>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
public override async Task<IResult> ExecuteAsync(UpdateUserRoleAndPermissionsRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
ErrorOr<AuthorizationResponse> result = await _sender.Send(request.ToCommand(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.Ok(success), Problem);
|
||||
}
|
||||
}
|
||||
+130
@@ -0,0 +1,130 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using FastEndpoints;
|
||||
using Lumina.Contracts.DTO.Authentication;
|
||||
using Lumina.Contracts.Requests.Authorization;
|
||||
using Lumina.Contracts.Responses.Authorization;
|
||||
using Lumina.Domain.Common.Enums.Authorization;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Api.Core.Endpoints.UsersManagement.Authorization.UpdateUserRoleAndPermissions;
|
||||
|
||||
/// <summary>
|
||||
/// Class used for providing a textual description for the <see cref="UpdateUserRoleAndPermissionsEndpoint"/> API endpoint, for OpenAPI.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class UpdateUserRoleAndPermissionsEndpointSummary : Summary<UpdateUserRoleAndPermissionsEndpoint, UpdateUserRoleAndPermissionsRequest>
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UpdateUserRoleAndPermissionsEndpointSummary"/> class.
|
||||
/// </summary>
|
||||
public UpdateUserRoleAndPermissionsEndpointSummary()
|
||||
{
|
||||
Summary = "Updates the authorization role and permissions of a user.";
|
||||
Description = "Updates the authorization role and permissions of a user, and returns the details.";
|
||||
|
||||
ExampleRequest = new UpdateUserRoleAndPermissionsRequest(
|
||||
UserId: Guid.NewGuid(),
|
||||
RoleId: Guid.NewGuid(),
|
||||
Permissions: [
|
||||
Guid.NewGuid(),
|
||||
Guid.NewGuid(),
|
||||
]
|
||||
);
|
||||
|
||||
RequestParam(r => r.UserId, "The Id of the user. Required.");
|
||||
RequestParam(r => r.RoleId, "The Id of the role. Required.");
|
||||
RequestParam(r => r.Permissions, "The collection of Ids of the permissions of the role. Required.");
|
||||
|
||||
ResponseParam<AuthorizationResponse>(r => r.UserId, "The id of the user whose role and permissions were updated.");
|
||||
ResponseParam<AuthorizationResponse>(r => r.Role, "The authorization role entity.");
|
||||
ResponseParam<AuthorizationResponse>(r => r.Permissions, "The list of permissions of the user.");
|
||||
|
||||
|
||||
Response(200, "The authorization role and permissions of the user were successfully updated.", example:
|
||||
new AuthorizationResponse(
|
||||
UserId: Guid.NewGuid(),
|
||||
Role: "Editor",
|
||||
Permissions: new HashSet<AuthorizationPermission>() { AuthorizationPermission.CanRegisterUsers, AuthorizationPermission.CanDeleteUsers }
|
||||
));
|
||||
|
||||
Response(401, "Authentication required.", "application/problem+json",
|
||||
example: new[]
|
||||
{
|
||||
new
|
||||
{
|
||||
type = "https://tools.ietf.org/html/rfc7235#section-3.1",
|
||||
status = 401,
|
||||
title = "Unauthorized",
|
||||
detail = "You are not authorized",
|
||||
instance = "/api/v1/auth/users/{userId}/role-and-permissions"
|
||||
},
|
||||
new
|
||||
{
|
||||
type = "https://tools.ietf.org/html/rfc7235#section-3.1",
|
||||
status = 401,
|
||||
title = "Unauthorized",
|
||||
detail = "Invalid token: The token expired at '01/01/2024 01:00:00'",
|
||||
instance = "/api/v1/auth/users/{userId}/role-and-permissions"
|
||||
},
|
||||
new
|
||||
{
|
||||
type = "https://tools.ietf.org/html/rfc7235#section-3.1",
|
||||
status = 401,
|
||||
title = "Unauthorized",
|
||||
detail = "The token is invalid",
|
||||
instance = "/api/v1/auth/users/{userId}/role-and-permissions"
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
Response(403, "The request failed because the current user is not an Admin, or changing the user's role would result in no user with an Admin account.", "application/problem+json",
|
||||
example: new
|
||||
{
|
||||
type = "https://tools.ietf.org/html/rfc9110#section-15.5.4",
|
||||
title = "General.Failure",
|
||||
status = 403,
|
||||
detail = "NotAuthorized | CannotRemoveLastAdmin | UserMustHaveRoleOrDirectPermissions",
|
||||
instance = "/api/v1/auth/users/{userId}/role-and-permissions",
|
||||
traceId = "00-a712bbf99ca8ab485f86a762ae5ae74d-b3a2eb78813b0a5d-00"
|
||||
}
|
||||
);
|
||||
|
||||
Response(404, "The request failed because the provided role or user do not exist.", "application/problem+json",
|
||||
example: new
|
||||
{
|
||||
type = "https://tools.ietf.org/html/rfc9110#section-15.5.5",
|
||||
title = "General.NotFound",
|
||||
status = 404,
|
||||
detail = "RoleNotFound | UserDoesNotExist",
|
||||
instance = "/api/v1/auth/users/{userId}/role-and-permissions",
|
||||
traceId = "00-57d15dadd702dbd4aeb5dc9b7cee68ee-9330237dbb2ce0e5-00"
|
||||
}
|
||||
);
|
||||
|
||||
Response(422, "The request did not pass validation checks.", "application/problem+json",
|
||||
example: new
|
||||
{
|
||||
type = "https://tools.ietf.org/html/rfc4918#section-11.2",
|
||||
title = "General.Validation",
|
||||
status = 422,
|
||||
detail = "OneOrMoreValidationErrorsOccurred",
|
||||
instance = "/api/v1/auth/users/{userId}/role-and-permissions",
|
||||
errors = new Dictionary<string, string[]>
|
||||
{
|
||||
{
|
||||
"General.Validation", new[]
|
||||
{
|
||||
"UserIdCannotBeEmpty",
|
||||
"RoleIdCannotBeEmpty",
|
||||
"PermissionIdCannotBeEmpty"
|
||||
}
|
||||
}
|
||||
},
|
||||
traceId = "00-2470be4248a2a5a0c6f70579975a6954-b9c3ba9544a03500-00"
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ using Microsoft.Extensions.Options;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Runtime.CompilerServices;
|
||||
@@ -206,7 +207,12 @@ public class ApiHttpClient : IApiHttpClient
|
||||
string content = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
|
||||
// if the response is successful, deserialize the content to TResponse and return it
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
// handle empty content case
|
||||
if (string.IsNullOrEmpty(content))
|
||||
return default!;
|
||||
return JsonSerializer.Deserialize<TResponse>(content, _jsonOptions)!;
|
||||
}
|
||||
else
|
||||
{
|
||||
ProblemDetailsModel? problemDetails = null;
|
||||
|
||||
@@ -52,7 +52,7 @@ public class AuthorizationService : IAuthorizationService
|
||||
public async Task<bool> IsInRoleAsync(string role, CancellationToken cancellationToken)
|
||||
{
|
||||
GetAuthorizationResponse authorization = await GetUserAuthorizationAsync(cancellationToken).ConfigureAwait(false);
|
||||
return authorization.Roles.Contains(role);
|
||||
return authorization.Role == role;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -75,7 +75,7 @@ public class AuthorizationService : IAuthorizationService
|
||||
{
|
||||
GetAuthorizationResponse authorization = await GetUserAuthorizationAsync(CancellationToken.None);
|
||||
|
||||
if (requirement.Roles?.Length > 0 && !requirement.Roles.Any(role => authorization.Roles?.Contains(role) == true))
|
||||
if (requirement.Roles?.Length > 0 && !requirement.Roles.Any(role => authorization.Role?.Contains(role) == true))
|
||||
return false;
|
||||
|
||||
if (requirement.Permissions?.Length > 0 && !requirement.Permissions.Any(permission => authorization.Permissions.Contains(permission)))
|
||||
|
||||
+2
-2
@@ -10,11 +10,11 @@ namespace Lumina.Presentation.Web.Common.Models.Authorization;
|
||||
/// Represents the response model for an account authorization request.
|
||||
/// </summary>
|
||||
/// <param name="UserId">The Id of the user for whom the authorization is retrieved.</param>
|
||||
/// <param name="Roles">The collection of roles associated to the user.</param>
|
||||
/// <param name="Role">The role associated to the user.</param>
|
||||
/// <param name="Permissions">The collection of permissions associated to the user.</param>
|
||||
[DebuggerDisplay("UserId: {UserId}")]
|
||||
public record GetAuthorizationResponse(
|
||||
Guid UserId,
|
||||
string[] Roles,
|
||||
string? Role,
|
||||
AuthorizationPermission[] Permissions
|
||||
);
|
||||
@@ -1,15 +1,13 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Presentation.Web.Common.Enums.Authorization;
|
||||
using System;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Common.Models.Authorization;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a model for an authorization role.
|
||||
/// Represents a model for an authorization role with its permissions.
|
||||
/// </summary>
|
||||
/// <param name="Id">The Id of the authorization role.</param>
|
||||
/// <param name="Role">The authorization role.</param>
|
||||
/// <param name="Permissions">The permissions of the authorization role.</param>
|
||||
public record RolePermissionsModel(
|
||||
RoleModel Role,
|
||||
PermissionModel[] Permissions
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace Lumina.Presentation.Web.Common.Models.Authorization;
|
||||
/// </summary>
|
||||
/// <param name="RoleId">The Id of the role.</param>
|
||||
/// <param name="RoleName">The name of the role.</param>
|
||||
/// <param name="Permissions">The collection or permissions of the role.</param>
|
||||
/// <param name="Permissions">The collection of Ids of the permissions of the role.</param>
|
||||
public record UpdateRoleRequestModel(
|
||||
Guid RoleId,
|
||||
string? RoleName,
|
||||
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Common.Models.Authorization;
|
||||
|
||||
/// <summary>
|
||||
/// Represents the request model for updating the authorization role and permissions of a user.
|
||||
/// </summary>
|
||||
/// <param name="RoleId">The Id of the user.</param>
|
||||
/// <param name="RoleId">The Id of the role.</param>
|
||||
/// <param name="Permissions">The collection of Ids of the permissions of the user.</param>
|
||||
public record UpdateUserRoleAndPermissionsRequestModel(
|
||||
Guid UserId,
|
||||
Guid? RoleId,
|
||||
List<Guid>? Permissions
|
||||
);
|
||||
@@ -0,0 +1,15 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Presentation.Web.Common.Models.UsersManagement;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Common.Models.Authorization;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a model for a user with its authorization permissions.
|
||||
/// </summary>
|
||||
/// <param name="User">The user.</param>
|
||||
/// <param name="Permissions">The authorization permissions of the user.</param>
|
||||
public record UserPermissionsModel(
|
||||
UserModel User,
|
||||
PermissionModel[] Permissions
|
||||
);
|
||||
@@ -40,7 +40,7 @@ public class AdminController : Controller
|
||||
{
|
||||
// get the list of roles and permissions from the API
|
||||
ViewData["roles"] = await _apiHttpClient.GetAsync<RoleModel[]>($"roles/", cancellationToken).ConfigureAwait(false);
|
||||
ViewData["rolePermissions"] = await _apiHttpClient.GetAsync<PermissionModel[]>($"permissions/", cancellationToken).ConfigureAwait(false);
|
||||
ViewData["permissions"] = await _apiHttpClient.GetAsync<PermissionModel[]>($"permissions/", cancellationToken).ConfigureAwait(false);
|
||||
return View();
|
||||
}
|
||||
|
||||
@@ -53,6 +53,7 @@ public class AdminController : Controller
|
||||
{
|
||||
ViewData["users"] = await _apiHttpClient.GetAsync<UserModel[]>($"auth/users", cancellationToken).ConfigureAwait(false);
|
||||
ViewData["roles"] = await _apiHttpClient.GetAsync<RoleModel[]>($"roles/", cancellationToken).ConfigureAwait(false);
|
||||
ViewData["permissions"] = await _apiHttpClient.GetAsync<PermissionModel[]>($"permissions/", cancellationToken).ConfigureAwait(false);
|
||||
return View();
|
||||
}
|
||||
|
||||
@@ -68,6 +69,30 @@ public class AdminController : Controller
|
||||
return Json(new { success = true, data = response });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the authorization permissions of a user identified by <paramref name="userId"/>.
|
||||
/// </summary>
|
||||
/// <param name="userId">The Id of the user for whom to get the list of permissions.</param>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
[HttpGet("get-permissions-by-user-id/{userId}")]
|
||||
public async Task<IActionResult> GetPermissionsByUserId(Guid userId, CancellationToken cancellationToken)
|
||||
{
|
||||
PermissionModel[] response = await _apiHttpClient.GetAsync<PermissionModel[]>($"auth/users/{userId}/permissions", cancellationToken).ConfigureAwait(false);
|
||||
return Json(new { success = true, data = response });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the authorization role of a user identified by <paramref name="userId"/>.
|
||||
/// </summary>
|
||||
/// <param name="userId">The Id of the user for whom to get the role.</param>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
[HttpGet("get-role-by-user-id/{userId}")]
|
||||
public async Task<IActionResult> GetRoleByUserId(Guid userId, CancellationToken cancellationToken)
|
||||
{
|
||||
RoleModel? response = await _apiHttpClient.GetAsync<RoleModel?>($"auth/users/{userId}/role", cancellationToken).ConfigureAwait(false);
|
||||
return Json(new { success = true, data = response });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the collection of authorization roles.
|
||||
/// </summary>
|
||||
@@ -114,4 +139,16 @@ public class AdminController : Controller
|
||||
await _apiHttpClient.DeleteAsync($"roles/{roleId}", cancellationToken).ConfigureAwait(false);
|
||||
return Json(new { success = true });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates an authorization role with the specified name and associated permissions.
|
||||
/// </summary>
|
||||
/// <param name="model">The model containing the data of the role to be updated.</param>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
[HttpPut("update-user-authorization")]
|
||||
public async Task<IActionResult> UpdateUserAuthorization([FromBody] UpdateUserRoleAndPermissionsRequestModel model, CancellationToken cancellationToken)
|
||||
{
|
||||
GetAuthorizationResponse response = await _apiHttpClient.PutAsync<GetAuthorizationResponse, UpdateUserRoleAndPermissionsRequestModel>($"auth/users/{model.UserId}/role-and-permissions", model, cancellationToken).ConfigureAwait(false);
|
||||
return Json(new { success = true, data = response });
|
||||
}
|
||||
}
|
||||
+6
@@ -141,6 +141,9 @@
|
||||
<data name="CannotNavigateUp" xml:space="preserve">
|
||||
<value>Navigation nach oben nicht möglich!</value>
|
||||
</data>
|
||||
<data name="CannotRemoveLastAdmin" xml:space="preserve">
|
||||
<value>Der letzte zugewiesene Admin-Rolle kann nicht entfernt werden!</value>
|
||||
</data>
|
||||
<data name="CodecCannotBeEmpty" xml:space="preserve">
|
||||
<value>Codec darf nicht leer sein!</value>
|
||||
</data>
|
||||
@@ -516,6 +519,9 @@
|
||||
<data name="UserIdCannotBeEmpty" xml:space="preserve">
|
||||
<value>Benutzer-ID darf nicht leer sein!</value>
|
||||
</data>
|
||||
<data name="UserMustHaveRoleOrDirectPermissions" xml:space="preserve">
|
||||
<value>Benutzer muss entweder Rollen- oder direkte Berechtigungen haben!</value>
|
||||
</data>
|
||||
<data name="UsernameAlreadyExists" xml:space="preserve">
|
||||
<value>Benutzername existiert bereits!</value>
|
||||
</data>
|
||||
|
||||
+6
@@ -141,6 +141,9 @@
|
||||
<data name="CannotNavigateUp" xml:space="preserve">
|
||||
<value>Cannot navigate up!</value>
|
||||
</data>
|
||||
<data name="CannotRemoveLastAdmin" xml:space="preserve">
|
||||
<value>Cannot remove the last Admin role assigned to a user!</value>
|
||||
</data>
|
||||
<data name="CodecCannotBeEmpty" xml:space="preserve">
|
||||
<value>Codec cannot be empty!</value>
|
||||
</data>
|
||||
@@ -516,6 +519,9 @@
|
||||
<data name="UserIdCannotBeEmpty" xml:space="preserve">
|
||||
<value>User Id cannot be empty!</value>
|
||||
</data>
|
||||
<data name="UserMustHaveRoleOrDirectPermissions" xml:space="preserve">
|
||||
<value>User must have permissions either from role permissions or direct user permissions</value>
|
||||
</data>
|
||||
<data name="UsernameAlreadyExists" xml:space="preserve">
|
||||
<value>Username already exists!</value>
|
||||
</data>
|
||||
|
||||
+6
@@ -141,6 +141,9 @@
|
||||
<data name="CannotNavigateUp" xml:space="preserve">
|
||||
<value>¡No se puede navegar hacia arriba!</value>
|
||||
</data>
|
||||
<data name="CannotRemoveLastAdmin" xml:space="preserve">
|
||||
<value>¡No se puede eliminar el último rol de Admin asignado al usuario!</value>
|
||||
</data>
|
||||
<data name="CodecCannotBeEmpty" xml:space="preserve">
|
||||
<value>¡El códec no puede estar vacío!</value>
|
||||
</data>
|
||||
@@ -516,6 +519,9 @@
|
||||
<data name="UserIdCannotBeEmpty" xml:space="preserve">
|
||||
<value>¡El ID de usuario no puede estar vacío!</value>
|
||||
</data>
|
||||
<data name="UserMustHaveRoleOrDirectPermissions" xml:space="preserve">
|
||||
<value>¡El usuario debe tener permisos de rol o permisos directos!</value>
|
||||
</data>
|
||||
<data name="UsernameAlreadyExists" xml:space="preserve">
|
||||
<value>¡El nombre de usuario ya existe!</value>
|
||||
</data>
|
||||
|
||||
+6
@@ -141,6 +141,9 @@
|
||||
<data name="CannotNavigateUp" xml:space="preserve">
|
||||
<value>Impossible de remonter le dossier !</value>
|
||||
</data>
|
||||
<data name="CannotRemoveLastAdmin" xml:space="preserve">
|
||||
<value>Impossible de supprimer le dernier rôle Admin attribué à l'utilisateur!</value>
|
||||
</data>
|
||||
<data name="CodecCannotBeEmpty" xml:space="preserve">
|
||||
<value>Le codec ne peut pas être vide !</value>
|
||||
</data>
|
||||
@@ -516,6 +519,9 @@
|
||||
<data name="UserIdCannotBeEmpty" xml:space="preserve">
|
||||
<value>L'identifiant utilisateur ne peut pas être vide !</value>
|
||||
</data>
|
||||
<data name="UserMustHaveRoleOrDirectPermissions" xml:space="preserve">
|
||||
<value>L'utilisateur doit avoir des permissions de rôle ou des permissions directes!</value>
|
||||
</data>
|
||||
<data name="UsernameAlreadyExists" xml:space="preserve">
|
||||
<value>Le nom d'utilisateur existe déjà!</value>
|
||||
</data>
|
||||
|
||||
+6
@@ -141,6 +141,9 @@
|
||||
<data name="CannotNavigateUp" xml:space="preserve">
|
||||
<value>Impossibile navigare verso l'alto!</value>
|
||||
</data>
|
||||
<data name="CannotRemoveLastAdmin" xml:space="preserve">
|
||||
<value>Impossibile rimuovere l'ultimo ruolo Admin assegnato all'utente!</value>
|
||||
</data>
|
||||
<data name="CodecCannotBeEmpty" xml:space="preserve">
|
||||
<value>Il codec non può essere vuoto!</value>
|
||||
</data>
|
||||
@@ -516,6 +519,9 @@
|
||||
<data name="UserIdCannotBeEmpty" xml:space="preserve">
|
||||
<value>L'ID utente non può essere vuoto!</value>
|
||||
</data>
|
||||
<data name="UserMustHaveRoleOrDirectPermissions" xml:space="preserve">
|
||||
<value>L'utente deve avere permessi da ruolo o permessi diretti!</value>
|
||||
</data>
|
||||
<data name="UsernameAlreadyExists" xml:space="preserve">
|
||||
<value>Il nome utente esiste già!</value>
|
||||
</data>
|
||||
|
||||
+6
@@ -141,6 +141,9 @@
|
||||
<data name="CannotNavigateUp" xml:space="preserve">
|
||||
<value>上の階層に移動できません!</value>
|
||||
</data>
|
||||
<data name="CannotRemoveLastAdmin" xml:space="preserve">
|
||||
<value>最後の管理者権限を削除できません!</value>
|
||||
</data>
|
||||
<data name="CodecCannotBeEmpty" xml:space="preserve">
|
||||
<value>コーデックを空にすることはできません!</value>
|
||||
</data>
|
||||
@@ -516,6 +519,9 @@
|
||||
<data name="UserIdCannotBeEmpty" xml:space="preserve">
|
||||
<value>ユーザーIDを空にすることはできません!</value>
|
||||
</data>
|
||||
<data name="UserMustHaveRoleOrDirectPermissions" xml:space="preserve">
|
||||
<value>ユーザーにはロール権限か直接権限のいずれかが必要です!</value>
|
||||
</data>
|
||||
<data name="UsernameAlreadyExists" xml:space="preserve">
|
||||
<value>このユーザー名は既に使用されています!</value>
|
||||
</data>
|
||||
|
||||
+6
@@ -141,6 +141,9 @@
|
||||
<data name="CannotNavigateUp" xml:space="preserve">
|
||||
<value>Cannot navigate up!</value>
|
||||
</data>
|
||||
<data name="CannotRemoveLastAdmin" xml:space="preserve">
|
||||
<value>Cannot remove the last Admin role assigned to a user!</value>
|
||||
</data>
|
||||
<data name="CodecCannotBeEmpty" xml:space="preserve">
|
||||
<value>Codec cannot be empty!</value>
|
||||
</data>
|
||||
@@ -516,6 +519,9 @@
|
||||
<data name="UserIdCannotBeEmpty" xml:space="preserve">
|
||||
<value>User Id cannot be empty!</value>
|
||||
</data>
|
||||
<data name="UserMustHaveRoleOrDirectPermissions" xml:space="preserve">
|
||||
<value>User must have permissions either from role permissions or direct user permissions</value>
|
||||
</data>
|
||||
<data name="UsernameAlreadyExists" xml:space="preserve">
|
||||
<value>Username already exists!</value>
|
||||
</data>
|
||||
|
||||
+6
@@ -141,6 +141,9 @@
|
||||
<data name="CannotNavigateUp" xml:space="preserve">
|
||||
<value>Nu se poate naviga în sus!</value>
|
||||
</data>
|
||||
<data name="CannotRemoveLastAdmin" xml:space="preserve">
|
||||
<value>Nu se poate elimina ultimul rol de Admin atribuit unui utilizator!</value>
|
||||
</data>
|
||||
<data name="CodecCannotBeEmpty" xml:space="preserve">
|
||||
<value>Codecul nu poate fi gol!</value>
|
||||
</data>
|
||||
@@ -516,6 +519,9 @@
|
||||
<data name="UserIdCannotBeEmpty" xml:space="preserve">
|
||||
<value>ID-ul utilizatorului nu poate fi gol!</value>
|
||||
</data>
|
||||
<data name="UserMustHaveRoleOrDirectPermissions" xml:space="preserve">
|
||||
<value>Utilizatorul trebuie să aibă permisiuni din rol sau permisiuni directe!</value>
|
||||
</data>
|
||||
<data name="UsernameAlreadyExists" xml:space="preserve">
|
||||
<value>Numele de utilizator există deja!</value>
|
||||
</data>
|
||||
|
||||
+6
@@ -141,6 +141,9 @@
|
||||
<data name="CannotNavigateUp" xml:space="preserve">
|
||||
<value>Невозможно перейти на уровень выше!</value>
|
||||
</data>
|
||||
<data name="CannotRemoveLastAdmin" xml:space="preserve">
|
||||
<value>Невозможно удалить последнюю роль администратора, назначенную пользователю!</value>
|
||||
</data>
|
||||
<data name="CodecCannotBeEmpty" xml:space="preserve">
|
||||
<value>Кодек не может быть пустым!</value>
|
||||
</data>
|
||||
@@ -516,6 +519,9 @@
|
||||
<data name="UserIdCannotBeEmpty" xml:space="preserve">
|
||||
<value>Идентификатор пользователя не может быть пустым!</value>
|
||||
</data>
|
||||
<data name="UserMustHaveRoleOrDirectPermissions" xml:space="preserve">
|
||||
<value>У пользователя должны быть разрешения роли или прямые разрешения!</value>
|
||||
</data>
|
||||
<data name="UsernameAlreadyExists" xml:space="preserve">
|
||||
<value>Имя пользователя уже существует!</value>
|
||||
</data>
|
||||
|
||||
+6
@@ -141,6 +141,9 @@
|
||||
<data name="CannotNavigateUp" xml:space="preserve">
|
||||
<value>无法向上导航!</value>
|
||||
</data>
|
||||
<data name="CannotRemoveLastAdmin" xml:space="preserve">
|
||||
<value>无法删除用户的最后一个管理员角色!</value>
|
||||
</data>
|
||||
<data name="CodecCannotBeEmpty" xml:space="preserve">
|
||||
<value>编解码器不能为空!</value>
|
||||
</data>
|
||||
@@ -516,6 +519,9 @@
|
||||
<data name="UserIdCannotBeEmpty" xml:space="preserve">
|
||||
<value>用户ID不能为空!</value>
|
||||
</data>
|
||||
<data name="UserMustHaveRoleOrDirectPermissions" xml:space="preserve">
|
||||
<value>用户必须具有角色权限或直接权限!</value>
|
||||
</data>
|
||||
<data name="UsernameAlreadyExists" xml:space="preserve">
|
||||
<value>用户名已存在!</value>
|
||||
</data>
|
||||
|
||||
@@ -0,0 +1,147 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="CanDeleteUsers" xml:space="preserve">
|
||||
<value>Kann Benutzer löschen</value>
|
||||
</data>
|
||||
<data name="CanRegisterUsers" xml:space="preserve">
|
||||
<value>Kann Benutzer registrieren</value>
|
||||
</data>
|
||||
<data name="CanViewUsers" xml:space="preserve">
|
||||
<value>Kann Benutzer anzeigen</value>
|
||||
</data>
|
||||
<data name="Roles" xml:space="preserve">
|
||||
<value>Rollen</value>
|
||||
</data>
|
||||
<data name="SelectARole" xml:space="preserve">
|
||||
<value>Wählen Sie eine Rolle</value>
|
||||
</data>
|
||||
<data name="SelectAUser" xml:space="preserve">
|
||||
<value>Benutzer auswählen</value>
|
||||
</data>
|
||||
<data name="Update" xml:space="preserve">
|
||||
<value>Aktualisieren</value>
|
||||
</data>
|
||||
<data name="UserAuthorizationUpdated" xml:space="preserve">
|
||||
<value>Benutzerberechtigung aktualisiert!</value>
|
||||
</data>
|
||||
<data name="Users" xml:space="preserve">
|
||||
<value>Benutzer</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -0,0 +1,147 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="CanDeleteUsers" xml:space="preserve">
|
||||
<value>Can delete users</value>
|
||||
</data>
|
||||
<data name="CanRegisterUsers" xml:space="preserve">
|
||||
<value>Can register users</value>
|
||||
</data>
|
||||
<data name="CanViewUsers" xml:space="preserve">
|
||||
<value>Can view users</value>
|
||||
</data>
|
||||
<data name="Roles" xml:space="preserve">
|
||||
<value>Roles</value>
|
||||
</data>
|
||||
<data name="SelectARole" xml:space="preserve">
|
||||
<value>Select a role</value>
|
||||
</data>
|
||||
<data name="SelectAUser" xml:space="preserve">
|
||||
<value>Select a user</value>
|
||||
</data>
|
||||
<data name="Update" xml:space="preserve">
|
||||
<value>Update</value>
|
||||
</data>
|
||||
<data name="UserAuthorizationUpdated" xml:space="preserve">
|
||||
<value>User authorization updated!</value>
|
||||
</data>
|
||||
<data name="Users" xml:space="preserve">
|
||||
<value>Users</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -0,0 +1,147 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="CanDeleteUsers" xml:space="preserve">
|
||||
<value>Puede eliminar usuarios</value>
|
||||
</data>
|
||||
<data name="CanRegisterUsers" xml:space="preserve">
|
||||
<value>Puede registrar usuarios</value>
|
||||
</data>
|
||||
<data name="CanViewUsers" xml:space="preserve">
|
||||
<value>Puede ver usuarios</value>
|
||||
</data>
|
||||
<data name="Roles" xml:space="preserve">
|
||||
<value>Roles</value>
|
||||
</data>
|
||||
<data name="SelectARole" xml:space="preserve">
|
||||
<value>Selecciona un rol</value>
|
||||
</data>
|
||||
<data name="SelectAUser" xml:space="preserve">
|
||||
<value>Seleccionar usuario</value>
|
||||
</data>
|
||||
<data name="Update" xml:space="preserve">
|
||||
<value>Actualizar</value>
|
||||
</data>
|
||||
<data name="UserAuthorizationUpdated" xml:space="preserve">
|
||||
<value>¡Autorización de usuario actualizada!</value>
|
||||
</data>
|
||||
<data name="Users" xml:space="preserve">
|
||||
<value>Usuarios</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -0,0 +1,147 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="CanDeleteUsers" xml:space="preserve">
|
||||
<value>Peut supprimer des utilisateurs</value>
|
||||
</data>
|
||||
<data name="CanRegisterUsers" xml:space="preserve">
|
||||
<value>Peut enregistrer des utilisateurs</value>
|
||||
</data>
|
||||
<data name="CanViewUsers" xml:space="preserve">
|
||||
<value>Peut voir les utilisateurs</value>
|
||||
</data>
|
||||
<data name="Roles" xml:space="preserve">
|
||||
<value>Rôles</value>
|
||||
</data>
|
||||
<data name="SelectARole" xml:space="preserve">
|
||||
<value>Sélectionnez un rôle</value>
|
||||
</data>
|
||||
<data name="SelectAUser" xml:space="preserve">
|
||||
<value>Sélectionner un utilisateur</value>
|
||||
</data>
|
||||
<data name="Update" xml:space="preserve">
|
||||
<value>Mettre à jour</value>
|
||||
</data>
|
||||
<data name="UserAuthorizationUpdated" xml:space="preserve">
|
||||
<value>Autorisation utilisateur mise à jour!</value>
|
||||
</data>
|
||||
<data name="Users" xml:space="preserve">
|
||||
<value>Utilisateurs</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -0,0 +1,147 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="CanDeleteUsers" xml:space="preserve">
|
||||
<value>Può eliminare utenti</value>
|
||||
</data>
|
||||
<data name="CanRegisterUsers" xml:space="preserve">
|
||||
<value>Può registrare utenti</value>
|
||||
</data>
|
||||
<data name="CanViewUsers" xml:space="preserve">
|
||||
<value>Può visualizzare utenti</value>
|
||||
</data>
|
||||
<data name="Roles" xml:space="preserve">
|
||||
<value>Ruoli</value>
|
||||
</data>
|
||||
<data name="SelectARole" xml:space="preserve">
|
||||
<value>Seleziona un ruolo</value>
|
||||
</data>
|
||||
<data name="SelectAUser" xml:space="preserve">
|
||||
<value>Seleziona utente</value>
|
||||
</data>
|
||||
<data name="Update" xml:space="preserve">
|
||||
<value>Aggiorna</value>
|
||||
</data>
|
||||
<data name="UserAuthorizationUpdated" xml:space="preserve">
|
||||
<value>Autorizzazione utente aggiornata!</value>
|
||||
</data>
|
||||
<data name="Users" xml:space="preserve">
|
||||
<value>Utenti</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -0,0 +1,147 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="CanDeleteUsers" xml:space="preserve">
|
||||
<value>ユーザーを削除できます</value>
|
||||
</data>
|
||||
<data name="CanRegisterUsers" xml:space="preserve">
|
||||
<value>ユーザーを登録できます</value>
|
||||
</data>
|
||||
<data name="CanViewUsers" xml:space="preserve">
|
||||
<value>ユーザーを表示できます</value>
|
||||
</data>
|
||||
<data name="Roles" xml:space="preserve">
|
||||
<value>ロール</value>
|
||||
</data>
|
||||
<data name="SelectARole" xml:space="preserve">
|
||||
<value>ロールを選択してください</value>
|
||||
</data>
|
||||
<data name="SelectAUser" xml:space="preserve">
|
||||
<value>ユーザーを選択</value>
|
||||
</data>
|
||||
<data name="Update" xml:space="preserve">
|
||||
<value>更新</value>
|
||||
</data>
|
||||
<data name="UserAuthorizationUpdated" xml:space="preserve">
|
||||
<value>ユーザー権限を更新しました!</value>
|
||||
</data>
|
||||
<data name="Users" xml:space="preserve">
|
||||
<value>ユーザー</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -0,0 +1,147 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="CanDeleteUsers" xml:space="preserve">
|
||||
<value>Can delete users</value>
|
||||
</data>
|
||||
<data name="CanRegisterUsers" xml:space="preserve">
|
||||
<value>Can register users</value>
|
||||
</data>
|
||||
<data name="CanViewUsers" xml:space="preserve">
|
||||
<value>Can view users</value>
|
||||
</data>
|
||||
<data name="Roles" xml:space="preserve">
|
||||
<value>Roles</value>
|
||||
</data>
|
||||
<data name="SelectARole" xml:space="preserve">
|
||||
<value>Select a role</value>
|
||||
</data>
|
||||
<data name="SelectAUser" xml:space="preserve">
|
||||
<value>Select a user</value>
|
||||
</data>
|
||||
<data name="Update" xml:space="preserve">
|
||||
<value>Update</value>
|
||||
</data>
|
||||
<data name="UserAuthorizationUpdated" xml:space="preserve">
|
||||
<value>User authorization updated!</value>
|
||||
</data>
|
||||
<data name="Users" xml:space="preserve">
|
||||
<value>Users</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -0,0 +1,147 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="CanDeleteUsers" xml:space="preserve">
|
||||
<value>Poate șterge utilizatori</value>
|
||||
</data>
|
||||
<data name="CanRegisterUsers" xml:space="preserve">
|
||||
<value>Poate înregistra utilizatori</value>
|
||||
</data>
|
||||
<data name="CanViewUsers" xml:space="preserve">
|
||||
<value>Poate vizualiza utilizatori</value>
|
||||
</data>
|
||||
<data name="Roles" xml:space="preserve">
|
||||
<value>Roluri</value>
|
||||
</data>
|
||||
<data name="SelectARole" xml:space="preserve">
|
||||
<value>Selectare rol</value>
|
||||
</data>
|
||||
<data name="SelectAUser" xml:space="preserve">
|
||||
<value>Selectare utilizator</value>
|
||||
</data>
|
||||
<data name="Update" xml:space="preserve">
|
||||
<value>Actualizare</value>
|
||||
</data>
|
||||
<data name="UserAuthorizationUpdated" xml:space="preserve">
|
||||
<value>Autorizare utilizator actualizată!</value>
|
||||
</data>
|
||||
<data name="Users" xml:space="preserve">
|
||||
<value>Utilizatori</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -0,0 +1,147 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="CanDeleteUsers" xml:space="preserve">
|
||||
<value>Может удалять пользователей</value>
|
||||
</data>
|
||||
<data name="CanRegisterUsers" xml:space="preserve">
|
||||
<value>Может регистрировать пользователей</value>
|
||||
</data>
|
||||
<data name="CanViewUsers" xml:space="preserve">
|
||||
<value>Может просматривать пользователей</value>
|
||||
</data>
|
||||
<data name="Roles" xml:space="preserve">
|
||||
<value>Роли</value>
|
||||
</data>
|
||||
<data name="SelectARole" xml:space="preserve">
|
||||
<value>Выберите роль</value>
|
||||
</data>
|
||||
<data name="SelectAUser" xml:space="preserve">
|
||||
<value>Выбрать пользователя</value>
|
||||
</data>
|
||||
<data name="Update" xml:space="preserve">
|
||||
<value>Обновить</value>
|
||||
</data>
|
||||
<data name="UserAuthorizationUpdated" xml:space="preserve">
|
||||
<value>Авторизация пользователя обновлена!</value>
|
||||
</data>
|
||||
<data name="Users" xml:space="preserve">
|
||||
<value>Пользователи</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -0,0 +1,147 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="CanDeleteUsers" xml:space="preserve">
|
||||
<value>可以删除用户</value>
|
||||
</data>
|
||||
<data name="CanRegisterUsers" xml:space="preserve">
|
||||
<value>可以注册用户</value>
|
||||
</data>
|
||||
<data name="CanViewUsers" xml:space="preserve">
|
||||
<value>可以查看用户</value>
|
||||
</data>
|
||||
<data name="Roles" xml:space="preserve">
|
||||
<value>角色</value>
|
||||
</data>
|
||||
<data name="SelectARole" xml:space="preserve">
|
||||
<value>选择一个角色</value>
|
||||
</data>
|
||||
<data name="SelectAUser" xml:space="preserve">
|
||||
<value>选择用户</value>
|
||||
</data>
|
||||
<data name="Update" xml:space="preserve">
|
||||
<value>更新</value>
|
||||
</data>
|
||||
<data name="UserAuthorizationUpdated" xml:space="preserve">
|
||||
<value>用户授权已更新!</value>
|
||||
</data>
|
||||
<data name="Users" xml:space="preserve">
|
||||
<value>用户</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -2,100 +2,231 @@
|
||||
/admin/manage-permissions/
|
||||
*@
|
||||
|
||||
@using Lumina.Presentation.Web.Common.Models.Authorization
|
||||
@using Lumina.Presentation.Web.Common.Models.UsersManagement
|
||||
@using Lumina.Presentation.Web.Common.Services
|
||||
@using Microsoft.AspNetCore.Mvc.Localization
|
||||
@using Lumina.Presentation.Web.Common.Models.Authorization
|
||||
|
||||
@{
|
||||
var roles = ViewData["roles"] as RoleModel[];
|
||||
var rolePermissions = ViewData["rolePermissions"] as PermissionModel[];
|
||||
}
|
||||
var users = ViewData["users"] as UserModel[];
|
||||
var permissions = ViewData["permissions"] as PermissionModel[];
|
||||
// generate a unique id for the scripts section of this view, so it can be dynamically loaded/unloaded by the global AJAX navigator handler
|
||||
var scriptId = ScriptIdentifierHelper.GenerateScriptId();
|
||||
}
|
||||
|
||||
@inject IViewLocalizer _localizer
|
||||
@inject IUrlService _urlService
|
||||
|
||||
<form id="rolesPermissionsForm" method="post" action="/Permissions/CreateRole">
|
||||
<input type="hidden" name="rolesRoleId" id="rolesRoleId" value="" />
|
||||
<!-- Roles dropdown row -->
|
||||
<div class="h-30px w-100 text-end">
|
||||
<label for="rolesRolesDropdown" class="text-light-one">@_localizer["Roles"]</label>
|
||||
<form id="authorization-permissions-form" method="post" class="w-100 h-100 mx-auto pl-10 pr-10 pt-10 pb-10">
|
||||
<div id="authorization-permissions-container">
|
||||
<input type="hidden" name="authorization-users-selected-id" id="authorization-users-selected-id" value="" />
|
||||
<input type="hidden" name="authorization-roles-selected-id" id="authorization-roles-selected-id" value="" />
|
||||
<!-- Users dropdown row -->
|
||||
<div class="h-30px w-100 text-end mb-5">
|
||||
<label for="authorization-users-combobox" class="text-light-one">@_localizer["Users"]</label>
|
||||
|
||||
<div class="enlightenment-combobox w-250px inline-block" id="rolesRolesDropdown">
|
||||
<div class="shine-effect" style="top: 1px;"></div>
|
||||
<input type="checkbox" id="rolesRolesDropdownToggle" class="enlightenment-toggle-checkbox" />
|
||||
<label class="enlightenment-toggle" for="rolesRolesDropdownToggle">
|
||||
<span class="enlightenment-selected-text">@_localizer["SelectARole"]</span>
|
||||
</label>
|
||||
<div class="enlightenment-dropdown">
|
||||
<div class="shine-effect" style="top: -4px;"></div>
|
||||
<div class="enlightenment-option first-option disabled">@_localizer["SelectARole"]</div>
|
||||
@if (roles is not null)
|
||||
{
|
||||
@for (int i = 0; i < roles.Length; i++)
|
||||
<div class="enlightenment-combobox w-250px inline-block" id="authorization-users-combobox">
|
||||
<div class="shine-effect" style="top: 1px;"></div>
|
||||
<input type="checkbox" id="authorization-users-combobox-toggle" class="enlightenment-toggle-checkbox" />
|
||||
<label class="enlightenment-toggle" for="authorization-users-combobox-toggle">
|
||||
<span class="enlightenment-selected-text">@_localizer["SelectAUser"]</span>
|
||||
</label>
|
||||
<div class="enlightenment-dropdown" id="authorization-users-combobox-dropdown">
|
||||
<div class="shine-effect" style="top: -4px;"></div>
|
||||
<div class="enlightenment-option first-option disabled">@_localizer["SelectAUser"]</div>
|
||||
@if (users is not null)
|
||||
{
|
||||
<div class="enlightenment-option @(i == roles.Length - 1 ? "last-option" : "")" data-value="@roles[i].Id">@roles[i].RoleName</div>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Role name input row -->
|
||||
<div class="h-30px w-100 text-end mb-5">
|
||||
<label for="rolesRoleInput" class="text-light-one">@_localizer["RoleName"]</label>
|
||||
<input type="text" id="rolesRoleInput" name="roleName" class="enlightenment-input w-250px" />
|
||||
</div>
|
||||
|
||||
<!-- Permissions row -->
|
||||
<div class="containerRoles row panel inset">
|
||||
<div class="explorerContainer">
|
||||
<div class="explorer">
|
||||
@if (rolePermissions is not null)
|
||||
{
|
||||
@foreach (var rolePermission in rolePermissions)
|
||||
{
|
||||
<div class="e no-border transparent">
|
||||
<label class="enlightenment-checkbox-label">
|
||||
<input type="checkbox" class="enlightenment-checkbox-hidden" name="rolePermissions" value="@rolePermission.Id">
|
||||
<span class="enlightenment-checkbox"></span>
|
||||
@_localizer[rolePermission.PermissionName.ToString()]
|
||||
</label>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Submit Button Row -->
|
||||
<div class="w-100 text-end">
|
||||
<button type="button" class="abort-button f-14 h-24px v-align-t hidden" id="rolesDeleteRoleBtn">@_localizer["DeleteRole"]</button>
|
||||
<button type="submit" class="confirm-button f-14 h-24px v-align-t" id="rolesConfirmBtn">@_localizer["CreateRole"]</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@* <div class="enlightenment-panel shadow-effect p-2 mx-auto panel w-90 mb-10" style="min-width: 320px; margin-top: 1rem;">
|
||||
<div class="shine-effect"></div>
|
||||
<form method="post" id="add-media-library-form" class="inline">
|
||||
@Html.AntiForgeryToken()
|
||||
@{
|
||||
<div class="form-field">
|
||||
<div class="enlightenment-combobox inline-block w-100">
|
||||
<div class="shine-effect" style="top: 1px;"></div>
|
||||
<input type="checkbox" class="enlightenment-toggle-checkbox" id="library-type" />
|
||||
<label class="enlightenment-toggle" for="library-type">
|
||||
<span id="library-selected-item" class="enlightenment-selected-text" data-value="None">@_localizer["None"]</span>
|
||||
</label>
|
||||
<div class="enlightenment-dropdown">
|
||||
<div class="shine-effect" style="top: -4px;"></div>
|
||||
<div class="enlightenment-option first-option disabled">@_localizer["None"]</div>
|
||||
@foreach (var item in aa!)
|
||||
@for (int i = 0; i < users.Length; i++)
|
||||
{
|
||||
<div class="enlightenment-option">@_localizer[item.ToString()]</div>
|
||||
<div class="enlightenment-option @(i == users.Length - 1 ? "last-option" : "")" data-value="@users[i].Id">@users[i].Username</div>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Roles dropdown row -->
|
||||
<div class="h-30px w-100 text-end mb-5">
|
||||
<label for="authorization-roles-combobox" class="text-light-one">@_localizer["Roles"]</label>
|
||||
|
||||
<div class="enlightenment-combobox w-250px inline-block" id="authorization-roles-combobox">
|
||||
<div class="shine-effect" style="top: 1px;"></div>
|
||||
<input type="checkbox" id="authorization-roles-combobox-toggle" class="enlightenment-toggle-checkbox" />
|
||||
<label class="enlightenment-toggle" for="authorization-roles-combobox-toggle">
|
||||
<span class="enlightenment-selected-text">@_localizer["SelectARole"]</span>
|
||||
</label>
|
||||
<div class="enlightenment-dropdown" id="authorization-roles-combobox-dropdown">
|
||||
<div class="shine-effect" style="top: -4px;"></div>
|
||||
<div class="enlightenment-option first-option disabled">@_localizer["SelectARole"]</div>
|
||||
@if (roles is not null)
|
||||
{
|
||||
@for (int i = 0; i < roles.Length; i++)
|
||||
{
|
||||
<div class="enlightenment-option @(i == roles.Length - 1 ? "last-option" : "")" data-value="@roles[i].Id">@roles[i].RoleName</div>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Permissions row -->
|
||||
<div id="authorization-permissions-permissions-container" class="">
|
||||
<div id="authorization-permissions-permissions">
|
||||
<div id="authorization-permissions-permissions-scroll" class="scroll-horizontal">
|
||||
<div id="authorization-permissions-permissions-list" class="list" style="flex-direction: column;">
|
||||
@if (permissions is not null)
|
||||
{
|
||||
@foreach (var permission in permissions)
|
||||
{
|
||||
<div class="e no-border transparent mt-5 mb-5">
|
||||
<label class="enlightenment-checkbox-label">
|
||||
<input type="checkbox" class="enlightenment-checkbox-hidden" name="authorization-permissions-permissions" value="@permission.Id">
|
||||
<span class="enlightenment-checkbox"></span>
|
||||
@_localizer[permission.PermissionName.ToString()]
|
||||
</label>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
<p>a</p>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div> *@
|
||||
<!-- Submit Button Row -->
|
||||
<div class="w-100 h-25px mt-5 text-end">
|
||||
<button id="btn-update-user" type="submit" class="confirm-button f-14 h-24px v-align-t" disabled>@_localizer["Update"]</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@section Scripts {
|
||||
<script type="text/javascript" data-form="@scriptId" defer>
|
||||
// create cleanup registry for this view
|
||||
const cleanupFunctions = [];
|
||||
|
||||
const btnUpdateUser = document.getElementById('btn-update-user');
|
||||
const form = document.getElementById('authorization-permissions-form');
|
||||
const rolesDropdown = document.getElementById('authorization-roles-combobox-dropdown');
|
||||
const usersDropdown = document.getElementById('authorization-users-combobox-dropdown');
|
||||
const roleIdInput = document.getElementById('authorization-roles-selected-id');
|
||||
const userIdInput = document.getElementById('authorization-users-selected-id');
|
||||
|
||||
// update user permissions and role
|
||||
async function handleUserAuthorizationSubmitAsync() {
|
||||
const formData = {
|
||||
userId: userIdInput.value,
|
||||
roleId: roleIdInput.value !== '' ? roleIdInput.value : null,
|
||||
permissions: Array.from(form.querySelectorAll("input[name='authorization-permissions-permissions']:checked"))
|
||||
.map(checkbox => checkbox.value)
|
||||
};
|
||||
|
||||
const data = await callApiPutAsync('@_urlService.GetAbsoluteUrl("UpdateUserAuthorization", "Admin")', formData);
|
||||
if (data)
|
||||
notificationService.show('@_localizer["UserAuthorizationUpdated"]', NotificationType.SUCCESS);
|
||||
}
|
||||
|
||||
async function fetchUserRoleAsync(userId) {
|
||||
const url = '@_urlService.GetAbsoluteUrl("GetRoleByUserId", "Admin", new { userId = default(Guid) })';
|
||||
const data = await callApiGetAsync(url.replace('/@(default(Guid))', `/${userId}`)); // userId needs to be replaced here, because GetAbsoluteUrl is server side, userId is client side
|
||||
if (data) {
|
||||
var roleElement = document.querySelector('#authorization-roles-combobox .enlightenment-option[data-value="' + data.id + '"]');
|
||||
var roleName = roleElement.textContent;
|
||||
document.querySelector('#authorization-roles-combobox .enlightenment-selected-text').textContent = roleName;
|
||||
document.querySelector('#authorization-roles-combobox .enlightenment-toggle').dataset.value = data.id;
|
||||
roleIdInput.value = data.id;
|
||||
}
|
||||
}
|
||||
|
||||
async function fetchUserPermissionsAsync(userId) {
|
||||
const url = '@_urlService.GetAbsoluteUrl("GetPermissionsByUserId", "Admin", new { userId = default(Guid) })';
|
||||
const data = await callApiGetAsync(url.replace('/@(default(Guid))', `/${userId}`)); // userId needs to be replaced here, because GetAbsoluteUrl is server side, userId is client side
|
||||
if (data) {
|
||||
// clear all checkboxes
|
||||
document.querySelectorAll("input[name='authorization-permissions-permissions']")
|
||||
.forEach(input => input.checked = false);
|
||||
|
||||
// check the checkboxes for which permissions are assigned
|
||||
data.forEach(p => {
|
||||
const checkbox = document.querySelector(`input[name='authorization-permissions-permissions'][value='${p.id}']`);
|
||||
if (checkbox)
|
||||
checkbox.checked = true;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// on Enter key pressed
|
||||
const handleEnterKey = async function(e) {
|
||||
if (e.key === 'Enter') {
|
||||
e.preventDefault();
|
||||
await handleUserAuthorizationSubmitAsync();
|
||||
}
|
||||
};
|
||||
|
||||
// on form submit event
|
||||
const handleSubmit = async function(e) {
|
||||
e.preventDefault();
|
||||
await handleUserAuthorizationSubmitAsync();
|
||||
};
|
||||
|
||||
// on document click
|
||||
const handleDocumentClick = async function(e) {
|
||||
// users dropdown change
|
||||
if (e.target.closest('#authorization-users-combobox .enlightenment-option')) {
|
||||
var selectedUserId = e.target.dataset.value;
|
||||
document.querySelector('#authorization-roles-combobox .enlightenment-selected-text').textContent = '@_localizer["SelectARole"]';
|
||||
document.querySelectorAll("input[name='authorization-permissions-permissions']").forEach(input => input.checked = false);
|
||||
roleIdInput.value = '';
|
||||
userIdInput.value = '';
|
||||
if (selectedUserId) {
|
||||
userIdInput.value = selectedUserId;
|
||||
btnUpdateUser.disabled = false;
|
||||
await fetchUserRoleAsync(selectedUserId);
|
||||
await fetchUserPermissionsAsync(selectedUserId);
|
||||
}
|
||||
else
|
||||
btnUpdateUser.disabled = true;
|
||||
}
|
||||
// roles dropdown change
|
||||
else if (e.target.closest('#authorization-roles-combobox .enlightenment-option')) {
|
||||
const roleId = e.target.dataset.value;
|
||||
roleIdInput.value = roleId || '';
|
||||
}
|
||||
};
|
||||
|
||||
// add listeners
|
||||
form.addEventListener('keypress', handleEnterKey);
|
||||
form.addEventListener('submit', handleSubmit);
|
||||
document.addEventListener('click', handleDocumentClick);
|
||||
|
||||
// register cleanup for these listeners
|
||||
cleanupFunctions.push(() => {
|
||||
form.removeEventListener('keypress', handleEnterKey);
|
||||
form.removeEventListener('submit', handleSubmit);
|
||||
document.removeEventListener('click', handleDocumentClick);
|
||||
});
|
||||
|
||||
// when form's height changes, adjust the roles combobox dropdown maximum height accordingly, so it doesn't cause an <article> section overflow
|
||||
const resizeObserver = new ResizeObserver(entries => {
|
||||
const formHeight = form.getBoundingClientRect().height;
|
||||
usersDropdown.style.maxHeight = `calc(${formHeight}px - 50px)`;
|
||||
rolesDropdown.style.maxHeight = `calc(${formHeight}px - 90px)`;
|
||||
usersDropdown.style.overflowY = `auto`;
|
||||
rolesDropdown.style.overflowY = `auto`;
|
||||
});
|
||||
resizeObserver.observe(form);
|
||||
|
||||
// register cleanup for observer
|
||||
cleanupFunctions.push(() => {
|
||||
resizeObserver.disconnect();
|
||||
});
|
||||
|
||||
// store all cleanups for this view on window object using the scriptId
|
||||
window.viewCleanups = window.viewCleanups || {};
|
||||
window.viewCleanups['@scriptId'] = () => {
|
||||
cleanupFunctions.forEach(cleanup => cleanup());
|
||||
console.log(`Unloaded @scriptId`);
|
||||
};
|
||||
console.log(`Loaded @scriptId`);
|
||||
</script>
|
||||
}
|
||||
@@ -1 +1,46 @@
|
||||
|
||||
#authorization-permissions-container {
|
||||
display: flex;
|
||||
margin: auto;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
flex-direction: column;
|
||||
flex-wrap: nowrap;
|
||||
}
|
||||
|
||||
#authorization-permissions-permissions-container {
|
||||
flex-grow: 1;
|
||||
min-width: 135px;
|
||||
min-height: 0px;
|
||||
}
|
||||
|
||||
#authorization-permissions-permissions {
|
||||
border: 1px solid var(--border-color-light-high);
|
||||
border-top: 1px solid var(--border-color-dark);
|
||||
border-left: 1px solid var(--border-color-dark);
|
||||
margin: auto;
|
||||
padding-left: 5px;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: nowrap;
|
||||
justify-content: left;
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
#authorization-permissions-permissions-scroll {
|
||||
background-color: #232323;
|
||||
margin: auto;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
#authorization-permissions-permissions-list {
|
||||
margin: 1px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex-wrap: wrap;
|
||||
border: 0px solid black;
|
||||
padding: 0px;
|
||||
gap: 0px 10px;
|
||||
}
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
@{
|
||||
var roles = ViewData["roles"] as RoleModel[];
|
||||
var rolePermissions = ViewData["rolePermissions"] as PermissionModel[];
|
||||
var permissions = ViewData["permissions"] as PermissionModel[];
|
||||
// generate a unique id for the scripts section of this view, so it can be dynamically loaded/unloaded by the global AJAX navigator handler
|
||||
var scriptId = ScriptIdentifierHelper.GenerateScriptId();
|
||||
}
|
||||
@@ -54,15 +54,15 @@
|
||||
<div id="authorization-roles-permissions">
|
||||
<div id="authorization-roles-permissions-scroll" class="scroll-horizontal">
|
||||
<div id="authorization-roles-permissions-list" class="list" style="flex-direction: column;">
|
||||
@if (rolePermissions is not null)
|
||||
@if (permissions is not null)
|
||||
{
|
||||
@foreach (var rolePermission in rolePermissions)
|
||||
@foreach (var permission in permissions)
|
||||
{
|
||||
<div class="e no-border transparent mt-5 mb-5">
|
||||
<label class="enlightenment-checkbox-label">
|
||||
<input type="checkbox" class="enlightenment-checkbox-hidden" name="authorization-role-permissions" value="@rolePermission.Id">
|
||||
<input type="checkbox" class="enlightenment-checkbox-hidden" name="authorization-role-permissions" value="@permission.Id">
|
||||
<span class="enlightenment-checkbox"></span>
|
||||
@_localizer[rolePermission.PermissionName.ToString()]
|
||||
@_localizer[permission.PermissionName.ToString()]
|
||||
</label>
|
||||
</div>
|
||||
}
|
||||
@@ -82,28 +82,20 @@
|
||||
|
||||
@section Scripts {
|
||||
<script type="text/javascript" data-form="@scriptId" defer>
|
||||
// create cleanup registry for this view
|
||||
const cleanupFunctions = [];
|
||||
|
||||
const btnDeleteRole = document.getElementById('btn-delete-role');
|
||||
const btnConfirmRole = document.getElementById('btn-confirm-role');
|
||||
const txtRoleName = document.getElementById('txt-role-name');
|
||||
const form = document.getElementById('authorization-roles-form');
|
||||
const dropdown = document.getElementById('authorization-roles-combobox-dropdown')
|
||||
// on Enter key pressed
|
||||
form.addEventListener('keypress', async (e) => {
|
||||
if (e.key === 'Enter') {
|
||||
e.preventDefault();
|
||||
await handleRoleSubmit(e.target.closest('form'));
|
||||
}
|
||||
});
|
||||
// on form submit event
|
||||
form.addEventListener('submit', async (e) => {
|
||||
e.preventDefault();
|
||||
await handleRoleSubmit(e.target);
|
||||
});
|
||||
const dropdown = document.getElementById('authorization-roles-combobox-dropdown');
|
||||
const roleIdInput = document.getElementById('authorization-roles-selected-id');
|
||||
|
||||
// create new or update existing role
|
||||
async function handleRoleSubmit(form) {
|
||||
async function handleRoleSubmitAsync() {
|
||||
const formData = {
|
||||
roleId: document.getElementById('authorization-roles-selected-id').value,
|
||||
roleId: roleIdInput.value,
|
||||
roleName: txtRoleName.value,
|
||||
permissions: Array.from(form.querySelectorAll("input[name='authorization-role-permissions']:checked"))
|
||||
.map(checkbox => checkbox.value)
|
||||
@@ -111,57 +103,17 @@
|
||||
|
||||
const isRoleSelected = formData.roleId !== '';
|
||||
|
||||
const data = isRoleSelected ?
|
||||
await callApiPutAsync('@_urlService.GetAbsoluteUrl("UpdateRole", "Admin")', formData) :
|
||||
await callApiPostAsync('@_urlService.GetAbsoluteUrl("CreateRole", "Admin")', formData);
|
||||
const data = isRoleSelected ?
|
||||
await callApiPutAsync('@_urlService.GetAbsoluteUrl("UpdateRole", "Admin")', formData) :
|
||||
await callApiPostAsync('@_urlService.GetAbsoluteUrl("CreateRole", "Admin")', formData);
|
||||
if (data) {
|
||||
await fetchRoles();
|
||||
await fetchRolesAsync();
|
||||
notificationService.show(isRoleSelected ? '@_localizer["RoleUpdated"]' : '@_localizer["RoleCreated"]', NotificationType.SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
btnDeleteRole.addEventListener('click', async function(e) {
|
||||
const roleId = document.getElementById('authorization-roles-selected-id').value;
|
||||
// ask the user for confirmation before deleting the role
|
||||
if (await dialogService.show('@_localizer["DeleteRoleConfirm"]', jsLocalizedDialogs.confirmation, DialogButtons.YES_NO_CANCEL, DialogIcon.QUESTION) === DialogButton.YES) {
|
||||
const url = '@_urlService.GetAbsoluteUrl("DeleteRole", "Admin", new { roleId = default(Guid) })';
|
||||
const success = await callApiDeleteAsync(url.replace('/@(default(Guid))', `/${roleId}`)); // roleId needs to be replaced here, because GetAbsoluteUrl is server side, roleId is client side
|
||||
if (success) {
|
||||
await fetchRoles();
|
||||
notificationService.show('@_localizer["RoleDeleted"]', NotificationType.SUCCESS);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// on role dropdown change
|
||||
document.addEventListener('click', function(e) {
|
||||
if (e.target.classList.contains('enlightenment-option')) {
|
||||
const roleId = e.target.dataset.value;
|
||||
const selectedText = e.target.textContent;
|
||||
const txtRoleName = document.getElementById('txt-role-name');
|
||||
txtRoleName.value = roleId ? selectedText : '';
|
||||
|
||||
fetchRolePermissions(roleId);
|
||||
|
||||
const roleIdInput = document.getElementById('authorization-roles-selected-id');
|
||||
|
||||
if (roleId) {
|
||||
btnDeleteRole.classList.remove('hidden');
|
||||
btnDeleteRole.classList.add('inline');
|
||||
btnConfirmRole.textContent = '@_localizer["UpdateRole"]';
|
||||
roleIdInput.value = roleId;
|
||||
} else {
|
||||
roleIdInput.value = '';
|
||||
btnDeleteRole.classList.remove('inline');
|
||||
btnDeleteRole.classList.add('hidden');
|
||||
btnConfirmRole.textContent = '@_localizer["CreateRole"]';
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
async function fetchRoles() {
|
||||
const url = '@_urlService.GetAbsoluteUrl("GetRoles", "Admin")';
|
||||
const data = await callApiGetAsync(url);
|
||||
async function fetchRolesAsync() {
|
||||
const data = await callApiGetAsync('@_urlService.GetAbsoluteUrl("GetRoles", "Admin")');
|
||||
if (data) {
|
||||
// clear the roles drop down list
|
||||
const rolesDropdown = document.querySelector("#authorization-roles-combobox .enlightenment-dropdown");
|
||||
@@ -198,7 +150,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
async function fetchRolePermissions(roleId) {
|
||||
async function fetchRolePermissionsAsync(roleId) {
|
||||
if (roleId) {
|
||||
const url = '@_urlService.GetAbsoluteUrl("GetPermissionsByRoleId", "Admin", new { roleId = default(Guid) })';
|
||||
const data = await callApiGetAsync(url.replace('/@(default(Guid))', `/${roleId}`)); // roleId needs to be replaced here, because GetAbsoluteUrl is server side, roleId is client side
|
||||
@@ -221,6 +173,72 @@
|
||||
.forEach(input => input.checked = false);
|
||||
}
|
||||
}
|
||||
|
||||
// on Enter key pressed
|
||||
const handleEnterKey = async function(e) {
|
||||
if (e.key === 'Enter') {
|
||||
e.preventDefault();
|
||||
await handleRoleSubmitAsync();
|
||||
}
|
||||
};
|
||||
|
||||
// on form submit event
|
||||
const handleSubmit = async function(e) {
|
||||
e.preventDefault();
|
||||
await handleRoleSubmitAsync();
|
||||
};
|
||||
|
||||
// on delete role button click
|
||||
const handleBtnDeleteRoleClick = async function(e) {
|
||||
// ask the user for confirmation before deleting the role
|
||||
if (await dialogService.show('@_localizer["DeleteRoleConfirm"]', jsLocalizedDialogs.confirmation, DialogButtons.YES_NO, DialogIcon.QUESTION) === DialogButton.YES) {
|
||||
const url = '@_urlService.GetAbsoluteUrl("DeleteRole", "Admin", new { roleId = default(Guid) })';
|
||||
const success = await callApiDeleteAsync(url.replace('/@(default(Guid))', `/${roleIdInput.value}`)); // roleId needs to be replaced here, because GetAbsoluteUrl is server side, roleId is client side
|
||||
if (success) {
|
||||
await fetchRolesAsync();
|
||||
notificationService.show('@_localizer["RoleDeleted"]', NotificationType.SUCCESS);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// on document click
|
||||
const handleDocumentClick = async function(e) {
|
||||
// roles dropdown change
|
||||
if (e.target.closest('#authorization-roles-combobox .enlightenment-option')) {
|
||||
const roleId = e.target.dataset.value;
|
||||
const selectedText = e.target.textContent;
|
||||
txtRoleName.value = roleId ? selectedText : '';
|
||||
|
||||
await fetchRolePermissionsAsync(roleId);
|
||||
|
||||
if (roleId) {
|
||||
btnDeleteRole.classList.remove('hidden');
|
||||
btnDeleteRole.classList.add('inline');
|
||||
btnConfirmRole.textContent = '@_localizer["UpdateRole"]';
|
||||
roleIdInput.value = roleId;
|
||||
} else {
|
||||
roleIdInput.value = '';
|
||||
btnDeleteRole.classList.remove('inline');
|
||||
btnDeleteRole.classList.add('hidden');
|
||||
btnConfirmRole.textContent = '@_localizer["CreateRole"]';
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// add listeners
|
||||
form.addEventListener('keypress', handleEnterKey);
|
||||
form.addEventListener('submit', handleSubmit);
|
||||
btnDeleteRole.addEventListener('click', handleBtnDeleteRoleClick);
|
||||
document.addEventListener('click', handleDocumentClick);
|
||||
|
||||
// register cleanup for these listeners
|
||||
cleanupFunctions.push(() => {
|
||||
form.removeEventListener('keypress', handleEnterKey);
|
||||
form.removeEventListener('submit', handleSubmit);
|
||||
btnDeleteRole.removeEventListener('click', handleBtnDeleteRoleClick);
|
||||
document.removeEventListener('click', handleDocumentClick);
|
||||
});
|
||||
|
||||
// when form's height changes, adjust the roles combobox dropdown maximum height accordingly, so it doesn't cause an <article> section overflow
|
||||
const resizeObserver = new ResizeObserver(entries => {
|
||||
const formHeight = form.getBoundingClientRect().height;
|
||||
@@ -228,5 +246,18 @@
|
||||
dropdown.style.overflowY = `auto`;
|
||||
});
|
||||
resizeObserver.observe(form);
|
||||
|
||||
// register cleanup for observer
|
||||
cleanupFunctions.push(() => {
|
||||
resizeObserver.disconnect();
|
||||
});
|
||||
|
||||
// store all cleanups for this view on window object using the scriptId
|
||||
window.viewCleanups = window.viewCleanups || {};
|
||||
window.viewCleanups['@scriptId'] = () => {
|
||||
cleanupFunctions.forEach(cleanup => cleanup());
|
||||
console.log(`Unloaded @scriptId`);
|
||||
};
|
||||
console.log(`Loaded @scriptId`);
|
||||
</script>
|
||||
}
|
||||
@@ -70,30 +70,22 @@
|
||||
</div>
|
||||
@section Scripts {
|
||||
<script type="text/javascript" data-form="@scriptId" defer>
|
||||
document.getElementById('change-password-form').addEventListener('keypress', async (e) => {
|
||||
if (e.key === 'Enter') {
|
||||
e.preventDefault();
|
||||
const form = e.target.closest('form');
|
||||
await handleChangePassword(form);
|
||||
}
|
||||
});
|
||||
// create cleanup registry for this view
|
||||
const cleanupFunctions = [];
|
||||
|
||||
document.getElementById('change-password-form').addEventListener('submit', async (e) => {
|
||||
e.preventDefault();
|
||||
await handleChangePassword(e.target);
|
||||
});
|
||||
const form = document.getElementById('change-password-form');
|
||||
const txtCurrentPassword = form.querySelector('[name="CurrentPassword"]');
|
||||
const txtNewPassword = form.querySelector('[name="NewPassword"]');
|
||||
const txtNewPasswordConfirm = form.querySelector('[name="NewPasswordConfirm"]');
|
||||
|
||||
async function handleChangePassword(form) {
|
||||
const txtCurrentPassword = form.querySelector('[name="CurrentPassword"]');
|
||||
const txtNewPassword = form.querySelector('[name="NewPassword"]');
|
||||
const txtNewPasswordConfirm = form.querySelector('[name="NewPasswordConfirm"]');
|
||||
|
||||
const changePasswordSuccess = document.getElementById('change-password-success');
|
||||
const divCurrentPassword = document.getElementById('div-current-password');
|
||||
const divNewPassword = document.getElementById('div-new-password');
|
||||
const divNewPasswordConfirm = document.getElementById('div-new-password-confirm');
|
||||
const divChangePasswordSubmit = document.getElementById('div-change-password-submit');
|
||||
const changePasswordSuccess = document.getElementById('change-password-success');
|
||||
const divCurrentPassword = document.getElementById('div-current-password');
|
||||
const divNewPassword = document.getElementById('div-new-password');
|
||||
const divNewPasswordConfirm = document.getElementById('div-new-password-confirm');
|
||||
const divChangePasswordSubmit = document.getElementById('div-change-password-submit');
|
||||
|
||||
// perform the password change
|
||||
async function handleChangePasswordAsync() {
|
||||
const formData = {
|
||||
CurrentPassword: txtCurrentPassword.value,
|
||||
NewPassword: txtNewPassword.value,
|
||||
@@ -108,5 +100,37 @@
|
||||
divChangePasswordSubmit.classList.add('hidden');
|
||||
}
|
||||
}
|
||||
|
||||
// on Enter key pressed
|
||||
const handleEnterKey = async function(e) {
|
||||
if (e.key === 'Enter') {
|
||||
e.preventDefault();
|
||||
await handleChangePasswordAsync();
|
||||
}
|
||||
};
|
||||
|
||||
// on form submit event
|
||||
const handleSubmit = async function(e) {
|
||||
e.preventDefault();
|
||||
await handleChangePasswordAsync();
|
||||
};
|
||||
|
||||
// add listeners
|
||||
form.addEventListener('keypress', handleEnterKey);
|
||||
form.addEventListener('submit', handleSubmit);
|
||||
|
||||
// register cleanup for these listeners
|
||||
cleanupFunctions.push(() => {
|
||||
form.removeEventListener('keypress', handleEnterKey);
|
||||
form.removeEventListener('submit', handleSubmit);
|
||||
});
|
||||
|
||||
// store all cleanups for this view on window object using the scriptId
|
||||
window.viewCleanups = window.viewCleanups || {};
|
||||
window.viewCleanups['@scriptId'] = () => {
|
||||
cleanupFunctions.forEach(cleanup => cleanup());
|
||||
console.log(`Unloaded @scriptId`);
|
||||
};
|
||||
console.log(`Loaded @scriptId`);
|
||||
</script>
|
||||
}
|
||||
@@ -64,28 +64,21 @@
|
||||
</div>
|
||||
@section Scripts {
|
||||
<script type="text/javascript" data-form="@scriptId" defer>
|
||||
document.getElementById('login-form').addEventListener('keypress', async (e) => {
|
||||
if (e.key === 'Enter') {
|
||||
e.preventDefault();
|
||||
const form = e.target.closest('form');
|
||||
await handleLogin(form);
|
||||
}
|
||||
});
|
||||
// create cleanup registry for this view
|
||||
const cleanupFunctions = [];
|
||||
|
||||
document.getElementById('login-form').addEventListener('submit', async (e) => {
|
||||
e.preventDefault();
|
||||
await handleLogin(e.target);
|
||||
});
|
||||
|
||||
async function handleLogin(form) {
|
||||
const returnUrlInput = form.querySelector('[name="ReturnUrl"]');
|
||||
const txtUsername = form.querySelector('[name="Username"]');
|
||||
const txtPassword = form.querySelector('[name="Password"]');
|
||||
const txtTotpCode = form.querySelector('[name="TotpCode"]');
|
||||
const divTotpCode = document.getElementById('div-totp-code');
|
||||
const btnLogin = document.getElementById('btn-login');
|
||||
const btnRecoverPassword = document.getElementById('btn-recover-password');
|
||||
const btnValidateTotp = document.getElementById('btn-validate-totp');
|
||||
const form = document.getElementById('login-form');
|
||||
const returnUrlInput = form.querySelector('[name="ReturnUrl"]');
|
||||
const txtUsername = form.querySelector('[name="Username"]');
|
||||
const txtPassword = form.querySelector('[name="Password"]');
|
||||
const txtTotpCode = form.querySelector('[name="TotpCode"]');
|
||||
const divTotpCode = document.getElementById('div-totp-code');
|
||||
const btnLogin = document.getElementById('btn-login');
|
||||
const btnRecoverPassword = document.getElementById('btn-recover-password');
|
||||
const btnValidateTotp = document.getElementById('btn-validate-totp');
|
||||
|
||||
// perform the authentication
|
||||
async function handleLoginAsync() {
|
||||
const formData = {
|
||||
Username: txtUsername.value,
|
||||
Password: txtPassword.value,
|
||||
@@ -105,8 +98,44 @@
|
||||
else if (data)
|
||||
window.location.href = data;
|
||||
}
|
||||
document.getElementById('btn-recover-password').addEventListener('click', () => {
|
||||
|
||||
// on Enter key pressed
|
||||
const handleEnterKey = async function(e) {
|
||||
if (e.key === 'Enter') {
|
||||
e.preventDefault();
|
||||
await handleLoginAsync();
|
||||
}
|
||||
};
|
||||
|
||||
// on form submit event
|
||||
const handleSubmit = async function(e) {
|
||||
e.preventDefault();
|
||||
await handleLoginAsync();
|
||||
};
|
||||
|
||||
// on recover password button click
|
||||
const handleBtnRecoverPasswordClick = function() {
|
||||
window.location.href = '@_urlService.GetAbsoluteUrl("RecoverPassword", "Auth")';
|
||||
};
|
||||
|
||||
// add listeners
|
||||
form.addEventListener('keypress', handleEnterKey);
|
||||
form.addEventListener('submit', handleSubmit);
|
||||
btnRecoverPassword.addEventListener('click', handleBtnRecoverPasswordClick);
|
||||
|
||||
// register cleanup for these listeners
|
||||
cleanupFunctions.push(() => {
|
||||
form.removeEventListener('keypress', handleEnterKey);
|
||||
form.removeEventListener('submit', handleSubmit);
|
||||
btnRecoverPassword.removeEventListener('click', handleBtnRecoverPasswordClick);
|
||||
});
|
||||
|
||||
// store all cleanups for this view on window object using the scriptId
|
||||
window.viewCleanups = window.viewCleanups || {};
|
||||
window.viewCleanups['@scriptId'] = () => {
|
||||
cleanupFunctions.forEach(cleanup => cleanup());
|
||||
console.log(`Unloaded @scriptId`);
|
||||
};
|
||||
console.log(`Loaded @scriptId`);
|
||||
</script>
|
||||
}
|
||||
@@ -58,29 +58,21 @@
|
||||
</div>
|
||||
@section Scripts {
|
||||
<script type="text/javascript" data-form="@scriptId" defer>
|
||||
document.getElementById('recover-password-form').addEventListener('keypress', async (e) => {
|
||||
if (e.key === 'Enter') {
|
||||
e.preventDefault();
|
||||
const form = e.target.closest('form');
|
||||
await handleRecoverPassword(form);
|
||||
}
|
||||
});
|
||||
// create cleanup registry for this view
|
||||
const cleanupFunctions = [];
|
||||
|
||||
document.getElementById('recover-password-form').addEventListener('submit', async (e) => {
|
||||
e.preventDefault();
|
||||
await handleRecoverPassword(e.target);
|
||||
});
|
||||
|
||||
async function handleRecoverPassword(form) {
|
||||
const txtUsername = form.querySelector('[name="Username"]');
|
||||
const txtTotpCode = form.querySelector('[name="TotpCode"]');
|
||||
const recoverPasswordSuccess = document.getElementById('recover-password-success');
|
||||
const btnRedirectLogin = document.getElementById('btn-redirect-login');
|
||||
const btnLogin = document.getElementById('btn-login');
|
||||
const btnValidateTotp = document.getElementById('btn-validate-totp');
|
||||
const divUsername = document.getElementById('div-username');
|
||||
const divTotpCode = document.getElementById('div-totp-code');
|
||||
const form = document.getElementById('recover-password-form');
|
||||
const txtUsername = form.querySelector('[name="Username"]');
|
||||
const txtTotpCode = form.querySelector('[name="TotpCode"]');
|
||||
const recoverPasswordSuccess = document.getElementById('recover-password-success');
|
||||
const btnRedirectLogin = document.getElementById('btn-redirect-login');
|
||||
const btnLogin = document.getElementById('btn-login');
|
||||
const btnValidateTotp = document.getElementById('btn-validate-totp');
|
||||
const divUsername = document.getElementById('div-username');
|
||||
const divTotpCode = document.getElementById('div-totp-code');
|
||||
|
||||
// perform the password recovery
|
||||
async function handleRecoverPasswordAsync() {
|
||||
const formData = {
|
||||
Username: txtUsername.value,
|
||||
TotpCode: txtTotpCode.value
|
||||
@@ -95,11 +87,51 @@
|
||||
recoverPasswordSuccess.classList.replace('hidden', 'block');
|
||||
}
|
||||
}
|
||||
document.getElementById('btn-login').addEventListener('click', () => {
|
||||
|
||||
// on Enter key pressed
|
||||
const handleEnterKey = async function(e) {
|
||||
if (e.key === 'Enter') {
|
||||
e.preventDefault();
|
||||
await handleRecoverPasswordAsync();
|
||||
}
|
||||
};
|
||||
|
||||
// on form submit event
|
||||
const handleSubmit = async function(e) {
|
||||
e.preventDefault();
|
||||
await handleRecoverPasswordAsync();
|
||||
};
|
||||
|
||||
// on login button click
|
||||
const handleBtnLoginClick = function() {
|
||||
window.location.href = '@_urlService.GetAbsoluteUrl("Login", "Auth")';
|
||||
});
|
||||
document.getElementById('btn-redirect-login').addEventListener('click', () => {
|
||||
};
|
||||
|
||||
// on login redirect button click
|
||||
const handleBtnRedirectLoginClick = function() {
|
||||
window.location.href = '@_urlService.GetAbsoluteUrl("Login", "Auth")';
|
||||
};
|
||||
|
||||
// add listeners
|
||||
form.addEventListener('keypress', handleEnterKey);
|
||||
form.addEventListener('submit', handleSubmit);
|
||||
btnLogin.addEventListener('click', handleBtnLoginClick);
|
||||
btnRedirectLogin.addEventListener('click', handleBtnRedirectLoginClick);
|
||||
|
||||
// register cleanup for these listeners
|
||||
cleanupFunctions.push(() => {
|
||||
form.removeEventListener('keypress', handleEnterKey);
|
||||
form.removeEventListener('submit', handleSubmit);
|
||||
btnLogin.removeEventListener('click', handleBtnLoginClick);
|
||||
btnRedirectLogin.removeEventListener('click', handleBtnRedirectLoginClick);
|
||||
});
|
||||
|
||||
// store all cleanups for this view on window object using the scriptId
|
||||
window.viewCleanups = window.viewCleanups || {};
|
||||
window.viewCleanups['@scriptId'] = () => {
|
||||
cleanupFunctions.forEach(cleanup => cleanup());
|
||||
console.log(`Unloaded @scriptId`);
|
||||
};
|
||||
console.log(`Loaded @scriptId`);
|
||||
</script>
|
||||
}
|
||||
@@ -99,28 +99,23 @@
|
||||
</div>
|
||||
@section Scripts {
|
||||
<script type="text/javascript" data-form="@scriptId" defer>
|
||||
// create cleanup registry for this view
|
||||
const cleanupFunctions = [];
|
||||
|
||||
const form = document.getElementById('register-account-form');
|
||||
const txtUsername = form.querySelector('[name="Username"]');
|
||||
const txtPassword = form.querySelector('[name="Password"]');
|
||||
const txtPasswordConfirm = form.querySelector('[name="PasswordConfirm"]');
|
||||
const chkUse2FA = form.querySelector('[name="Use2fa"]');
|
||||
const registerSuccess = document.getElementById('register-success');
|
||||
const totpMessage = document.querySelector('#totp-message');
|
||||
const totpImage = document.querySelector('#totp-image');
|
||||
const btnLogin = document.getElementById('btn-login');
|
||||
document.getElementById('register-account-form').addEventListener('keypress', async (e) => {
|
||||
if (e.key === 'Enter') {
|
||||
e.preventDefault();
|
||||
const form = e.target.closest('form');
|
||||
await handleRegisterAccount(form);
|
||||
}
|
||||
});
|
||||
const spnTwoFaAttention = document.getElementById('register-two-fa-attention');
|
||||
const useTwoFaInput = document.getElementById('hidden-use-two-fa');
|
||||
|
||||
document.getElementById('register-account-form').addEventListener('submit', async (e) => {
|
||||
e.preventDefault();
|
||||
await handleRegisterAccount(e.target);
|
||||
});
|
||||
|
||||
async function handleRegisterAccount(form) {
|
||||
const txtUsername = form.querySelector('[name="Username"]');
|
||||
const txtPassword = form.querySelector('[name="Password"]');
|
||||
const txtPasswordConfirm = form.querySelector('[name="PasswordConfirm"]');
|
||||
const chkUse2FA = form.querySelector('[name="Use2fa"]');
|
||||
const registerSuccess = document.getElementById('register-success');
|
||||
const totpMessage = document.querySelector('#totp-message');
|
||||
const totpImage = document.querySelector('#totp-image');
|
||||
// perform the account registration
|
||||
async function handleRegisterAccountAsync() {
|
||||
const formData = {
|
||||
Username: txtUsername.value,
|
||||
Password: txtPassword.value,
|
||||
@@ -147,18 +142,56 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
document.querySelector('[name="Use2fa"]').addEventListener('change', function () {
|
||||
|
||||
// on Enter key pressed
|
||||
const handleEnterKey = async function(e) {
|
||||
if (e.key === 'Enter') {
|
||||
e.preventDefault();
|
||||
await handleRegisterAccountAsync();
|
||||
}
|
||||
};
|
||||
|
||||
// on form submit event
|
||||
const handleSubmit = async function(e) {
|
||||
e.preventDefault();
|
||||
await handleRegisterAccountAsync();
|
||||
};
|
||||
|
||||
// on use 2FA change event
|
||||
const handleChkUse2FAChange = function() {
|
||||
const isChecked = this.checked;
|
||||
document.getElementById('register-two-fa-attention').classList.replace(
|
||||
spnTwoFaAttention.classList.replace(
|
||||
isChecked ? 'inline' : 'hidden',
|
||||
isChecked ? 'hidden' : 'inline'
|
||||
);
|
||||
document.getElementById('hidden-use-two-fa').value = isChecked.toString();
|
||||
useTwoFaInput.value = isChecked.toString();
|
||||
};
|
||||
|
||||
// on login button click
|
||||
const handleBtnLoginClick = function() {
|
||||
window.location.href = '@_urlService.GetAbsoluteUrl("Login", "Auth")';
|
||||
};
|
||||
|
||||
// add listeners
|
||||
form.addEventListener('keypress', handleEnterKey);
|
||||
form.addEventListener('submit', handleSubmit);
|
||||
chkUse2FA.addEventListener('click', handleChkUse2FAChange);
|
||||
btnLogin.addEventListener('click', handleBtnLoginClick);
|
||||
|
||||
// register cleanup for these listeners
|
||||
cleanupFunctions.push(() => {
|
||||
form.removeEventListener('keypress', handleEnterKey);
|
||||
form.removeEventListener('submit', handleSubmit);
|
||||
chkUse2FA.removeEventListener('click', handleChkUse2FAChange);
|
||||
btnLogin.removeEventListener('click', handleBtnLoginClick);
|
||||
});
|
||||
if (btnLogin) {
|
||||
btnLogin.addEventListener('click', () => {
|
||||
window.location.href = '@_urlService.GetAbsoluteUrl("Login", "Auth")';
|
||||
});
|
||||
}
|
||||
|
||||
// store all cleanups for this view on window object using the scriptId
|
||||
window.viewCleanups = window.viewCleanups || {};
|
||||
window.viewCleanups['@scriptId'] = () => {
|
||||
cleanupFunctions.forEach(cleanup => cleanup());
|
||||
console.log(`Unloaded @scriptId`);
|
||||
};
|
||||
console.log(`Loaded @scriptId`);
|
||||
</script>
|
||||
}
|
||||
@@ -138,24 +138,18 @@
|
||||
</div>
|
||||
@section Scripts {
|
||||
<script type="text/javascript" data-form="@scriptId" defer>
|
||||
// create cleanup registry for this view
|
||||
const cleanupFunctions = [];
|
||||
|
||||
const saveSuccess = document.getElementById('save-success');
|
||||
const btnBackToLibraries = document.getElementById('btn-back-to-libraries');
|
||||
const btnAddNewLibrary = document.getElementById('btn-add-new-library');
|
||||
const form = document.getElementById('add-media-library-form');
|
||||
const imgAddMediaDirectory = document.getElementById('add-media-directory');
|
||||
const formTable = document.querySelector('.form-table');
|
||||
|
||||
form.addEventListener('keypress', async (e) => {
|
||||
if (e.key === 'Enter') {
|
||||
e.preventDefault();
|
||||
await handleAddMediaLibrary(e.target.closest('form'));
|
||||
}
|
||||
});
|
||||
|
||||
form.addEventListener('submit', async (e) => {
|
||||
e.preventDefault();
|
||||
await handleAddMediaLibrary(e.target);
|
||||
});
|
||||
|
||||
async function handleAddMediaLibrary(form) {
|
||||
// create new or update existing media library
|
||||
async function handleAddMediaLibraryAsync() {
|
||||
const formData = {
|
||||
Id: form.querySelector('[name="Id"]').value || null,
|
||||
UserId: form.querySelector('[name="UserId"]').value || null,
|
||||
@@ -173,25 +167,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
btnBackToLibraries.addEventListener('click', () => {
|
||||
window.location.href = '@_urlService.GetAbsoluteUrl("Index", "LibraryManagement")';
|
||||
});
|
||||
|
||||
btnAddNewLibrary.addEventListener('click', () => {
|
||||
window.location.href = '@_urlService.GetAbsoluteUrl("EditLibrary", "LibraryManagement")';
|
||||
});
|
||||
|
||||
document.getElementById('add-media-directory').addEventListener('click', function () {
|
||||
showFileSystemBrowserDialogAsync('C:\\Users\\', true, false, addNewPaths); // TODO: take path and include hidden elements from settings
|
||||
});
|
||||
|
||||
document.querySelectorAll('.remove-form-table-row-icon').forEach(icon => {
|
||||
icon.addEventListener('click', function () {
|
||||
this.parentElement.remove();
|
||||
});
|
||||
});
|
||||
|
||||
function addNewPaths(selectedPaths) {
|
||||
function addNewFileSystemPaths(selectedPaths) {
|
||||
// get the form table where the new paths will be added
|
||||
const formTable = document.querySelector('.form-table');
|
||||
// process the selected paths
|
||||
@@ -210,5 +186,66 @@
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// on Enter key pressed
|
||||
const handleEnterKey = async function(e) {
|
||||
if (e.key === 'Enter') {
|
||||
e.preventDefault();
|
||||
await handleAddMediaLibraryAsync();
|
||||
}
|
||||
};
|
||||
|
||||
// on form submit event
|
||||
const handleSubmit = async function(e) {
|
||||
e.preventDefault();
|
||||
await handleAddMediaLibraryAsync();
|
||||
};
|
||||
|
||||
// on back to libraries button click
|
||||
const handleBtnBackToLibrariesClick = function() {
|
||||
window.location.href = '@_urlService.GetAbsoluteUrl("Index", "LibraryManagement")';
|
||||
};
|
||||
|
||||
// on add new library button click
|
||||
const handleBtnAddNewLibraryClick = function() {
|
||||
window.location.href = '@_urlService.GetAbsoluteUrl("EditLibrary", "LibraryManagement")';
|
||||
};
|
||||
|
||||
// on add media directory image click
|
||||
const handleImgAddMediaDirectoryClick = async function() {
|
||||
await showFileSystemBrowserDialogAsync('C:\\Users\\', true, false, addNewFileSystemPaths); // TODO: take path and include hidden elements from settings
|
||||
};
|
||||
|
||||
// on remove row icon click
|
||||
const handleRowRemoval = (e) => {
|
||||
if (e.target.matches('.remove-form-table-row-icon'))
|
||||
e.target.parentElement.remove();
|
||||
};
|
||||
|
||||
// add listeners
|
||||
form.addEventListener('keypress', handleEnterKey);
|
||||
form.addEventListener('submit', handleSubmit);
|
||||
btnBackToLibraries.addEventListener('click', handleBtnBackToLibrariesClick);
|
||||
btnAddNewLibrary.addEventListener('click', handleBtnAddNewLibraryClick);
|
||||
imgAddMediaDirectory.addEventListener('click', handleImgAddMediaDirectoryClick);
|
||||
formTable.addEventListener('click', handleRowRemoval);
|
||||
|
||||
// register cleanup for these listeners
|
||||
cleanupFunctions.push(() => {
|
||||
form.removeEventListener('keypress', handleEnterKey);
|
||||
form.removeEventListener('submit', handleSubmit);
|
||||
btnBackToLibraries.removeEventListener('click', handleBtnBackToLibrariesClick);
|
||||
btnAddNewLibrary.removeEventListener('click', handleBtnAddNewLibraryClick);
|
||||
imgAddMediaDirectory.removeEventListener('click', handleImgAddMediaDirectoryClick);
|
||||
formTable.removeEventListener('click', handleRowRemoval);
|
||||
});
|
||||
|
||||
// store all cleanups for this view on window object using the scriptId
|
||||
window.viewCleanups = window.viewCleanups || {};
|
||||
window.viewCleanups['@scriptId'] = () => {
|
||||
cleanupFunctions.forEach(cleanup => cleanup());
|
||||
console.log(`Unloaded @scriptId`);
|
||||
};
|
||||
console.log(`Loaded @scriptId`);
|
||||
</script>
|
||||
}
|
||||
+24
-10
@@ -4,11 +4,16 @@
|
||||
@using Lumina.Presentation.Web.Common.Enums.Notifications
|
||||
@using Lumina.Presentation.Web.Common.Exceptions
|
||||
@using Lumina.Presentation.Web.Common.Models.FileSystemManagement
|
||||
@using Lumina.Presentation.Web.Common.Services
|
||||
@using Microsoft.AspNetCore.Mvc.Localization
|
||||
@using Microsoft.AspNetCore.Components
|
||||
@using System.Text.Json
|
||||
@using System.Text
|
||||
|
||||
@{
|
||||
var componentScriptId = ScriptIdentifierHelper.GenerateScriptId();
|
||||
}
|
||||
|
||||
@inject IViewLocalizer _localizer
|
||||
|
||||
<div id="file-system-browser-dialog" class="container-background above-modal">
|
||||
@@ -522,14 +527,23 @@
|
||||
</div>
|
||||
<div id="visible-selection-rectangle"></div>
|
||||
<div id="selection-rectangle"></div>
|
||||
<script defer src="~/js/file-system-browser-dialog.js" asp-append-version="true"></script>
|
||||
<script defer>
|
||||
document.addEventListener('DOMContentLoaded', async function () {
|
||||
await initFileSystemBrowser(
|
||||
'@Model.ServerBasePath',
|
||||
'@Model.ClientBasePath',
|
||||
'@Model.Path.Replace(@"\", @"\\")',
|
||||
'@Model.ViewMode.ToString().ToLower()',
|
||||
'@Model.IconSize.ToString().ToLower()');
|
||||
});
|
||||
<script defer src="~/js/file-system-browser-dialog.js" data-component-script="file-system-browser"></script>
|
||||
<script defer data-component-init="file-system-browser">
|
||||
// this outer function executes immediately and creates a scope for the variables
|
||||
(function() {
|
||||
// this inner function contains the actual initialization code that needs to run
|
||||
async function checkAndInit() {
|
||||
if (typeof initFileSystemBrowser === 'undefined' || typeof callApiGetAsync === 'undefined') {
|
||||
setTimeout(checkAndInit, 10);
|
||||
return;
|
||||
}
|
||||
await initFileSystemBrowser(
|
||||
'@Model.ServerBasePath',
|
||||
'@Model.ClientBasePath',
|
||||
'@Model.Path.Replace(@"\", @"\\")',
|
||||
'@Model.ViewMode.ToString().ToLower()',
|
||||
'@Model.IconSize.ToString().ToLower()');
|
||||
}
|
||||
checkAndInit().catch(error => console.error('Failed to initialize file system browser:', error));
|
||||
})();
|
||||
</script>
|
||||
@@ -29,6 +29,7 @@
|
||||
<article class="h-100"> <!--needs to be 100% height so that child pages that require full height as well, can stretch-->
|
||||
@RenderBody()
|
||||
<div id="modal-background-article"></div>
|
||||
<div class="dialog-container"></div>
|
||||
</article>
|
||||
</main>
|
||||
@if (User?.Identity?.IsAuthenticated == true)
|
||||
|
||||
@@ -47,12 +47,6 @@ class DialogService {
|
||||
constructor() {
|
||||
this.dialogQueue = [];
|
||||
this.isDialogOpen = false;
|
||||
|
||||
// create dialog container inside the article element
|
||||
const articleElement = document.querySelector('article');
|
||||
this.container = document.createElement('div');
|
||||
this.container.className = 'dialog-container';
|
||||
articleElement.appendChild(this.container);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -104,7 +98,7 @@ class DialogService {
|
||||
displayDialog(dialog) {
|
||||
const modalBackground = document.getElementById('modal-background-article');
|
||||
modalBackground.style.display = 'block';
|
||||
this.container.style.display = 'block';
|
||||
document.querySelector('.dialog-container').style.display = 'block';
|
||||
const dialogElement = document.createElement('div');
|
||||
dialogElement.className = 'dialog';
|
||||
|
||||
@@ -164,7 +158,7 @@ class DialogService {
|
||||
};
|
||||
document.addEventListener('keydown', keyHandler);
|
||||
|
||||
this.container.appendChild(dialogElement);
|
||||
document.querySelector('.dialog-container').appendChild(dialogElement);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -174,7 +168,7 @@ class DialogService {
|
||||
*/
|
||||
handleButtonClick(buttonType) {
|
||||
const currentDialog = this.dialogQueue.shift();
|
||||
const dialogElement = this.container.querySelector('.dialog');
|
||||
const dialogElement = document.querySelector('.dialog-container').querySelector('.dialog');
|
||||
|
||||
if (dialogElement)
|
||||
dialogElement.remove();
|
||||
@@ -182,7 +176,7 @@ class DialogService {
|
||||
if (this.dialogQueue.length === 0) {
|
||||
const modalBackground = document.getElementById('modal-background-article');
|
||||
modalBackground.style.display = 'none';
|
||||
this.container.style.display = 'none';
|
||||
document.querySelector('.dialog-container').style.display = 'none';
|
||||
}
|
||||
|
||||
currentDialog.resolve(buttonType);
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -219,7 +219,7 @@ function initializeNavigation() {
|
||||
bindNavigationLinks();
|
||||
|
||||
// handle browser back/forward
|
||||
window.addEventListener('popstate', handlePopState);
|
||||
window.addEventListener('popstate', handlePopStateAsync);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -229,7 +229,7 @@ function bindNavigationLinks() {
|
||||
document.querySelectorAll('.nav-link').forEach(link => {
|
||||
// only bind if not already bound
|
||||
if (!link.dataset.boundNavigation) {
|
||||
link.addEventListener('click', handleNavigation);
|
||||
link.addEventListener('click', handleNavigationAsync);
|
||||
link.dataset.boundNavigation = 'true';
|
||||
}
|
||||
});
|
||||
@@ -239,17 +239,17 @@ function bindNavigationLinks() {
|
||||
* Handles link clicks to navigate dynamically without reloading the page.
|
||||
* @param {Event} e - The click event for a navigation link.
|
||||
*/
|
||||
async function handleNavigation(e) {
|
||||
async function handleNavigationAsync(e) {
|
||||
e.preventDefault();
|
||||
const url = e.target.href;
|
||||
await updateContent(url, true);
|
||||
await updateContentAsync(url, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Restores page content and title when navigating with browser back/forward buttons.
|
||||
* @param {PopStateEvent} e - The popstate event with previous state data.
|
||||
*/
|
||||
async function handlePopState(e) {
|
||||
async function handlePopStateAsync(e) {
|
||||
if (e.state) {
|
||||
// if we have cached content in state, use it immediately
|
||||
if (e.state.content) {
|
||||
@@ -257,7 +257,7 @@ async function handlePopState(e) {
|
||||
document.title = e.state.title;
|
||||
}
|
||||
// still fetch fresh content to ensure it's up to date
|
||||
await updateContent(e.state.url, false);
|
||||
await updateContentAsync(e.state.url, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -266,8 +266,18 @@ async function handlePopState(e) {
|
||||
* @param {string} url - URL to fetch new content from.
|
||||
* @param {boolean} addToHistory - Whether to add the new state to history.
|
||||
*/
|
||||
async function updateContent(url, addToHistory) {
|
||||
async function updateContentAsync(url, addToHistory) {
|
||||
try {
|
||||
// first, run cleanup of current view's scripts (unsubscribes handlers in the currently displayed razor views' script section, so it can be properly unloaded)
|
||||
if (window.viewCleanups) {
|
||||
Object.values(window.viewCleanups).forEach(cleanup => {
|
||||
if (typeof cleanup === 'function')
|
||||
cleanup();
|
||||
});
|
||||
// reset cleanups object
|
||||
window.viewCleanups = {};
|
||||
}
|
||||
|
||||
const response = await fetch(url);
|
||||
const html = await response.text();
|
||||
|
||||
@@ -277,81 +287,96 @@ async function updateContent(url, addToHistory) {
|
||||
const content = doc.querySelector('main').innerHTML;
|
||||
const title = doc.querySelector('title')?.textContent || document.title;
|
||||
|
||||
// find scripts section content
|
||||
const scriptsSection = doc.querySelector('[data-section="scripts"]');
|
||||
|
||||
// update the page
|
||||
// update the page content
|
||||
document.querySelector('main').innerHTML = content;
|
||||
document.title = title;
|
||||
|
||||
// handle Scripts section of the loaded view
|
||||
if (scriptsSection) {
|
||||
// get or create scripts container
|
||||
let scriptsContainer = document.querySelector('[data-section="scripts"]');
|
||||
if (!scriptsContainer) {
|
||||
scriptsContainer = document.createElement('div');
|
||||
scriptsContainer.setAttribute('data-section', 'scripts');
|
||||
document.body.appendChild(scriptsContainer);
|
||||
}
|
||||
// process all scripts in order: component scripts first, then view scripts
|
||||
const componentScripts = doc.querySelectorAll('script[data-component-script]');
|
||||
for (const script of componentScripts) {
|
||||
const newScript = document.createElement('script');
|
||||
// copy script attributes
|
||||
Array.from(script.attributes).forEach(attr => {
|
||||
newScript.setAttribute(attr.name, attr.value);
|
||||
});
|
||||
|
||||
// clear existing scripts in container
|
||||
scriptsContainer.innerHTML = '';
|
||||
|
||||
// extract and execute scripts
|
||||
const scriptElements = Array.from(scriptsSection.getElementsByTagName('script'));
|
||||
|
||||
for (const script of scriptElements) {
|
||||
const scriptId = script.getAttribute('data-form');
|
||||
|
||||
// remove existing script with same Id if it exists
|
||||
const existingScript = document.querySelector(`script[data-form="${scriptId}"]`);
|
||||
if (existingScript)
|
||||
existingScript.remove();
|
||||
|
||||
const newScript = document.createElement('script');
|
||||
|
||||
// copy script attributes
|
||||
Array.from(script.attributes).forEach(attr => {
|
||||
newScript.setAttribute(attr.name, attr.value);
|
||||
if (script.src) {
|
||||
// wait for external script to fully load before continuing
|
||||
await new Promise((resolve, reject) => {
|
||||
newScript.onload = resolve;
|
||||
newScript.onerror = reject;
|
||||
document.body.appendChild(newScript);
|
||||
});
|
||||
|
||||
// handle both inline and external scripts
|
||||
if (script.src) {
|
||||
newScript.src = script.src;
|
||||
// wait for external script to load
|
||||
await new Promise((resolve, reject) => {
|
||||
newScript.onload = resolve;
|
||||
newScript.onerror = reject;
|
||||
});
|
||||
} else {
|
||||
// wrap inline scripts in a safety check
|
||||
newScript.textContent = `
|
||||
(function() {
|
||||
const safeGetElement = (id) => document.getElementById(id);
|
||||
const safeAddEventListener = (element, e, handler) => {
|
||||
if (element)
|
||||
element.addEventListener(e, handler);
|
||||
};
|
||||
${script.textContent}
|
||||
})();
|
||||
`;
|
||||
}
|
||||
|
||||
// add script to scripts container
|
||||
scriptsContainer.appendChild(newScript);
|
||||
}
|
||||
}
|
||||
// execute component initialization scripts
|
||||
const componentInits = doc.querySelectorAll('script[data-component-init]');
|
||||
for (const script of componentInits) {
|
||||
const newScript = document.createElement('script');
|
||||
// copy script attributes
|
||||
Array.from(script.attributes).forEach(attr => {
|
||||
newScript.setAttribute(attr.name, attr.value);
|
||||
});
|
||||
newScript.textContent = script.textContent;
|
||||
document.body.appendChild(newScript);
|
||||
}
|
||||
// process view scripts
|
||||
const viewScripts = doc.querySelector('[data-section="scripts"]')?.getElementsByTagName('script') || [];
|
||||
|
||||
// get or create scripts container
|
||||
let scriptsContainer = document.querySelector('[data-section="scripts"]');
|
||||
if (!scriptsContainer) {
|
||||
scriptsContainer = document.createElement('div');
|
||||
scriptsContainer.setAttribute('data-section', 'scripts');
|
||||
document.body.appendChild(scriptsContainer);
|
||||
}
|
||||
// clear existing scripts in container
|
||||
scriptsContainer.innerHTML = '';
|
||||
|
||||
// process view scripts
|
||||
for (const script of viewScripts) {
|
||||
const scriptId = script.getAttribute('data-form');
|
||||
// remove existing script with same Id if it exists
|
||||
const existingScript = document.querySelector(`script[data-form="${scriptId}"]`);
|
||||
if (existingScript)
|
||||
existingScript.remove();
|
||||
|
||||
const newScript = document.createElement('script');
|
||||
// copy script attributes
|
||||
Array.from(script.attributes).forEach(attr => {
|
||||
newScript.setAttribute(attr.name, attr.value);
|
||||
});
|
||||
|
||||
// handle both inline and external scripts
|
||||
if (script.src) {
|
||||
newScript.src = script.src;
|
||||
// wait for external script to load
|
||||
await new Promise((resolve, reject) => {
|
||||
newScript.onload = resolve;
|
||||
newScript.onerror = reject;
|
||||
});
|
||||
} else {
|
||||
// wrap inline scripts in a safety check
|
||||
newScript.textContent = `
|
||||
(function() {
|
||||
const safeGetElement = (id) => document.getElementById(id);
|
||||
const safeAddEventListener = (element, e, handler) => {
|
||||
if (element)
|
||||
element.addEventListener(e, handler);
|
||||
};
|
||||
${script.textContent}
|
||||
})();
|
||||
`;
|
||||
}
|
||||
// add script to scripts container
|
||||
scriptsContainer.appendChild(newScript);
|
||||
}
|
||||
// bind navigation links in the new content
|
||||
bindNavigationLinks();
|
||||
|
||||
// save to history if needed
|
||||
if (addToHistory) {
|
||||
const state = {
|
||||
url: url,
|
||||
content: content,
|
||||
title: title
|
||||
};
|
||||
const state = { url, content, title };
|
||||
history.pushState(state, title, url);
|
||||
}
|
||||
} catch (error) {
|
||||
@@ -360,26 +385,6 @@ async function updateContent(url, addToHistory) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Dynamically loads and executes scripts within the content area once.
|
||||
* @param {HTMLElement} container - The container to scan for scripts.
|
||||
*/
|
||||
function executeScriptsOnce(container) {
|
||||
// Find all script tags inside the container
|
||||
container.querySelectorAll('script').forEach(script => {
|
||||
if (!script.dataset.executed) {
|
||||
const newScript = document.createElement('script');
|
||||
newScript.textContent = script.textContent; // Inline scripts
|
||||
if (script.src) newScript.src = script.src; // External scripts
|
||||
newScript.async = script.async;
|
||||
newScript.defer = script.defer;
|
||||
|
||||
script.dataset.executed = 'true'; // Mark the script as executed
|
||||
document.body.appendChild(newScript);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//+======================================================================================+
|
||||
//| Common Helper Functions |
|
||||
//+======================================================================================+
|
||||
@@ -432,7 +437,7 @@ function updateOperationProgress(completed, total) {
|
||||
* @param {any} blob The blob to convert.
|
||||
* @returns The converted Base64 string.
|
||||
*/
|
||||
async function blobToBase64(blob) {
|
||||
async function blobToBase64Async(blob) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const reader = new FileReader();
|
||||
reader.onloadend = () => resolve(reader.result.split(',')[1]);
|
||||
|
||||
+1
-1
@@ -78,7 +78,7 @@ public class AuthenticatedLuminaApiFactory : LuminaApiFactory, IDisposable
|
||||
Password = _hashService.HashString("TestPass123!"),
|
||||
Libraries = [],
|
||||
UserPermissions = [],
|
||||
UserRoles = [],
|
||||
UserRole = null,
|
||||
CreatedBy = Guid.NewGuid(),
|
||||
CreatedOnUtc = DateTime.UtcNow
|
||||
};
|
||||
|
||||
+1
-1
@@ -120,7 +120,7 @@ public class CheckInitializationEndpointTests : IClassFixture<AuthenticatedLumin
|
||||
Password = new HashService().HashString("TestPass123!"),
|
||||
Libraries = [],
|
||||
UserPermissions = [],
|
||||
UserRoles = [],
|
||||
UserRole = null,
|
||||
CreatedBy = Guid.NewGuid(),
|
||||
CreatedOnUtc = DateTime.UtcNow
|
||||
};
|
||||
|
||||
+1
-1
@@ -214,7 +214,7 @@ public class SetupApplicationEndpointTests : IClassFixture<AuthenticatedLuminaAp
|
||||
Password = new HashService().HashString("TestPass123!"),
|
||||
Libraries = [],
|
||||
UserPermissions = [],
|
||||
UserRoles = [], // TODO: test default role and permissions?
|
||||
UserRole = null, // TODO: test default role and permissions?
|
||||
CreatedBy = Guid.NewGuid(),
|
||||
CreatedOnUtc = DateTime.UtcNow
|
||||
};
|
||||
|
||||
+4
-4
@@ -246,7 +246,7 @@ public class LoginEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory>,
|
||||
Password = _hashService.HashString("TestPass123!"),
|
||||
Libraries = [],
|
||||
UserPermissions = [],
|
||||
UserRoles = [],
|
||||
UserRole = null,
|
||||
CreatedBy = Guid.NewGuid(),
|
||||
CreatedOnUtc = DateTime.UtcNow
|
||||
};
|
||||
@@ -269,7 +269,7 @@ public class LoginEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory>,
|
||||
TotpSecret = _cryptographyService.Encrypt(Convert.ToBase64String(totpSecret)),
|
||||
Libraries = [],
|
||||
UserPermissions = [],
|
||||
UserRoles = [],
|
||||
UserRole = null,
|
||||
CreatedBy = Guid.NewGuid(),
|
||||
CreatedOnUtc = DateTime.UtcNow
|
||||
};
|
||||
@@ -292,7 +292,7 @@ public class LoginEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory>,
|
||||
TempPasswordCreated = DateTime.UtcNow,
|
||||
Libraries = [],
|
||||
UserPermissions = [],
|
||||
UserRoles = [],
|
||||
UserRole = null,
|
||||
CreatedBy = Guid.NewGuid(),
|
||||
CreatedOnUtc = DateTime.UtcNow
|
||||
};
|
||||
@@ -315,7 +315,7 @@ public class LoginEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory>,
|
||||
TempPasswordCreated = DateTime.UtcNow.AddMinutes(-16), // expired (> 15 minutes old)
|
||||
Libraries = [],
|
||||
UserPermissions = [],
|
||||
UserRoles = [],
|
||||
UserRole = null,
|
||||
CreatedBy = Guid.NewGuid(),
|
||||
CreatedOnUtc = DateTime.UtcNow
|
||||
};
|
||||
|
||||
+3
-3
@@ -243,7 +243,7 @@ public class RecoverPasswordEndpointTests : IClassFixture<AuthenticatedLuminaApi
|
||||
TotpSecret = null, // No TOTP configured
|
||||
Libraries = [],
|
||||
UserPermissions = [],
|
||||
UserRoles = [],
|
||||
UserRole = null,
|
||||
CreatedBy = Guid.NewGuid(),
|
||||
CreatedOnUtc = DateTime.UtcNow
|
||||
};
|
||||
@@ -310,7 +310,7 @@ public class RecoverPasswordEndpointTests : IClassFixture<AuthenticatedLuminaApi
|
||||
TotpSecret = _cryptographyService.Encrypt(Convert.ToBase64String(totpSecret)),
|
||||
Libraries = [],
|
||||
UserPermissions = [],
|
||||
UserRoles = [],
|
||||
UserRole = null,
|
||||
CreatedBy = Guid.NewGuid(),
|
||||
CreatedOnUtc = DateTime.UtcNow
|
||||
};
|
||||
@@ -332,7 +332,7 @@ public class RecoverPasswordEndpointTests : IClassFixture<AuthenticatedLuminaApi
|
||||
TotpSecret = null,
|
||||
Libraries = [],
|
||||
UserPermissions = [],
|
||||
UserRoles = [],
|
||||
UserRole = null,
|
||||
CreatedBy = Guid.NewGuid(),
|
||||
CreatedOnUtc = DateTime.UtcNow
|
||||
};
|
||||
|
||||
+1
-1
@@ -192,7 +192,7 @@ public class RegisterEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory
|
||||
Password = new HashService().HashString("TestPass123!"),
|
||||
Libraries = [],
|
||||
UserPermissions = [],
|
||||
UserRoles = [],
|
||||
UserRole = null,
|
||||
CreatedBy = Guid.NewGuid(),
|
||||
CreatedOnUtc = DateTime.UtcNow
|
||||
};
|
||||
|
||||
+26
-14
@@ -73,7 +73,7 @@ public class GetAuthorizationEndpointTests : IClassFixture<AuthenticatedLuminaAp
|
||||
LuminaDbContext dbContext = scope.ServiceProvider.GetRequiredService<LuminaDbContext>();
|
||||
|
||||
UserEntity user = await dbContext.Users
|
||||
.Include(user => user.UserRoles)
|
||||
.Include(user => user.UserRole)
|
||||
.ThenInclude(userRole => userRole.Role)
|
||||
.Include(user => user.UserPermissions)
|
||||
.ThenInclude(userPermission => userPermission.Permission)
|
||||
@@ -93,7 +93,7 @@ public class GetAuthorizationEndpointTests : IClassFixture<AuthenticatedLuminaAp
|
||||
|
||||
result.Should().NotBeNull();
|
||||
result!.UserId.Should().Be(user.Id);
|
||||
result.Roles.Should().Contain("Admin");
|
||||
result.Role.Should().Contain("Admin");
|
||||
result.Permissions.Should().Contain(AuthorizationPermission.CanViewUsers);
|
||||
}
|
||||
|
||||
@@ -164,8 +164,9 @@ public class GetAuthorizationEndpointTests : IClassFixture<AuthenticatedLuminaAp
|
||||
await act.Should().ThrowAsync<TaskCanceledException>();
|
||||
}
|
||||
|
||||
private static async Task<UserEntity> AddRolesAndPermissionsToUser(UserEntity user, LuminaDbContext dbContext)
|
||||
private static async Task<UserEntity> AddRolesAndPermissionsToUser(UserEntity existingUser, LuminaDbContext dbContext)
|
||||
{
|
||||
// create and save role and permission first
|
||||
RoleEntity adminRole = new()
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
@@ -182,6 +183,11 @@ public class GetAuthorizationEndpointTests : IClassFixture<AuthenticatedLuminaAp
|
||||
CreatedBy = Guid.NewGuid()
|
||||
};
|
||||
|
||||
await dbContext.Roles.AddAsync(adminRole);
|
||||
await dbContext.Permissions.AddAsync(viewUsersPermission);
|
||||
await dbContext.SaveChangesAsync();
|
||||
|
||||
// create role permission
|
||||
RolePermissionEntity rolePermission = new()
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
@@ -189,31 +195,37 @@ public class GetAuthorizationEndpointTests : IClassFixture<AuthenticatedLuminaAp
|
||||
PermissionId = viewUsersPermission.Id,
|
||||
Role = adminRole,
|
||||
RoleId = adminRole.Id,
|
||||
CreatedBy = user.Id,
|
||||
CreatedBy = existingUser.Id,
|
||||
CreatedOnUtc = DateTime.UtcNow
|
||||
};
|
||||
await dbContext.RolePermissions.AddAsync(rolePermission);
|
||||
await dbContext.SaveChangesAsync();
|
||||
|
||||
// remove existing user role if any
|
||||
if (existingUser.UserRole != null)
|
||||
dbContext.UserRoles.Remove(existingUser.UserRole);
|
||||
|
||||
// add new user role
|
||||
UserRoleEntity userRole = new()
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
UserId = user.Id,
|
||||
User = user,
|
||||
RoleId = adminRole.Id,
|
||||
User = existingUser,
|
||||
UserId = existingUser.Id,
|
||||
Role = adminRole,
|
||||
RoleId = adminRole.Id,
|
||||
CreatedOnUtc = DateTime.UtcNow,
|
||||
CreatedBy = Guid.NewGuid()
|
||||
};
|
||||
|
||||
|
||||
dbContext.Roles.Add(adminRole);
|
||||
dbContext.Permissions.Add(viewUsersPermission);
|
||||
dbContext.RolePermissions.Add(rolePermission);
|
||||
user.UserRoles.Add(userRole);
|
||||
await dbContext.UserRoles.AddAsync(userRole);
|
||||
await dbContext.SaveChangesAsync();
|
||||
|
||||
return user;
|
||||
// refresh the user entity
|
||||
await dbContext.Entry(existingUser).ReloadAsync();
|
||||
|
||||
return existingUser;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Disposes API factory resources.
|
||||
/// </summary>
|
||||
|
||||
+1
-1
@@ -124,7 +124,7 @@ public class AuthChangePasswordTests : IClassFixture<LuminaApiFactory>, IDisposa
|
||||
Username = _testUsername,
|
||||
Password = _hashService.HashString("TestPass123!"),
|
||||
Libraries = [],
|
||||
UserRoles = [],
|
||||
UserRole = null,
|
||||
UserPermissions = [],
|
||||
CreatedBy = Guid.NewGuid(),
|
||||
CreatedOnUtc = DateTime.UtcNow
|
||||
|
||||
+2
-2
@@ -268,7 +268,7 @@ public class AuthLoginTests : IClassFixture<LuminaApiFactory>, IDisposable
|
||||
Password = _hashService.HashString("TestPass123!"),
|
||||
Libraries = [],
|
||||
UserPermissions = [],
|
||||
UserRoles = [],
|
||||
UserRole = null,
|
||||
CreatedBy = Guid.NewGuid(),
|
||||
CreatedOnUtc = DateTime.UtcNow
|
||||
};
|
||||
@@ -291,7 +291,7 @@ public class AuthLoginTests : IClassFixture<LuminaApiFactory>, IDisposable
|
||||
TotpSecret = _cryptographyService.Encrypt(Convert.ToBase64String(totpSecret)),
|
||||
Libraries = [],
|
||||
UserPermissions = [],
|
||||
UserRoles = [],
|
||||
UserRole = null,
|
||||
CreatedBy = Guid.NewGuid(),
|
||||
CreatedOnUtc = DateTime.UtcNow
|
||||
};
|
||||
|
||||
+1
-1
@@ -224,7 +224,7 @@ public class AuthRegisterTests : IClassFixture<LuminaApiFactory>, IDisposable
|
||||
Password = _hashService.HashString("TestPass123!"),
|
||||
Libraries = [],
|
||||
UserPermissions = [],
|
||||
UserRoles = [],
|
||||
UserRole = null,
|
||||
CreatedBy = Guid.NewGuid(),
|
||||
CreatedOnUtc = DateTime.UtcNow
|
||||
};
|
||||
|
||||
+8
-11
@@ -24,7 +24,7 @@ public class UserAuthorizationEntityMappingTests
|
||||
UserAuthorizationEntity entity = new()
|
||||
{
|
||||
UserId = Guid.NewGuid(),
|
||||
Roles = new HashSet<string> { "Admin" },
|
||||
Role = "Admin",
|
||||
Permissions = new HashSet<AuthorizationPermission> { AuthorizationPermission.CanViewUsers }
|
||||
};
|
||||
|
||||
@@ -34,7 +34,7 @@ public class UserAuthorizationEntityMappingTests
|
||||
// Assert
|
||||
result.Should().NotBeNull();
|
||||
result.UserId.Should().Be(entity.UserId);
|
||||
result.Roles.Should().BeEquivalentTo(entity.Roles);
|
||||
result.Role.Should().BeEquivalentTo(entity.Role);
|
||||
result.Permissions.Should().BeEquivalentTo(entity.Permissions);
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public class UserAuthorizationEntityMappingTests
|
||||
UserAuthorizationEntity entity = new()
|
||||
{
|
||||
UserId = Guid.NewGuid(),
|
||||
Roles = new HashSet<string>(),
|
||||
Role = string.Empty,
|
||||
Permissions = new HashSet<AuthorizationPermission>()
|
||||
};
|
||||
|
||||
@@ -55,7 +55,7 @@ public class UserAuthorizationEntityMappingTests
|
||||
// Assert
|
||||
result.Should().NotBeNull();
|
||||
result.UserId.Should().Be(entity.UserId);
|
||||
result.Roles.Should().BeEmpty();
|
||||
result.Role.Should().BeEmpty();
|
||||
result.Permissions.Should().BeEmpty();
|
||||
}
|
||||
|
||||
@@ -66,10 +66,7 @@ public class UserAuthorizationEntityMappingTests
|
||||
UserAuthorizationEntity entity = new()
|
||||
{
|
||||
UserId = Guid.NewGuid(),
|
||||
Roles = new HashSet<string>
|
||||
{
|
||||
"Admin"
|
||||
},
|
||||
Role = "Admin",
|
||||
Permissions = new HashSet<AuthorizationPermission>
|
||||
{
|
||||
AuthorizationPermission.CanViewUsers,
|
||||
@@ -84,7 +81,7 @@ public class UserAuthorizationEntityMappingTests
|
||||
// Assert
|
||||
result.Should().NotBeNull();
|
||||
result.UserId.Should().Be(entity.UserId);
|
||||
result.Roles.Should().BeEquivalentTo(entity.Roles);
|
||||
result.Role.Should().BeEquivalentTo(entity.Role);
|
||||
result.Permissions.Should().BeEquivalentTo(entity.Permissions);
|
||||
}
|
||||
|
||||
@@ -98,7 +95,7 @@ public class UserAuthorizationEntityMappingTests
|
||||
UserAuthorizationEntity entity = new()
|
||||
{
|
||||
UserId = Guid.Parse(userIdString),
|
||||
Roles = new HashSet<string> { "Admin" },
|
||||
Role = "Admin",
|
||||
Permissions = new HashSet<AuthorizationPermission> { AuthorizationPermission.CanViewUsers }
|
||||
};
|
||||
|
||||
@@ -108,7 +105,7 @@ public class UserAuthorizationEntityMappingTests
|
||||
// Assert
|
||||
result.Should().NotBeNull();
|
||||
result.UserId.Should().Be(entity.UserId);
|
||||
result.Roles.Should().BeEquivalentTo(entity.Roles);
|
||||
result.Role.Should().BeEquivalentTo(entity.Role);
|
||||
result.Permissions.Should().BeEquivalentTo(entity.Permissions);
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -48,7 +48,7 @@ public class UserEntityFixture
|
||||
TotpSecret = default,
|
||||
Libraries = libraries,
|
||||
UserPermissions = [],
|
||||
UserRoles = [],
|
||||
UserRole = null,
|
||||
CreatedBy = userId
|
||||
})
|
||||
.RuleFor(x => x.Username, f => f.Internet.UserName())
|
||||
|
||||
+4
-4
@@ -38,7 +38,7 @@ public class UserMappingTests
|
||||
TotpSecret = "totpsecret",
|
||||
Libraries = [],
|
||||
UserPermissions = [],
|
||||
UserRoles = [],
|
||||
UserRole = null,
|
||||
CreatedBy = Guid.NewGuid(),
|
||||
CreatedOnUtc = DateTime.UtcNow,
|
||||
UpdatedOnUtc = null
|
||||
@@ -58,7 +58,7 @@ public class UserMappingTests
|
||||
result.TotpSecret.Should().Be(repositoryEntity.TotpSecret);
|
||||
result.Libraries.Should().BeSameAs(repositoryEntity.Libraries);
|
||||
result.UserPermissions.Should().BeSameAs(repositoryEntity.UserPermissions);
|
||||
result.UserRoles.Should().BeSameAs(repositoryEntity.UserRoles);
|
||||
result.UserRole.Should().BeSameAs(repositoryEntity.UserRole);
|
||||
result.CreatedOnUtc.Should().Be(repositoryEntity.CreatedOnUtc);
|
||||
result.CreatedBy.Should().Be(repositoryEntity.CreatedBy);
|
||||
result.UpdatedOnUtc.Should().Be(repositoryEntity.UpdatedOnUtc);
|
||||
@@ -85,7 +85,7 @@ public class UserMappingTests
|
||||
Password = "hashedpassword",
|
||||
Libraries = [],
|
||||
UserPermissions = [],
|
||||
UserRoles = [],
|
||||
UserRole = null,
|
||||
CreatedBy = Guid.NewGuid(),
|
||||
CreatedOnUtc = DateTime.UtcNow,
|
||||
UpdatedOnUtc = null
|
||||
@@ -139,7 +139,7 @@ public class UserMappingTests
|
||||
Password = "hashedpassword",
|
||||
Libraries = libraries,
|
||||
UserPermissions = [],
|
||||
UserRoles = [],
|
||||
UserRole = null,
|
||||
CreatedBy = Guid.NewGuid(),
|
||||
CreatedOnUtc = DateTime.UtcNow,
|
||||
UpdatedOnUtc = null
|
||||
|
||||
Loaded 100 of 106 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user