Esempio n. 1
0
        public void Delete(string id)
        {
            RuleId ruleId = new RuleId(id);

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

            if (ruleId.SiteId != null && site == null)
            {
                Context.Response.StatusCode = (int)HttpStatusCode.NoContent;
                return;
            }

            Rule rule = AuthorizationHelper.GetRule(site, ruleId.Path, ruleId.Users, ruleId.Roles, ruleId.Verbs);

            if (rule != null)
            {
                var section = AuthorizationHelper.GetSection(site, ruleId.Path, ManagementUnit.ResolveConfigScope());

                AuthorizationHelper.DeleteRule(rule, section);
                ManagementUnit.Current.Commit();
            }

            Context.Response.StatusCode = (int)HttpStatusCode.NoContent;
            return;
        }