当前位置: 首页>>代码示例>>C#>>正文


C# CurrentUserInfo.IsAuthorizedPerUIElement方法代码示例

本文整理汇总了C#中CurrentUserInfo.IsAuthorizedPerUIElement方法的典型用法代码示例。如果您正苦于以下问题:C# CurrentUserInfo.IsAuthorizedPerUIElement方法的具体用法?C# CurrentUserInfo.IsAuthorizedPerUIElement怎么用?C# CurrentUserInfo.IsAuthorizedPerUIElement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CurrentUserInfo的用法示例。


在下文中一共展示了CurrentUserInfo.IsAuthorizedPerUIElement方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddResource_Click

		protected void AddResource_Click(object sender, ImageClickEventArgs e)
		{
            try
            {
                if (Session["KenticoUserInfo"] == null) return;

                var kenticoUserInfo = (UserInfo)Session["KenticoUserInfo"];

                var userInfo = UserInfoProvider.GetUserInfo(kenticoUserInfo.UserName);
                var currentUser = new CurrentUserInfo(userInfo, true);

			if (!currentUser.IsAuthorizedPerUIElement("CMS.Content", "EditForm"))
			{
				return;
			}

			var theImageButton = sender as ImageButton;
			if (theImageButton == null)
			{
				return;
			}

			string[] row = null;
			if (!string.IsNullOrEmpty(theImageButton.CommandArgument))
			{
				row = theImageButton.CommandArgument.Split(new[] { "|@|" }, StringSplitOptions.None);
			}
                var theResource = new Resource();

			if (row == null || row.Length <= 0) return;

		    theResource.Source = row[0];
            theResource.URL = theResource.Source == PBSLearningMedia ? row[5] : row[1];
                theResource.ResourceName = row[3];
                theResource.Description = row[4];

			var clientId = DistrictParms.LoadDistrictParms().ClientID;
                var userAliasPath = String.Concat(FORWARD_SLASH, KenticoHelper.GetKenticoMainFolderName(clientId), FORWARD_SLASH,
                    "Users");
                var provider = new TreeProvider(currentUser);

                var parent = provider.SelectSingleNode(CMSContext.CurrentSiteName,
                    userAliasPath + FORWARD_SLASH + kenticoUserInfo.UserName, "en-us");
            var webLink = theResource.Source == PBSLearningMedia
                    ? Request.Url.GetLeftPart(UriPartial.Authority) +
                  ResolveUrl("~/Services/KenticoServices/KenticoWebServices.aspx?resource=PBSLearningMedia&url=" +
                             theResource.URL)
                : theResource.URL;

                if (parent == null) return;

                var ci = DataClassInfoProvider.GetDataClass(ResourceClassName);

				var node = CMS.DocumentEngine.TreeNode.New(ResourceClassName, provider);
				node.SetValue("Type", 84); // static Resource ID
				node.SetValue("SubType", 97); // static Resource Web-Based ID
				node.SetValue("Name", theResource.ResourceName);
				node.SetValue("DocumentName", theResource.ResourceName);
				node.SetValue("Description", theResource.Description);
				node.SetValue("DocumentCulture", "en-us");
				node.SetValue("CreateDate", DateTime.Now);
                node.SetValue("CreatedBy", kenticoUserInfo.UserName);
				node.SetValue("Category", 0);
				node.SetValue("AttachmentName", null);
				node.SetValue("Grade", null);
				node.SetValue("Subject", null);
				node.SetValue("Courses", null);
				node.SetValue("DocRecordID", null);
                node.SetValue("WebLink", webLink);
				node.SetValue("DocumentPageTemplateID", ci.ClassDefaultPageTemplateID);
				node.Insert(parent.NodeID);

				theImageButton.ImageUrl = "~/Images/Check.png";
				theImageButton.ToolTip = "Resource Added to My Docs";
				theImageButton.Enabled = false;
			}
            catch (Exception ex)
            {
                throw ex;
            }

		}
开发者ID:ezimaxtechnologies,项目名称:ASP.Net,代码行数:82,代码来源:ResourceSearchKentico.aspx.cs

示例2: OnInit

    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);

        currentUser = CMSContext.CurrentUser;
        if (!currentUser.IsAuthorizedPerUIElement("CMS.Content", "Properties.LinkedDocs"))
        {
            RedirectToCMSDeskUIElementAccessDenied("CMS.Content", "Properties.LinkedDocs");
        }
    }
开发者ID:puentepr,项目名称:kentico-site-example,代码行数:10,代码来源:LinkedDocs.aspx.cs

