public object Get(string id) { IPRestrictionId ipId = new IPRestrictionId(id); Site site = ipId.SiteId == null ? null : SiteHelper.GetSite(ipId.SiteId.Value); return(IPRestrictionsHelper.ToJsonModel(site, ipId.Path)); }
public async Task <object> Post() { if (IPRestrictionsHelper.IsFeatureEnabled()) { throw new AlreadyExistsException(IPRestrictionsHelper.FEATURE_NAME); } await IPRestrictionsHelper.SetFeatureEnabled(true); dynamic settings = IPRestrictionsHelper.ToJsonModel(null, null); return(Created(IPRestrictionsHelper.GetLocation(settings.id), settings)); }
public object Get() { // Check if the scope of the request is for site or application Site site = ApplicationHelper.ResolveSite(); string path = ApplicationHelper.ResolvePath(); if (path == null) { return(NotFound()); } dynamic d = IPRestrictionsHelper.ToJsonModel(site, path); return(LocationChanged(IPRestrictionsHelper.GetLocation(d.id), d)); }
public object Patch([FromBody] dynamic model, string id) { IPRestrictionId ipId = new IPRestrictionId(id); Site site = ipId.SiteId == null ? null : SiteHelper.GetSite(ipId.SiteId.Value); if (ipId.SiteId != null && site == null) { return(NotFound()); } string configPath = model == null ? null : ManagementUnit.ResolveConfigScope(model); IPRestrictionsHelper.SetFeatureSettings(model, site, ipId.Path, configPath); ManagementUnit.Current.Commit(); return(IPRestrictionsHelper.ToJsonModel(site, ipId.Path)); }