public async Task <IActionResult> GetResourcePermissions(string id, CancellationToken cancellationToken)
        {
            var umaResource = await _umaResourceRepository.FindByIdentifier(id, cancellationToken);

            if (umaResource == null)
            {
                return(this.BuildError(HttpStatusCode.NotFound, UMAErrorCodes.NOT_FOUND));
            }

            return(new OkObjectResult(ResourcesAPIController.Serialize(umaResource.Permissions)));
        }
        public static JObject Serialize(UMAPendingRequest umaPendingRequest)
        {
            var result = new JObject
            {
                { "requester", umaPendingRequest.Requester },
                { "owner", umaPendingRequest.Owner },
                { "create_datetime", umaPendingRequest.CreateDateTime },
                { "ticket", umaPendingRequest.TicketId },
                { "scopes", new JArray(umaPendingRequest.Scopes) },
                { "status", umaPendingRequest.Status.ToString().ToLowerInvariant() },
                { "resource", ResourcesAPIController.Serialize(umaPendingRequest.Resource) }
            };

            return(result);
        }
        public async Task <IActionResult> SearchResources(CancellationToken cancellationToken)
        {
            var searchUMAResourceParameter = new SearchUMAResourceParameter();

            EnrichSearchRequestParameter(searchUMAResourceParameter);
            var searchResult = await _umaResourceRepository.Find(searchUMAResourceParameter, cancellationToken);

            var result = new JObject
            {
                { "totalResults", searchResult.TotalResults },
                { "count", searchUMAResourceParameter.Count },
                { "startIndex", searchUMAResourceParameter.StartIndex },
                { "data", new JArray(searchResult.Records.Select(rec => ResourcesAPIController.Serialize(rec))) }
            };

            return(new OkObjectResult(result));
        }