示例3: ShowMDSButtons

		private void ShowMDSButtons(GridDataItem item, bool showTheButtons)
		{
            // ------------------------------------------
            // check to make sure the user have permissions to add otherwise do not show button
            if (Session["KenticoUserInfo"] == null) return;

            var kenticoUserInfo = (UserInfo)Session["KenticoUserInfo"];

            var userInfo = UserInfoProvider.GetUserInfo(kenticoUserInfo.UserName);
            var currentUser = new CurrentUserInfo(userInfo, true);

            if (!currentUser.IsAuthorizedPerUIElement("CMS.Content", "EditForm"))
            {
                var button = (ImageButton)item.FindControl("AddAsNewMyDocsResource");
                if (button != null)
                {
                    button.Enabled = false;
                    button.CssClass = "disabledButton";
                }
                //item.FindControl("AddAsNewMyDocsResource").Visible = false;
                return;
            }
            // ------------------------------------------

			item.FindControl("AddAsNewMyDocsResource").Visible = showTheButtons;
			//item.FindControl("AddAsNewDistrictResource").Visible = showTheButtons;
			//item.FindControl("AddAsNewStateResource").Visible = showTheButtons;
		}
开发者ID:ezimaxtechnologies,项目名称:ASP.Net,代码行数:28,代码来源:ResourceSearchKentico.aspx.cs

示例4: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        // Register the scripts
        ScriptHelper.RegisterProgress(this);
        ScriptHelper.RegisterScriptFile(this, "~/CMSModules/Content/CMSDesk/Properties/template.js");
        inheritElem.DocumentSettings = true;
        int documentId = 0;

        UIContext.PropertyTab = PropertyTabEnum.Template;

        currentUser = CMSContext.CurrentUser;

        nodeId = QueryHelper.GetInteger("nodeid", 0);

        tree = new TreeProvider(currentUser);
        node = tree.SelectSingleNode(nodeId, CMSContext.PreferredCultureCode, false);

        // Redirect to page 'New culture version' in split mode. It must be before setting EditedDocument.
        if ((node == null) && displaySplitMode)
        {
            URLHelper.Redirect("~/CMSModules/Content/CMSDesk/New/NewCultureVersion.aspx" + URLHelper.Url.Query);
        }
        // Set edited document
        EditedDocument = node;

        if (node != null)
        {
            siteid = node.NodeSiteID;
            documentId = node.DocumentID;
        }

        imgSaveDoc.ImageUrl = GetImageUrl("CMSModules/CMS_Content/EditMenu/save.png");
        imgSaveDoc.DisabledImageUrl = GetImageUrl("CMSModules/CMS_Content/EditMenu/savedisabled.png");
        mSaveDoc = GetString("general.save");

        pnlInherits.GroupingText = GetString("PageProperties.InheritLevels");

        ltlScript.Text = "";
        string initScript = null;

        hasDesign = currentUser.IsAuthorizedPerResource("CMS.Design", "Design");
        if (hasDesign)
        {
            btnEditTemplateProperties.Attributes.Add("onclick", "modalDialog('" + ResolveUrl("~/CMSModules/PortalEngine/UI/PageTemplates/PageTemplate_Edit.aspx") + "?templateid=' + document.getElementById('SelectedTemplateId').value + '&dialog=1', 'TemplateSelection', 850, 680);return false;");

            bool allowEditShared = currentUser.IsAuthorizedPerUIElement("CMS.Content", "Template.ModifySharedTemplates");

            // Define GetCurrentTemplateId() used for specifing teplateId in the SaveAsNewTemplate onClick handler
            initScript =
        @"
        var allowEditShared = " + allowEditShared.ToString().ToLower() + @";

        function GetCurrentTemplateId() {
        if (document.getElementById('SelectedTemplateId').value > 0) {
        return document.getElementById('SelectedTemplateId').value;
        } else {
        return document.getElementById('InheritedTemplateId').value;
        }
        };"
            ;

            ltlPreInitScript.Text = ScriptHelper.GetScript(initScript);

            btnSelect.Text = GetString("PageProperties.Select");
            btnSelect.Attributes.Add("onclick", "modalDialog('" + ResolveUrl(PORTALENGINE_UI_LAYOUTPATH + "PageTemplateSelector.aspx") + "?documentid=" + documentId + "', 'PageTemplateSelection', '90%', '85%'); return false;");

            // Register the dialog script
            ScriptHelper.RegisterDialogScript(this);

            ltlElemScript.Text += ScriptHelper.GetScript(
        @"
        var cloneElem = document.getElementById('" + btnClone.ClientID + @"');
        if (cloneElem != null) var cloneElemStyle = (cloneElem.style != null) ? cloneElem.style : cloneElem;
        var inheritElem = document.getElementById('" + btnInherit.ClientID + @"');
        if (inheritElem != null) var inheritElemStyle = (inheritElem.style != null) ? inheritElem.style : inheritElem;
        var saveElem = document.getElementById('" + btnSave.ClientID + @"');
        if (saveElem != null) var saveElemStyle = (saveElem.style != null) ? saveElem.style : saveElem;
        var editTemplatePropertiesElem = document.getElementById('" + btnEditTemplateProperties.ClientID + @"');
        if (editTemplatePropertiesElem != null) var editTemplatePropertiesElemStyle = (editTemplatePropertiesElem.style != null) ? editTemplatePropertiesElem.style : editTemplatePropertiesElem;
        "
            );

            txtTemplate.Text = ValidationHelper.GetString(Request.Params["txtTemplate"], "");

            pnlActions.GroupingText = GetString("PageProperties.Template");

            mClone = GetString("PageProperties.Clone");
            mSave = GetString("PageProperties.Save");
            mInherit = GetString("PageProperties.Inherit");
            mEditTemplateProperties = GetString("PageProperties.EditTemplateProperties");

            imgClone.ImageUrl = GetImageUrl("CMSModules/CMS_Content/Template/clone.png");
            imgInherit.ImageUrl = GetImageUrl("CMSModules/CMS_Content/Template/inherit.png");
            imgSave.ImageUrl = GetImageUrl("CMSModules/CMS_Content/Template/save.png");
            imgEditTemplateProperties.ImageUrl = GetImageUrl("CMSModules/CMS_Content/Template/edit.png");
            imgClone.DisabledImageUrl = GetImageUrl("CMSModules/CMS_Content/Template/clonedisabled.png");
            imgInherit.DisabledImageUrl = GetImageUrl("CMSModules/CMS_Content/Template/inheritdisabled.png");
            imgSave.DisabledImageUrl = GetImageUrl("CMSModules/CMS_Content/Template/savedisabled.png");
            imgEditTemplateProperties.DisabledImageUrl = GetImageUrl("CMSModules/CMS_Content/Template/editdisabled.png");
        }
