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.
52 lines
1.5 KiB
52 lines
1.5 KiB
using System.Collections.Immutable;
|
|
using Connected.Security;
|
|
using Connected.Security.Permissions;
|
|
using Connected.ServiceModel;
|
|
using Connected.Services;
|
|
using Connected.Services.Annotations;
|
|
|
|
namespace Common.Security.Permissions;
|
|
|
|
internal class PermissionService : EntityService<int>, IPermissionService
|
|
{
|
|
public PermissionService(IContext context) : base(context)
|
|
{
|
|
}
|
|
|
|
[ServiceAuthorization(SecurityClaims.SecurityDelete)]
|
|
public async Task Delete(PrimaryKeyArgs<int> args)
|
|
{
|
|
await Invoke(GetOperation<DeletePermission>(), args);
|
|
}
|
|
|
|
[ServiceAuthorization(SecurityClaims.SecurityAdd)]
|
|
public async Task<int> Insert(PermissionArgs args)
|
|
{
|
|
return await Invoke(GetOperation<InsertPermission>(), args);
|
|
}
|
|
|
|
[ServiceAuthorization(SecurityClaims.SecurityRead, Stage = AuthorizationStage.Result)]
|
|
public async Task<ImmutableList<IPermission>?> Query()
|
|
{
|
|
return await Invoke(GetOperation<QueryPermissions>(), Dto.Empty);
|
|
}
|
|
|
|
[ServiceAuthorization(SecurityClaims.SecurityRead, Stage = AuthorizationStage.Result)]
|
|
public async Task<ImmutableList<IPermission>?> Query(PermissionSearchArgs args)
|
|
{
|
|
return await Invoke(GetOperation<SearchPermissions>(), args);
|
|
}
|
|
|
|
[ServiceAuthorization(SecurityClaims.SecurityRead, Stage = AuthorizationStage.Result)]
|
|
public async Task<IPermission?> Select(PrimaryKeyArgs<int> args)
|
|
{
|
|
return await Invoke(GetOperation<SelectPermission>(), args);
|
|
}
|
|
|
|
[ServiceAuthorization(SecurityClaims.SecurityModify)]
|
|
public async Task Update(PermissionUpdateArgs args)
|
|
{
|
|
await Invoke(GetOperation<UpdatePermission>(), args);
|
|
}
|
|
}
|