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


C# CurrentUserInfo.CheckPrivilegeLevel方法代码示例

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


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

示例1: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        currentUser = MembershipContext.AuthenticatedUser;
        currentObject = (ContactRoleInfo)EditedObject;

        // Check read permission
        currentObjectSiteId = currentObject.ContactRoleID != 0 ? currentObject.ContactRoleSiteID : siteID;
        CheckReadPermission(currentObjectSiteId);

        // Preserve site info passed in query
        PageBreadcrumbs.Items[0].RedirectUrl = AddSiteQuery(PageBreadcrumbs.Items[0].RedirectUrl, siteID);
        EditForm.RedirectUrlAfterSave = AddSiteQuery(EditForm.RedirectUrlAfterSave, siteID);

        ContactRoleInfo contactRole = EditForm.EditedObject as ContactRoleInfo;

        // Set new site ID for new object
        if ((contactRole == null) || (contactRole.ContactRoleID < 1))
        {
            if ((siteID == UniSelector.US_GLOBAL_RECORD) && ModifyGlobalConfiguration)
            {
                EditForm.Data["ContactRoleSiteID"] = null;
            }
            else if (IsSiteManager && currentUser.CheckPrivilegeLevel(UserPrivilegeLevelEnum.GlobalAdmin))
            {
                EditForm.Data["ContactRoleSiteID"] = siteID;
            }
            else
            {
                EditForm.Data["ContactRoleSiteID"] = SiteContext.CurrentSiteID;
            }
        }
    }
开发者ID:kbuck21991,项目名称:kentico-blank-project,代码行数:32,代码来源:Edit.aspx.cs

示例2: ReloadData

    /// <summary>
    /// Reloads the data in the selector.
    /// </summary>
    public void ReloadData()
    {
        string where = null;
        currentUser = MembershipContext.AuthenticatedUser;

        if (string.IsNullOrEmpty(uniSelector.AdditionalSearchColumns))
        {
            uniSelector.FilterControl = "~/CMSModules/ContactManagement/FormControls/SearchContactFullName.ascx";
            uniSelector.UseDefaultNameFilter = false;
        }

        bool authorizedSiteContacts = false;
        bool authorizedGlobalContacts = ContactHelper.AuthorizedReadContact(UniSelector.US_GLOBAL_RECORD, false);

        if (SiteID > 0)
        {
            authorizedSiteContacts = ContactHelper.AuthorizedReadContact(SiteID, false);
        }
        else
        {
            authorizedSiteContacts = ContactHelper.AuthorizedReadContact(SiteContext.CurrentSiteID, false);
        }

        // Filter site objects
        if (SiteID > 0)
        {
            if (authorizedSiteContacts)
            {
                where = "(ContactSiteID = " + SiteID + " AND ContactMergedWithContactID IS NULL)";
            }
            else
            {
                where = "(1=0)";
            }
        }
        // Filter only global objects
        else if ((SiteID == UniSelector.US_GLOBAL_RECORD) || (SiteID == 0))
        {
            if (authorizedGlobalContacts)
            {
                where = "(ContactSiteID IS NULL AND ContactGlobalContactID IS NULL)";
            }
            else
            {
                where = "(1=0)";
            }
        }
        // Display current site and global contacts
        else if (SiteID == UniSelector.US_GLOBAL_AND_SITE_RECORD)
        {
            if (authorizedSiteContacts && authorizedGlobalContacts)
            {
                where = "(ContactSiteID IS NULL AND ContactGlobalContactID IS NULL) OR (ContactSiteID = " + SiteContext.CurrentSiteID + " AND ContactMergedWithContactID IS NULL)";
                uniSelector.AddGlobalObjectSuffix = true;
            }
            else if (authorizedGlobalContacts)
            {
                where = "(ContactSiteID IS NULL AND ContactMergedWithContactID IS NULL)";
            }
            else if (authorizedSiteContacts)
            {
                where = "(ContactSiteID = " + SiteContext.CurrentSiteID + " AND ContactMergedWithContactID IS NULL)";
            }
            else
            {
                where = "(1=0)";
            }
        }
        // Display all objects
        else if ((SiteID == UniSelector.US_ALL_RECORDS) && currentUser.CheckPrivilegeLevel(UserPrivilegeLevelEnum.GlobalAdmin))
        {
            where = "((ContactSiteID IS NULL AND ContactGlobalContactID IS NULL) OR (ContactSiteID > 0 AND ContactMergedWithContactID IS NULL))";
            uniSelector.AddGlobalObjectSuffix = true;
        }
        // Not enough permissions
        else
        {
            where = "(1=0)";
        }

        where = SqlHelper.AddWhereCondition(where, WhereCondition);

        uniSelector.WhereCondition = SqlHelper.AddWhereCondition(uniSelector.WhereCondition, where);
        uniSelector.Reload(true);
    }
