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.

27 lines
787 B

3 years ago
using Easy.DDD.Application;
using Easy.Result;
using Identity.Api.Clean.Contracts.Inputs;
using Identity.Api.Clean.Shared.IServices;
namespace Identity.Api.Clean.Application;
public class PermissionAppService : ApiService
{
private IPermissionGrantManager PermissionGrantManager { get; }
public PermissionAppService(IPermissionGrantManager permissionGrantManager)
{
PermissionGrantManager = permissionGrantManager;
}
public async Task<ApiResult> UpdateAsync(UpdatePermissionsInput input)
{
foreach (var permission in input.Permissions)
{
await PermissionGrantManager.SetAsync(permission.PermissionName, input.ProviderName, input.ProviderKey, permission.IsGranted);
}
return ApiResult.Success();
}
}