//.........这里部分代码省略.........
开发者ID:KuduApps,项目名称:Kentico,代码行数:101,代码来源:Template.aspx.cs

示例5: OnInit

    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);

        currentUser = MembershipContext.AuthenticatedUser;
        if (!currentUser.IsAuthorizedPerUIElement("CMS.Content", "Properties.LinkedDocs"))
        {
            RedirectToUIElementAccessDenied("CMS.Content", "Properties.LinkedDocs");
        }
    }
开发者ID:dlnuckolls,项目名称:pfh-paypalintegration,代码行数:10,代码来源:LinkedDocs.aspx.cs

示例6: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        // Check permissions for CMS Desk -> Content -> Design -> Edit layout
        // It is placed here because this control is loaded dynamically by CMSPlaceHolder
        user = CMSContext.CurrentUser;
        if (!user.IsAuthorizedPerUIElement("CMS.Content", "Design.EditLayout"))
        {
            CMSPage.RedirectToCMSDeskUIElementAccessDenied("CMS.Content", "Design.EditLayout");
        }

        // Use UI culture for strings
        culture = user.PreferredUICultureCode;

        imgSave.ImageUrl = GetImageUrl("CMSModules/CMS_Content/EditMenu/save.png");
        imgSave.AlternateText = ResHelper.GetString("general.save", culture);

        imgCheckOut.ImageUrl = GetImageUrl("CMSModules/CMS_Content/EditMenu/checkout.png");
        imgCheckOut.AlternateText = ResHelper.GetString("general.checkout", culture);

        imgCheckIn.ImageUrl = GetImageUrl("CMSModules/CMS_Content/EditMenu/checkin.png");
        imgCheckIn.AlternateText = ResHelper.GetString("general.checkinfromfile", culture);

        btnUndoCheckOut.OnClientClick = "return confirm(" + ScriptHelper.GetString(ResHelper.GetString("General.ConfirmUndoCheckOut", culture)) + ");";

        imgUndoCheckOut.ImageUrl = GetImageUrl("~/App_Themes/Default/Images/CMSModules/CMS_Content/EditMenu/undocheckout.png");
        imgUndoCheckOut.AlternateText = ResHelper.GetString("general.undocheckout", culture);

        lblType.Text = ResHelper.GetString("PageLayout.Type");

        if (this.drpType.Items.Count == 0)
        {
            drpType.Items.Add(new ListItem(ResHelper.GetString("TransformationType.Ascx"), TransformationTypeEnum.Ascx.ToString()));
            drpType.Items.Add(new ListItem(ResHelper.GetString("TransformationType.Html"), TransformationTypeEnum.Html.ToString()));
        }

        string lang = DataHelper.GetNotEmpty(SettingsHelper.AppSettings["CMSProgrammingLanguage"], "C#");
        ltlDirectives.Text = "&lt;%@ Control Language=\"" + lang + "\" ClassName=\"Simple\" Inherits=\"CMS.PortalControls.CMSAbstractLayout\" %&gt;<br />&lt;%@ Register Assembly=\"CMS.PortalControls\" Namespace=\"CMS.PortalControls\" TagPrefix=\"cc1\" %&gt;";

        // Disable buttons and inform about not usign virtual path provider
        if (!SettingsKeyProvider.UsingVirtualPathProvider)
        {
            this.btnCheckOut.Visible = false;
            this.btnCheckIn.Visible = false;
            this.btnUndoCheckOut.Visible = false;

            txtLayout.ReadOnly = true;
        }

        this.txtLayout.Editor.AutoSize = true;
    }
