public ItemToolbarAction(IEntity entity = null) { // a null value/missing is also valid, when all you want is a new/add toolbar if (entity == null) { return; } isPublished = entity.IsPublished; title = entity.GetBestTitle(); entityGuid = entity.EntityGuid; if (entity is IHasEditingData editingData) { sortOrder = editingData.SortOrder; if (editingData.Parent == null) { useModuleList = true; } else // only set parent if not empty - as it's always a valid int and wouldn't be null { parent = editingData.Parent; fields = editingData.Fields; entityId = entity.EntityId; contentType = entity.Type.Name; } } else { entityId = entity.EntityId; contentType = entity.Type.Name; } }
public MultiPermissionsItems(IBlockBuilder blockBuilder, int appId, IEntity item, ILog parentLog) : base(blockBuilder, appId, parentLog) { Items = new List <IEntity> { item }; }
/// <inheritdoc /> public IFolder AsAdam(IEntity entity, string fieldName) { if (_adamAppContext == null) { _adamAppContext = Factory.Resolve <AdamAppContext>() .Init(Block.Context.Tenant, App, Block, CompatibilityLevel, Log); } return(_adamAppContext.FolderOfField(entity.EntityGuid, fieldName)); }
/// <inheritdoc /> public IFolder AsAdam(IEntity entity, string fieldName) { if (_adamManager == null) { _adamManager = GetService <AdamManager>() .Init(Block.Context, CompatibilityLevel, Log); } return(_adamManager.Folder(entity, fieldName)); }
/// <inheritdoc /> public IFolder AsAdam(IEntity entity, string fieldName) { if (_adamAppContext == null) { _adamAppContext = GetService <AdamAppContext>() .Init(Block.Context, CompatibilityLevel, Log); } return(_adamAppContext.FolderOfField(entity.EntityGuid, fieldName)); }
/// <inheritdoc /> public IFolder AsAdam(IEntity entity, string fieldName) { var envFs = Factory.Resolve <IEnvironmentFileSystem>(); if (_adamAppContext == null) { _adamAppContext = new AdamAppContext(_tenant, App, BlockBuilder, CompatibilityLevel, Log); } return(new FolderOfField(envFs, _adamAppContext, entity.EntityGuid, fieldName)); }
public dynamic AsDynamic(IEntity entity) => DynCode.AsDynamic(entity);
/// <inheritdoc /> public IFolder AsAdam(IEntity entity, string fieldName) => DynCode.AsAdam(entity, fieldName);
public ItemToolbar(IEntity entity, string actions = null, string newType = null, object prefill = null, object toolbar = null, object settings = null) { Settings = settings; // Case 1 - use the simpler string format in V10.27 if (settings is string || toolbar is string || prefill is string || ToolbarIsV10Format(toolbar)) { ToolbarV10 = toolbar == null ? new List <string>() : toolbar is string tlbString ? tlbString.Split('|').ToList() //new List<string> {tlbString} : (toolbar as IEnumerable <string>).ToList(); // check conflicting prefill format if (prefill != null && !(prefill is string)) { throw new Exception("Tried to build toolbar in new V10 format, but prefill is not a string. In V10.27+ it expects a string in url format like field=value&field2=value2"); } TargetV10 = new ItemToolbarAction(entity) { contentType = newType, prefill = prefill }; return; } // Case 2 - we have a classic V3 Toolbar object if (toolbar != null) { // check conflicting parameters if (actions != null || newType != null || prefill != null) { throw new Exception( "trying to build toolbar but got both toolbar and actions/prefill/newType - this is conflicting, cannot continue"); } ToolbarObj = toolbar; return; } // Case 2 build a toolbar based on the actions or just from empty definition if (actions == null) { Actions.Add(new ItemToolbarAction(entity) { contentType = newType, prefill = prefill }); return; } // Case 3 - we have multiple actions var actList = actions.Split(',').Select(p => p.Trim()).ToList(); foreach (string act in actList) { Actions.Add(new ItemToolbarAction(entity) { action = act, contentType = newType, prefill = prefill }); } }
/// <inheritdoc /> public dynamic AsDynamic(IEntity entity) => new DynamicEntity(entity, new[] { Thread.CurrentThread.CurrentCulture.Name }, CompatibilityLevel, Block);
/// <inheritdoc /> public dynamic AsDynamic(IEntity entity) => new DynamicEntity(entity, CmsContext.SafeLanguagePriorityCodes(), CompatibilityLevel, Block);
/// <inheritdoc /> public IFolder AsAdam(IEntity entity, string fieldName) => UnwrappedContents?.AsAdam(entity, fieldName);
/// <inheritdoc /> public dynamic AsDynamic(IEntity entity) => UnwrappedContents?.AsDynamic(entity);
/// <summary> /// Creates a permission checker for an type in this app /// </summary> /// <returns></returns> protected IPermissionCheck BuildItemPermissionChecker(IEntity item) { Log.Call($"{item.EntityId}"); // now do relevant security checks return(BuildPermissionChecker(item.Type, item)); }