Пример #1
0
 public override AdamAppContext Init(IContextOfApp ctx, int compatibility, ILog parentLog)
 {
     base.Init(ctx, compatibility, parentLog);
     AdamFs = AppRuntime.ServiceProvider.Build <IAdamFileSystem <TFolderId, TFileId> >()
              .Init(this, Log);
     return(this);
 }
Пример #2
0
        public AppContent Init(string appName, ILog parentLog)
        {
            Log.LinkTo(parentLog);

            // if app-path specified, use that app, otherwise use from context
            Context = _ctxResolver.AppNameRouteBlock(appName);

            return(this);
        }
Пример #3
0
        public override AdamState Init(IContextOfApp context, string contentType, string fieldName, Guid entityGuid, bool usePortalRoot, ILog parentLog)
        {
            Log.Add("PrepCore(...)");
            AdamAppContext.Init(context, 10, Log);
            ContainerContext = usePortalRoot
                ? new AdamOfSite <TFolderId, TFileId>(AdamAppContext) as AdamOfBase <TFolderId, TFileId>
                : new AdamOfField <TFolderId, TFileId>(AdamAppContext, entityGuid, fieldName);

            return(base.Init(context, contentType, fieldName, entityGuid, usePortalRoot, parentLog));
        }
Пример #4
0
        public virtual AdamManager Init(IContextOfApp ctx, int compatibility, ILog parentLog)
        {
            Log.LinkTo(parentLog);
            AppContext = ctx;

            var callLog = Log.Call();

            Site = AppContext.Site;
            AppRuntime.Init(AppContext.AppState, AppContext.UserMayEdit, null);
            CompatibilityLevel = compatibility;
            callLog("ready");
            return(this);
        }
Пример #5
0
        public override AdamContext Init(IContextOfApp context, string contentType, string fieldName, Guid entityGuid, bool usePortalRoot, ILog parentLog)
        {
            Log.LinkTo(parentLog);
            var logCall = Log.Call <AdamContext>($"..., usePortalRoot: {usePortalRoot}");

            AdamManager.Init(context, 10, Log);
            AdamRoot = usePortalRoot
                ? new AdamStorageOfSite <TFolderId, TFileId>(AdamManager) as AdamStorage <TFolderId, TFileId>
                : new AdamStorageOfField <TFolderId, TFileId>(AdamManager, entityGuid, fieldName);
            AdamRoot.Init(Log);

            base.Init(context, contentType, fieldName, entityGuid, usePortalRoot, parentLog);

            return(logCall(null, this));
        }
Пример #6
0
        /// <summary>
        /// Initializes the object and performs all the initial security checks
        /// </summary>
        public virtual AdamContext Init(IContextOfApp context, string contentType, string fieldName, Guid entityGuid, bool usePortalRoot, ILog parentLog)
        {
            Log.LinkTo(parentLog);
            var appId   = context.AppState.AppId;
            var callLog = Log.Call <AdamContext>($"app: {context.AppState.Show()}, field:{fieldName}, guid:{entityGuid}");

            Context = context;

            Permissions = ServiceProvider.Build <MultiPermissionsTypes>()
                          .Init(context, context.AppState, contentType, Log);

            // only do checks on field/guid if it's actually accessing that, if it's on the portal root, don't.
            UseSiteRoot = usePortalRoot;
            if (!usePortalRoot)
            {
                ItemField = fieldName;
                ItemGuid  = entityGuid;
            }

            Security = ServiceProvider.Build <AdamSecurityChecksBase>().Init(this, usePortalRoot, Log);

            if (Security.MustThrowIfAccessingRootButNotAllowed(usePortalRoot, out var exception))
            {
                throw exception;
            }

            Log.Add("check if feature enabled");
            if (Security.UserIsRestricted && !Eav.Configuration.Features.Enabled(FeaturesForRestrictedUsers))
            {
                throw HttpException.PermissionDenied(
                          $"low-permission users may not access this - {Eav.Configuration.Features.MsgMissingSome(FeaturesForRestrictedUsers)}");
            }

            if (string.IsNullOrEmpty(contentType) || string.IsNullOrEmpty(fieldName))
            {
                return(callLog(null, this));
            }

            Attribute = AttributeDefinition(appId, contentType, fieldName);
            if (!Security.FileTypeIsOkForThisField(out var exp))
            {
                throw exp;
            }
            return(callLog(null, this));
        }
Пример #7
0
 public T Init(IContextOfApp context, ILog parentLog)
 {
     Log.LinkTo(parentLog);
     Context = context;
     return(this as T);
 }
Пример #8
0
 public CmsManager Init(IContextOfApp context, ILog parentLog)
 {
     base.Init(context.AppState, context.UserMayEdit, parentLog);
     return(this);
 }
Пример #9
0
 public SaveSecurity(IContextOfApp context, ILog parentLog) : base("Api.SavSec")
 {
     base.Init(context, parentLog);
 }