public async Task <IEnumerable <IPermissionState> > GetAsync(ICriterion filter, IList <string> orders = null, int firstResult = 0, int maxResults = int.MaxValue, IList <string> fields = null)
        {
            IEnumerable <IPermissionState> states = null;
            var q = new PermissionsGetQuery();

            q.FirstResult = firstResult;
            q.MaxResults  = maxResults;
            q.Sort        = PermissionProxyUtils.GetOrdersQueryValueString(orders);
            q.Fields      = PermissionProxyUtils.GetReturnedFieldsQueryValueString(fields, QueryFieldValueSeparator);
            q.Filter      = PermissionProxyUtils.GetFilterQueryValueString(filter);
            var req = new PermissionsGetRequest();

            req.Query = q;
            var resp = await _ramlClient.Permissions.Get(req);

            PermissionProxyUtils.ThrowOnHttpResponseError(resp);
            states = resp.Content;
            return(states);
        }
Beispiel #2
0
        public async Task <IEnumerable <string> > GetChildIdsAsync(string parentId, IEnumerable <KeyValuePair <string, object> > filter, IList <string> orders = null, int firstResult = 0, int maxResults = int.MaxValue, IList <string> fields = null)
        {
            IEnumerable <IPermissionState> states = null;
            var q           = new PermissionTreesGetQuery();
            var parentIdObj = (parentId);

            q.ParentId    = parentIdObj;
            q.FirstResult = firstResult;
            q.MaxResults  = maxResults;
            q.Sort        = PermissionProxyUtils.GetOrdersQueryValueString(orders);
            q.Fields      = PermissionProxyUtils.GetReturnedFieldsQueryValueString(fields, QueryFieldValueSeparator);
            q.FilterTag   = PermissionProxyUtils.GetFilterTagQueryValueString(filter);
            var req = new PermissionTreesGetRequest();

            req.Query = q;
            var resp = await _ramlClient.PermissionTrees.Get(req);

            PermissionProxyUtils.ThrowOnHttpResponseError(resp);
            states = resp.Content;
            return(PermissionProxyUtils.ToIdCollection(states));
        }