开发者ID:kbuck21991,项目名称:kentico-blank-project,代码行数:88,代码来源:ContactSelector.ascx.cs

示例3: ReloadData

    /// <summary>
    /// Reloads the data in the selector.
    /// </summary>
    public void ReloadData()
    {
        string where = null;
        bool authorizedSiteAccounts = false;
        bool authorizedGlobalAccounts = AccountHelper.AuthorizedReadAccount(UniSelector.US_GLOBAL_RECORD, false);
        currentUser = MembershipContext.AuthenticatedUser;

        if (SiteID > 0)
        {
            authorizedSiteAccounts = AccountHelper.AuthorizedReadAccount(SiteID, false);
        }
        else
        {
            authorizedSiteAccounts = AccountHelper.AuthorizedReadAccount(SiteContext.CurrentSiteID, false);
        }

        // Filter site objects
        if (SiteID > 0)
        {
            if (authorizedSiteAccounts)
            {
                where = "(AccountSiteID = " + SiteID + " AND AccountMergedWithAccountID IS NULL)";
            }
            else
            {
                where = "(1=0)";
            }
        }
        // Filter only global objects
        else if ((SiteID == UniSelector.US_GLOBAL_RECORD) || (SiteID == 0))
        {
            if (authorizedGlobalAccounts)
            {
                where = "(AccountSiteID IS NULL AND AccountGlobalAccountID IS NULL)";
            }
            else
            {
                where = "(1=0)";
            }
        }
        // Display current site and global contacts
        else if (SiteID == UniSelector.US_GLOBAL_AND_SITE_RECORD)
        {
            if (authorizedSiteAccounts && authorizedGlobalAccounts)
            {
                where = "(AccountSiteID IS NULL AND AccountGlobalAccountID IS NULL) OR (AccountSiteID = " + SiteContext.CurrentSiteID + " AND AccountMergedWithAccountID IS NULL)";
                uniSelector.AddGlobalObjectSuffix = true;
            }
            else if (authorizedGlobalAccounts)
            {
                where = "(AccountSiteID IS NULL AND AccountMergedWithAccountID IS NULL)";
            }
            else if (authorizedSiteAccounts)
            {
                where = "(AccountSiteID = " + SiteContext.CurrentSiteID + " AND AccountMergedWithAccountID IS NULL)";
            }
            else
            {
                where = "(1=0)";
            }
        }
        // Display all objects
        else if ((SiteID == UniSelector.US_ALL_RECORDS) && currentUser.CheckPrivilegeLevel(UserPrivilegeLevelEnum.GlobalAdmin))
        {
            where = "((AccountSiteID IS NULL AND AccountGlobalAccountID IS NULL) OR (AccountSiteID > 0 AND AccountMergedWithAccountID IS NULL))";
            uniSelector.AddGlobalObjectSuffix = true;
        }
        // Not enough permissions
        else
        {
            where = "(1=0)";
        }

        uniSelector.WhereCondition = SqlHelper.AddWhereCondition(WhereCondition, where);
        uniSelector.Reload(true);
    }
开发者ID:kbuck21991,项目名称:kentico-blank-project,代码行数:79,代码来源:AccountSelector.ascx.cs


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