public async Task WhenAsync(MergePatchPermissionDto c)
        {
            var idObj         = (c as IMergePatchPermission).PermissionId;
            var uriParameters = new PermissionUriParameters();

            uriParameters.Id = idObj;

            var req  = new PermissionPatchRequest(uriParameters, (MergePatchPermissionDto)c);
            var resp = await _ramlClient.Permission.Patch(req);

            PermissionProxyUtils.ThrowOnHttpResponseError(resp);
        }
        public async virtual Task <long> GetCountAsync(ICriterion filter)
        {
            var q = new PermissionsCountGetQuery();

            q.Filter = PermissionProxyUtils.GetFilterQueryValueString(filter);
            var req = new PermissionsCountGetRequest();

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

            PermissionProxyUtils.ThrowOnHttpResponseError(resp);
            return(long.Parse(await resp.RawContent.ReadAsStringAsync()));
        }
        public async Task <IPermissionStateEvent> GetStateEventAsync(string permissionId, long version)
        {
            var idObj         = permissionId;
            var uriParameters = new PermissionStateEventUriParameters();

            uriParameters.Id      = idObj;
            uriParameters.Version = version.ToString();

            var req  = new PermissionStateEventGetRequest(uriParameters);
            var resp = await _ramlClient.PermissionStateEvent.Get(req);

            PermissionProxyUtils.ThrowOnHttpResponseError(resp);
            return(resp.Content);
        }
        public async Task <IPermissionState> GetAsync(string permissionId)
        {
            IPermissionState state = null;
            var idObj         = permissionId;
            var uriParameters = new PermissionUriParameters();

            uriParameters.Id = idObj;

            var req = new PermissionGetRequest(uriParameters);

            var resp = await _ramlClient.Permission.Get(req);

            PermissionProxyUtils.ThrowOnHttpResponseError(resp);
            state = resp.Content;
            return(state);
        }
        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);
        }
        public async Task WhenAsync(DeletePermissionDto c)
        {
            var idObj         = (c as IDeletePermission).PermissionId;
            var uriParameters = new PermissionUriParameters();

            uriParameters.Id = idObj;

            var q = new PermissionDeleteQuery();

            q.CommandId   = c.CommandId;
            q.RequesterId = c.RequesterId;
            q.Version     = Convert.ToString(c.Version);

            var req = new PermissionDeleteRequest(uriParameters);

            req.Query = q;

            var resp = await _ramlClient.Permission.Delete(req);

            PermissionProxyUtils.ThrowOnHttpResponseError(resp);
        }
Exemplo n.º 7
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));
        }