|
|
|
|
using System.Collections.Immutable;
|
|
|
|
|
using Connected.Security;
|
|
|
|
|
using Connected.Security.Identity;
|
|
|
|
|
using Connected.ServiceModel;
|
|
|
|
|
using Connected.Services;
|
|
|
|
|
using Connected.Services.Annotations;
|
|
|
|
|
|
|
|
|
|
namespace Common.Security.Identity;
|
|
|
|
|
|
|
|
|
|
internal class RoleService : EntityService<int>, IRoleService
|
|
|
|
|
{
|
|
|
|
|
public RoleService(IContext context) : base(context)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[ServiceAuthorization(SecurityClaims.SecurityDelete)]
|
|
|
|
|
public async Task Delete(PrimaryKeyArgs<int> args)
|
|
|
|
|
{
|
|
|
|
|
await Invoke(GetOperation<DeleteRole>(), args);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[ServiceAuthorization(SecurityClaims.SecurityAdd)]
|
|
|
|
|
public async Task<int> Insert(RoleArgs args)
|
|
|
|
|
{
|
|
|
|
|
return await Invoke(GetOperation<InsertRole>(), args);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[ServiceAuthorization(SecurityClaims.SecurityRead)]
|
|
|
|
|
public async Task<ImmutableList<IRole>?> Query()
|
|
|
|
|
{
|
|
|
|
|
return await Invoke(GetOperation<QueryRoles>(), Dto.Empty);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[ServiceAuthorization(SecurityClaims.SecurityRead)]
|
|
|
|
|
public async Task<ImmutableList<IRole>?> Query(PrimaryKeyListArgs<int> args)
|
|
|
|
|
{
|
|
|
|
|
return await Invoke(GetOperation<LookupRoles>(), args);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[ServiceAuthorization(SecurityClaims.SecurityRead)]
|
|
|
|
|
public async Task<IRole?> Select(PrimaryKeyArgs<int> args)
|
|
|
|
|
{
|
|
|
|
|
return await Invoke(GetOperation<SelectRole>(), args);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[ServiceAuthorization(SecurityClaims.SecurityRead)]
|
|
|
|
|
public async Task<IRole?> Select(NameArgs args)
|
|
|
|
|
{
|
|
|
|
|
return await Invoke(GetOperation<SelectRoleByName>(), args);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[ServiceAuthorization(SecurityClaims.SecurityModify)]
|
|
|
|
|
public async Task Update(RoleUpdateArgs args)
|
|
|
|
|
{
|
|
|
|
|
await Invoke(GetOperation<UpdateRole>(), args);
|
|
|
|
|
}
|
|
|
|
|
}
|