Esempio n. 1
0
        public override CommandState QueryState(CommandContext context)
        {
            Assert.ArgumentNotNull(context, "context");
            if (context.Items.Length != 1)
            {
                return(CommandState.Disabled);
            }

            if (!Settings.Analytics.Enabled)
            {
                return(CommandState.Hidden);
            }

            if (CorePipelineFactory.GetPipeline("getItemPersonalizationVisibility", string.Empty) == null)
            {
                return(base.QueryState(context));
            }

            var args = new GetItemPersonalizationVisibilityArgs(true, context.Items[0]);

            using (new LongRunningOperationWatcher(200, "getItemPersonalizationVisibility", new string[0]))
            {
                CorePipeline.Run("getItemPersonalizationVisibility", args);
            }

            if (!args.Visible)
            {
                return(CommandState.Hidden);
            }

            return(CommandState.Enabled);
        }
        public override CommandState QueryState(CommandContext context)
        {
            Assert.ArgumentNotNull(context, "context");
            if (context.Items.Length != 1)
            {
                return CommandState.Disabled;
            }

            if (!Settings.Analytics.Enabled)
            {
                return CommandState.Hidden;
            }

            if (CorePipelineFactory.GetPipeline("getItemPersonalizationVisibility", string.Empty) == null)
            {
                return base.QueryState(context);
            }

            var args = new GetItemPersonalizationVisibilityArgs(true, context.Items[0]);

            using (new LongRunningOperationWatcher(200, "getItemPersonalizationVisibility", new string[0]))
            {
                CorePipeline.Run("getItemPersonalizationVisibility", args);
            }

            if (!args.Visible)
            {
                return CommandState.Hidden;
            }

            return CommandState.Enabled;
        }
 /// <summary>
 /// Checks the access.
 /// 
 /// </summary>
 /// <param name="item">The item.</param>
 internal static void CheckAccess(Sitecore.Data.Items.Item item)
 {
     if (CorePipelineFactory.GetPipeline("getItemPersonalizationVisibility", string.Empty) == null)
         return;
     GetItemPersonalizationVisibilityArgs personalizationVisibilityArgs = new GetItemPersonalizationVisibilityArgs(true, item);
     CorePipeline.Run("getItemPersonalizationVisibility", (PipelineArgs)personalizationVisibilityArgs);
     Assert.HasAccess(personalizationVisibilityArgs.Visible, "Application access denied.");
 }