public IEnumerable <ViewDto> ViewUsage(IInstanceContext context, int appId, Guid guid, Func <List <IView>, List <BlockConfiguration>, IEnumerable <ViewDto> > finalBuilder) { var wrapLog = Log.Call <IEnumerable <ViewDto> >($"{appId}, {guid}"); // extra security to only allow zone change if host user var permCheck = new MultiPermissionsApp().Init(context, GetApp(appId, null), Log); if (!permCheck.EnsureAll(GrantSets.ReadSomething, out var error)) { throw HttpException.PermissionDenied(error); } var cms = new CmsRuntime(appId, Log, true); // treat view as a list - in case future code will want to analyze many views together var views = new List <IView> { cms.Views.Get(guid) }; var blocks = cms.Blocks.AllWithView(); Log.Add($"Found {blocks.Count} content blocks"); var result = finalBuilder(views, blocks); return(wrapLog("ok", result)); }
public dynamic Usage(int appId, Guid guid) { var wrapLog = Log.Call <dynamic>($"{appId}, {guid}"); // extra security to only allow zone change if host user var permCheck = new MultiPermissionsApp(BlockBuilder, appId, Log); if (!permCheck.EnsureAll(GrantSets.ReadSomething, out var exception)) { throw exception; } var cms = new CmsRuntime(appId, Log, true); // treat view as a list - in case future code will want to analyze many views together var views = new List <IView> { cms.Views.Get(guid) }; var blocks = cms.Blocks.AllWithView(); Log.Add($"Found {blocks.Count} content blocks"); // create array with all 2sxc modules in this portal var allMods = new Pages(Log).AllModulesWithContent(PortalSettings.PortalId); Log.Add($"Found {allMods.Count} modules"); var result = views.Select(vwb => new ViewDto(vwb, blocks, allMods)); return(wrapLog("ok", result)); }
public Guid?SaveTemplateId(int templateId, bool forceCreateContentGroup) { var permCheck = new MultiPermissionsApp(BlockBuilder, App.AppId, Log); if (!permCheck.EnsureAll(GrantSets.WriteSomething, out var exp)) { throw exp; } return(BlockEditor.SaveTemplateId(templateId, forceCreateContentGroup)); }
public Guid?SaveTemplateId(int templateId, bool forceCreateContentGroup) { var permCheck = new MultiPermissionsApp().Init(_context, _block.App, Log); if (!permCheck.EnsureAll(GrantSets.WriteSomething, out var error)) { throw HttpException.PermissionDenied(error); } return(BlockEditorBase.GetEditor(_block).SaveTemplateId(templateId, forceCreateContentGroup)); }
public Guid?SaveTemplateId(int templateId, bool forceCreateContentGroup) { var permCheck = new MultiPermissionsApp(SxcInstance, App.AppId, Log); if (!permCheck.EnsureAll(GrantSets.WriteSomething, out var exp)) { throw exp; } return(ContentGroupReferenceManager.SaveTemplateId(templateId, forceCreateContentGroup)); }
public dynamic Usage(IInstanceContext context, IApp app, Guid guid) { var permCheck = new MultiPermissionsApp().Init(context, app, Log); if (!permCheck.EnsureAll(GrantSets.ReadSomething, out var error)) { throw HttpException.PermissionDenied(error); } var appData = permCheck.App.Data; var item = appData.List.One(guid); var relationships = item.Relationships.AllRelationships; // var result = relationships.Select(r => new EntityInRelationDto(r.)) // todo: don't forget Metadata relationships return(null); }
public dynamic Usage(int appId, Guid guid) { var permCheck = new MultiPermissionsApp(BlockBuilder, appId, Log); if (!permCheck.EnsureAll(GrantSets.ReadSomething, out var exception)) { throw exception; } var appData = permCheck.App.Data; var item = appData.List.One(guid); var relationships = item.Relationships.AllRelationships; // var result = relationships.Select(r => new EntityInRelationDto(r.)) // todo: don't forget Metadata relationships return(null); }