public object Get()
        {
            // Check if the scope of the request is for site or application
            Site   site = ApplicationHelper.ResolveSite();
            string path = ApplicationHelper.ResolvePath();

            return(WindowsAuthenticationHelper.ToJsonModel(site, path));
        }
        public object Get(string id)
        {
            WinAuthId winAuthId = new WinAuthId(id);

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

            return(WindowsAuthenticationHelper.ToJsonModel(site, winAuthId.Path));
        }
Exemple #3
0
        public async Task <object> Post()
        {
            if (WindowsAuthenticationHelper.IsFeatureEnabled())
            {
                throw new AlreadyExistsException(WindowsAuthenticationHelper.FEATURE_NAME);
            }

            await WindowsAuthenticationHelper.SetFeatureEnabled(true);

            dynamic auth = WindowsAuthenticationHelper.ToJsonModel(null, null);

            return(Created(WindowsAuthenticationHelper.GetLocation(auth.id), auth));
        }
        public object Patch(string id, [FromBody] dynamic model)
        {
            WinAuthId winAuthId = new WinAuthId(id);

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

            // Targetting section for a site, but unable to find that site
            if (winAuthId.SiteId != null && site == null)
            {
                return(NotFound());
            }

            string configPath = model == null ? null : ManagementUnit.ResolveConfigScope(model);

            WindowsAuthenticationHelper.UpdateSettings(model, site, winAuthId.Path, configPath);

            ManagementUnit.Current.Commit();

            return(WindowsAuthenticationHelper.ToJsonModel(site, winAuthId.Path));
        }