예제 #1
0
        public object Get()
        {
            string authUuid = Context.Request.Query[Defines.AUTHORIZATION_IDENTIFIER];

            if (string.IsNullOrEmpty(authUuid))
            {
                return(NotFound());
            }

            AuthorizationId id = new AuthorizationId(authUuid);

            Site site = id.SiteId == null ? null : SiteHelper.GetSite(id.SiteId.Value);

            List <Rule> rules = AuthorizationHelper.GetRules(site, id.Path);

            // Set HTTP header for total count
            this.Context.Response.SetItemsCount(rules.Count);

            Fields fields = Context.Request.GetFields();

            return(new {
                rules = rules.Select(rule => AuthorizationHelper.RuleToJsonModelRef(rule, site, id.Path, fields))
            });
        }