Esempio n. 1
0
        [AllowAnonymous]   // will check security internally, so assume no requirements
        public Dictionary <string, IEnumerable <Dictionary <string, object> > > PublicQuery([FromUri] string appPath, [FromUri] string name, [FromUri] string stream = null)
        {
            var wrapLog     = Log.Call($"path:{appPath}, name:{name}");
            var appIdentity = AppFinder.GetCurrentAppIdFromPath(appPath);
            var queryApp    = new Apps.App(new DnnTenant(PortalSettings), appIdentity.ZoneId, appIdentity.AppId,
                                           ConfigurationProvider.Build(false, false), false, Log);

            // now just run the default query check and serializer
            var result = BuildQueryAndRun(queryApp, name, stream, false, null, Log, BlockBuilder);

            wrapLog(null);
            return(result);
        }
Esempio n. 2
0
        [AllowAnonymous]   // will check security internally, so assume no requirements
        public Dictionary <string, IEnumerable <Dictionary <string, object> > > PublicQuery([FromUri] string appPath, [FromUri] string name, [FromUri] string stream = null)
        {
            Log.Add($"public query path:{appPath}, name:{name}");
            // 2018-09-22 new
            var appIdentity = AppFinder.GetCurrentAppIdFromPath(appPath);
            var queryApp    = new App(new DnnTenant(PortalSettings), appIdentity.ZoneId, appIdentity.AppId,
                                      ConfigurationProvider.Build(false, false), false, Log);

            // 2018-09-22 old
            // ensure the queries can be executed (needs configuration provider, usually given in SxcInstance, but we don't hav that here)
            //var config = DataSources.ConfigurationProvider.GetConfigProviderForModule(0, queryApp, null);
            //queryApp.InitData(false, false, config);

            // now just run the default query check and serializer
            return(BuildQueryAndRun(queryApp, name, stream, false, null, Log, SxcInstance));
        }
Esempio n. 3
0
        private void TryToAttachAppFromUrlParams()
        {
            var wrapLog = Log.Call("TryToAttachAppFromUrlParams");
            var found   = false;

            try
            {
                var routeAppPath = Route.AppPathOrNull(Request.GetRouteData());
                var appId        = AppFinder.GetCurrentAppIdFromPath(routeAppPath).AppId;
                // Look up if page publishing is enabled - if module context is not available, always false
                var publish           = Factory.Resolve <IEnvironmentFactory>().PagePublisher(Log);
                var publishingEnabled = Dnn.Module != null && publish.IsEnabled(Dnn.Module.ModuleID);
                var app = (App)Environment.Dnn7.Factory.App(appId, publishingEnabled);
                DnnAppAndDataHelpers.LateAttachApp(app);
                found = true;
            } catch { /* ignore */ }

            wrapLog(found.ToString());
        }