コード例 #1
0
 protected override void StartWizard(ClientPipelineArgs args)
 {
     //If User switched from Preview mode he have no authorisation cookie and so
     //he cannot request nesessary for wizard pages. We have to restore him.
     if (PreviewManager.GetShellUser() != string.Empty)
     {
         PreviewManager.RestoreUser();
     }
     base.StartWizard(args);
     if (args.HasResult)
     {
         SheerResponse.Eval("window.top.location.reload();");
     }
 }
コード例 #2
0
        /// <summary>
        /// Check credentials.
        /// </summary>
        /// <returns>
        ///     <c>true</c> if this instance has access; otherwise, <c>false</c>.
        /// </returns>
        protected virtual bool HasAccess()
        {
            Tracer.Info(string.Concat("Checking security for current user \"", Context.User.Name, "\"."));
            SiteContext site = Context.Site;

            if (site != null && site.RequireLogin && !Context.User.IsAuthenticated && !this.IsLoginPageRequest())
            {
                Tracer.Warning(string.Concat("Site \"", site.Name, "\" requires login and no user is logged in."));
                return(false);
            }
            if (site != null && site.DisplayMode != DisplayMode.Normal && !Context.User.IsAuthenticated && string.IsNullOrEmpty(PreviewManager.GetShellUser()) && !this.IsLoginPageRequest())
            {
                Tracer.Warning(string.Concat("Current display mode is \"", site.DisplayMode, "\" and no user is logged in."));
                return(false);
            }
            if (Context.Item == null)
            {
                Tracer.Info("Access is granted as there is no current item.");
                return(true);
            }
            if (Context.Item.Access.CanRead())
            {
                Tracer.Info(string.Concat("Access granted as the current user \"", Context.GetUserName(), "\" has read access to current item."));
                return(true);
            }
            string[] userName = new string[] { "The current user \"", Context.GetUserName(), "\" does not have read access to the current item \"", Context.Item.Paths.Path, "\"." };
            Tracer.Warning(string.Concat(userName));
            return(false);
        }