Ejemplo n.º 1
0
        private static async void CheckPermission(string userAlias, string action, string resourceType, Guid resourceId)
        {
            var client  = new UserService.UserServiceClient(channel);
            var request = new PermissionCheckRequest()
            {
                UserName     = userAlias,
                Action       = action,
                ResourceType = resourceType,
                ResourceId   = resourceId
            };

            var response = await client.HasPermissionAsync(request);

            var result = response.Payload.Deserialize();

            logger.LogInformation($"Permission check for user '{userAlias}' request '{action}' on resource '{resourceType}':'{resourceId}' is: '{result.HasPermission}'");
        }