/// <summary> /// System to extend the known context by more information if we're running inside a block /// </summary> /// <param name="newContext"></param> /// <returns></returns> internal CmsContext Update(IContextOfSite newContext) { Context = newContext; _page = null; _module = null; return(this); }
public void DoInsidePublishing(IContextOfSite context, Action <VersioningActionInfo> action) { var possibleContextOfBlock = context as IContextOfBlock; var enabled = possibleContextOfBlock?.Publishing.ForceDraft ?? false; var instanceId = possibleContextOfBlock?.Module.Id ?? Eav.Constants.IdNotInitialized; var userId = (context.User as DnnUser)?.UnwrappedContents.UserID ?? Eav.Constants.IdNotInitialized; Log.Add($"DoInsidePublishing(module:{instanceId}, user:{userId}, enabled:{enabled})"); if (enabled) { var moduleVersionSettings = new DnnPagePublishing.ModuleVersions(instanceId, Log); // Get an new version number and submit it to DNN // The submission must be made every time something changes, because a "discard" could have happened // in the meantime. TabChangeTracker.Instance.TrackModuleModification( moduleVersionSettings.ModuleInfo, moduleVersionSettings.IncreaseLatestVersion(), userId ); } var versioningActionInfo = new VersioningActionInfo(); action.Invoke(versioningActionInfo); Log.Add("/DoInsidePublishing"); }
public ViewsBackend(Lazy <CmsManager> cmsManagerLazy, IContextOfSite context) : base("Bck.Views") { _cmsManagerLazy = cmsManagerLazy; _site = context.Site; _user = context.User; }
public void DoInsidePublishing(IContextOfSite context, Action <VersioningActionInfo> action) { var wrapLog = Log.Call(); var versioningActionInfo = new VersioningActionInfo(); action.Invoke(versioningActionInfo); wrapLog(null); }
public ViewsExportImport(IServerPaths serverPaths, TemplateHelpers appHelpers, IEnvironmentLogger envLogger, Lazy <CmsManager> cmsManagerLazy, Lazy <JsonBundleSerializer> jsonBundleLazy, IContextOfSite context) : base("Bck.Views") { _serverPaths = serverPaths; _appHelpers = appHelpers; _envLogger = envLogger; _cmsManagerLazy = cmsManagerLazy; _jsonBundleLazy = jsonBundleLazy; _site = context.Site; _user = context.User; }
private Dictionary <string, IEnumerable <Dictionary <string, object> > > BuildQueryAndRun( IApp app, string name, string stream, bool includeGuid, IContextOfSite context, bool userMayEdit, AppQueryParameters more) { var wrapLog = Log.Call($"name:{name}, stream:{stream}, withModule:{(context as IContextOfBlock)?.Module.Id}"); var query = app.GetQuery(name); if (query == null) { var msg = $"query '{name}' not found"; wrapLog(msg); throw new HttpExceptionAbstraction(HttpStatusCode.NotFound, msg, "query not found"); } var permissionChecker = context.ServiceProvider.Build <AppPermissionCheck>() .ForItem(context, app, query.Definition.Entity, Log); var readExplicitlyAllowed = permissionChecker.UserMay(GrantSets.ReadSomething); var isAdmin = context.User.IsAdmin; // Only return query if permissions ok if (!(readExplicitlyAllowed || isAdmin)) { var msg = $"Request not allowed. User does not have read permissions for query '{name}'"; wrapLog(msg); throw new HttpExceptionAbstraction(HttpStatusCode.Unauthorized, msg, "Request not allowed"); } var serializer = new DataToDictionary(userMayEdit) { WithGuid = includeGuid }; if (stream == AllStreams) { stream = null; } var result = serializer.Convert(query, stream?.Split(','), more?.Guids); wrapLog(null); return(result); }
public void DoInsidePublishing(IContextOfSite context, Action <VersioningActionInfo> action) { var containerId = (context as IContextOfBlock)?.Module.Id ?? Eav.Constants.IdNotInitialized; var userId = 0; var enabled = false;// IsEnabled(containerId); Log.Add($"DoInsidePublishing(module:{containerId}, user:{userId}, enabled:{enabled})"); if (enabled) { /* ignore */ } var versioningActionInfo = new VersioningActionInfo(); action.Invoke(versioningActionInfo); Log.Add("/DoInsidePublishing"); }
public AppsBackend(CmsZones cmsZones, IContextOfSite context, IServiceProvider serviceProvider) : base(serviceProvider, "Bck.Apps") { _cmsZones = cmsZones; _context = context; }
public Dependencies(IContextOfSite siteCtx, JsContextLanguage jsCtx, Apps.App appToLaterInitialize) { SiteCtx = siteCtx; JsCtx = jsCtx; AppToLaterInitialize = appToLaterInitialize; }
public OqtUiContextBuilder(ILinkPaths linkPaths, IContextOfSite ctx, Dependencies deps) : base(deps) { _linkPaths = linkPaths; _context = ctx; }
// note: not sure yet where the best place for this method is, so it's here for now // will probably move again some day internal LookUpEngine GetConfigProviderForModule(IContextOfSite context, IApp appForLookup, IBlock blockForLookup) { var modId = (context as ContextOfBlock)?.Module.Id ?? 0; var wrapLog = Log.Call <LookUpEngine>($"{modId}, ..., ..."); // Find the standard DNN property sources if PortalSettings object is available var envLookups = _getEngineLazy.Value.Init(Log).GetLookUpEngine(modId); Log.Add($"Environment provided {envLookups.Sources.Count} sources"); var provider = new LookUpEngine(envLookups, Log); // Add QueryString etc. when running inside an http-context. Otherwise leave them away! var http = _httpLazy.Value; if (http.Current != null) { Log.Add("Found Http-Context, will ty to add params for querystring, server etc."); // new var paramList = new NameValueCollection(); var ctxWithPage = context as IContextOfBlock; if (ctxWithPage?.Page.Parameters != null) { foreach (var pair in ctxWithPage.Page.Parameters) { paramList.Add(pair.Key, pair.Value); } } else { paramList = http.QueryStringParams; } provider.Add(new LookUpInNameValueCollection("querystring", paramList)); // old #if NET451 provider.Add(new LookUpInNameValueCollection("server", http.Request.ServerVariables)); provider.Add(new LookUpInNameValueCollection("form", http.Request.Form)); #else // "Not Yet Implemented in .net standard #TodoNetStandard" - might not actually support this #endif } else { Log.Add("No Http-Context found, won't add http params to look-up"); } provider.Add(new LookUpInAppProperty("app", appForLookup)); // add module if it was not already added previously if (!provider.HasSource(CmsBlock.InstanceLookupName)) { var modulePropertyAccess = new LookUpInDictionary(CmsBlock.InstanceLookupName); modulePropertyAccess.Properties.Add(CmsBlock.InstanceIdKey, modId.ToString(CultureInfo.InvariantCulture)); provider.Add(modulePropertyAccess); } // provide the current SxcInstance to the children where necessary if (!provider.HasSource(LookUpConstants.InstanceContext) && blockForLookup != null) { var blockBuilderLookUp = new LookUpCmsBlock(LookUpConstants.InstanceContext, blockForLookup); provider.Add(blockBuilderLookUp); } return(wrapLog("ok", provider)); }
public void DoInsidePublishing(IContextOfSite context, Action <VersioningActionInfo> action) { var info = new VersioningActionInfo(); action.Invoke(info); }
/// <summary> /// DI Constructor /// </summary> public CmsContext(IPlatform platform, IContextOfSite context) { Context = context; Platform = platform; }