コード例 #1
0
        public static IApp Init(this App app, IServiceProvider sp, int appId, ILog log, bool showDrafts = false)
        {
            var appIdentity  = new AppIdentity(SystemRuntime.ZoneIdOfApp(appId), appId);
            var confProvider = sp.Build <AppConfigDelegate>().Init(log);

            return(app.Init(confProvider, appIdentity, log, showDrafts));
        }
コード例 #2
0
ファイル: AppInits.cs プロジェクト: kieran23101/2sxc
        public static IApp Init(this App app, int appId, ILog log, IBlock optionalBlock = null, bool showDrafts = false)
        {
            var appIdentity = new AppIdentity(SystemRuntime.ZoneIdOfApp(appId), appId);

            if (optionalBlock == null)
            {
                return(app.Init(appIdentity, log, showDrafts));
            }
            var buildConfig = ConfigurationProvider.Build(optionalBlock, true);

            return(app.Init(appIdentity, buildConfig, false, log));
        }
コード例 #3
0
        public static IApp Init(this App app, IServiceProvider sp, int appId, ILog log, IBlock optionalBlock = null, bool showDrafts = false)
        {
            var appIdentity  = new AppIdentity(SystemRuntime.ZoneIdOfApp(appId), appId);
            var confProvider = sp.Build <AppConfigDelegate>().Init(log);

            if (optionalBlock == null)
            {
                return(app.Init(confProvider, appIdentity, log, showDrafts));
            }
            var buildConfig = confProvider.Build(optionalBlock);

            return(app.Init(appIdentity, buildConfig, log));
        }
コード例 #4
0
        public dynamic GetManyForEditing([FromBody] List <ItemIdentifier> items, int appId)
        {
            var wrapLog = Log.Call("GetManyForEditing", $"get many a#{appId}, items⋮{items.Count}");

            // before we start, we have to convert the indexes into something more useful, because
            // otherwise in content-list scenarios we don't have the type
            var appForSecurityChecks = App.LightWithoutData(new DnnTenant(PortalSettings), SystemRuntime.ZoneIdOfApp(appId), appId, Log);

            items = new SaveHelpers.ContentGroupList(SxcInstance, Log).ConvertListIndexToId(items, appForSecurityChecks);

            // to do full security check, we'll have to see what content-type is requested
            var permCheck = new MultiPermissionsTypes(SxcInstance, appId, items, Log);

            if (!permCheck.EnsureAll(GrantSets.WriteSomething, out var exception))
            {
                throw exception;
            }

            var list = new EntityApi(appId, Log).GetEntitiesForEditing(appId, items);

            // Reformat to the Entity-WithLanguage setup
            var listAsEwH = list.Select(p => new BundleWithHeader <EntityWithLanguages>
            {
                Header = p.Header,
                Entity = p.Entity != null
                    ? EntityWithLanguages.Build(appId, p.Entity)
                    : null
            }).ToList();

            // 2018-09-26 2dm
            // if we're giving items which already exist, then we must verify that edit/read is allowed.
            // important, this code is shared/duplicated in the UiController.Load
            if (list.Any(set => set.Entity != null))
            {
                if (!permCheck.EnsureAll(GrantSets.ReadSomething, out exception))
                {
                    throw exception;
                }
            }

            wrapLog($"will return items⋮{list.Count}");
            return(listAsEwH);
        }
コード例 #5
0
 public MultiPermissionsApp(IBlockBuilder blockBuilder, int appId, ILog parentLog) :
     this(blockBuilder, SystemRuntime.ZoneIdOfApp(appId), appId, parentLog)
 {
 }
コード例 #6
0
 public MultiPermissionsApp(SxcInstance sxcInstance, int appId, Log parentLog) :
     this(sxcInstance, SystemRuntime.ZoneIdOfApp(appId), appId, parentLog)
 {
 }