开发者ID:puentepr,项目名称:kentico-site-example,代码行数:50,代码来源:EditLayout.ascx.cs

示例7: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        CMSContext.ViewMode = ViewModeEnum.MasterPage;

        // Keep current user
        user = CMSContext.CurrentUser;

        // Check UIProfile
        if (!user.IsAuthorizedPerUIElement("CMS.Content", "MasterPage"))
        {
            RedirectToCMSDeskUIElementAccessDenied("CMS.Content", "MasterPage");
        }

        // Check "Design" permission
        if (!user.IsAuthorizedPerResource("CMS.Design", "Design"))
        {
            RedirectToAccessDenied("CMS.Design", "Design");
        }

        // Register the scripts
        ScriptHelper.RegisterProgress(this);
        ScriptHelper.RegisterSaveShortcut(btnSave, null, false);

        // Save changes support
        bool confirmChanges = SettingsKeyProvider.GetBoolValue(CMSContext.CurrentSiteName + ".CMSConfirmChanges");
        string script = string.Empty;
        if (confirmChanges)
        {
            script = "var confirmLeave='" + ResHelper.GetString("Content.ConfirmLeave", user.PreferredUICultureCode) + "'; \n";
        }
        else
        {
            script += "confirmChanges = false;";
        }

        ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "saveChangesScript", ScriptHelper.GetScript(script));

        nodeId = QueryHelper.GetInteger("NodeId", 0);

        try
        {
            CMSContext.CurrentPageInfo = PageInfoProvider.GetPageInfo(CMSContext.CurrentSiteName, "/", CMSContext.PreferredCultureCode, null, false);

            // Title
            string title = CMSContext.CurrentTitle;
            if (!string.IsNullOrEmpty(title))
            {
                title = "<title>" + title + "</title>";
            }

            // Body class
            string bodyCss = CMSContext.CurrentBodyClass;
            if (bodyCss != null && bodyCss.Trim() != "")
            {
                bodyCss = "class=\"" + bodyCss + "\"";
            }
            else
            {
                bodyCss = "";
            }

            // metadata
            string meta = "<meta http-equiv=\"pragma\" content=\"no-cache\" />";

            string description = CMSContext.CurrentDescription;
            if (description != "")
            {
                meta += "<meta name=\"description\" content=\"" + description + "\" />";
            }

            string keywords = CMSContext.CurrentKeyWords;
            if (keywords != "")
            {
                meta += "<meta name=\"keywords\"  content=\"" + keywords + "\" />";
            }

            // Site style sheet
            string cssSiteSheet = "";

            CssStylesheetInfo cssInfo = null;
            int stylesheetId = CMSContext.CurrentPageInfo.DocumentStylesheetID;

            cssInfo = CssStylesheetInfoProvider.GetCssStylesheetInfo((stylesheetId > 0) ? stylesheetId : CMSContext.CurrentSite.SiteDefaultStylesheetID);

            if (cssInfo != null)
            {
                cssSiteSheet = CSSHelper.GetCSSFileLink(CSSHelper.GetStylesheetUrl(cssInfo.StylesheetName));
            }

            // Theme css files
            string themeCssFiles = "";
            if (cssInfo != null)
            {
                try
                {
                    string directory = URLHelper.GetPhysicalPath(string.Format("~/App_Themes/{0}/", cssInfo.StylesheetName));
                    if (Directory.Exists(directory))
                    {
                        foreach (string file in Directory.GetFiles(directory, "*.css"))
                        {
//.........这里部分代码省略.........
开发者ID:KuduApps,项目名称:Kentico,代码行数:101,代码来源:PageEdit.aspx.cs


注:本文中的CurrentUserInfo.IsAuthorizedPerUIElement方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。