You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Connected.Common/Common/Security/Identity/RoleService.cs

58 lines
1.5 KiB

2 years ago
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);
}
}