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


C# CurrentUserInfo.IsPublic方法代码示例

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


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

示例1: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        // Check license
        if (DataHelper.GetNotEmpty(RequestContext.CurrentDomain, string.Empty) != string.Empty)
        {
            LicenseHelper.CheckFeatureAndRedirect(RequestContext.CurrentDomain, FeatureEnum.Friends);
        }

        userId = QueryHelper.GetInteger("userid", 0);
        currentUser = MembershipContext.AuthenticatedUser;

        // Check if request is for current user or another user with permission to manage it
        if (currentUser.IsPublic() || ((currentUser.UserID != userId) && !currentUser.IsAuthorizedPerResource("CMS.Friends", "Manage")))
        {
            RedirectToAccessDenied("CMS.Friends", "Manage");
        }

        int requestedUserId = QueryHelper.GetInteger("requestid", 0);
        PageTitle.TitleText = GetString("friends.addnewfriend");
        FriendsRequest.UserID = userId;
        FriendsRequest.RequestedUserID = requestedUserId;
        FriendsRequest.IsLiveSite = true;

        if (requestedUserId != 0)
        {
            string fullUserName = String.Empty;

            UserInfo requestedUser = UserInfoProvider.GetUserInfo(requestedUserId);
            if (requestedUser != null)
            {
                fullUserName = Functions.GetFormattedUserName(requestedUser.UserName, requestedUser.FullName, requestedUser.UserNickName, true);
            }

            Page.Title = string.Format(GetString("friends.requestfriendshipwith"), HTMLHelper.HTMLEncode(fullUserName));
            PageTitle.TitleText = Page.Title;
        }
    }
开发者ID:kbuck21991,项目名称:kentico-blank-project,代码行数:37,代码来源:Friends_Request.aspx.cs

示例2: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        // Check license
        if (DataHelper.GetNotEmpty(RequestContext.CurrentDomain, string.Empty) != string.Empty)
        {
            LicenseHelper.CheckFeatureAndRedirect(RequestContext.CurrentDomain, FeatureEnum.Friends);
        }

        userId = QueryHelper.GetInteger("userid", 0);
        currentUser = MembershipContext.AuthenticatedUser;
        int requestedId = QueryHelper.GetInteger("requestid", 0);
        int friendshipId = 0;

        // Check if request is for current user or another user with permission to manage it
        if (currentUser.IsPublic() || ((currentUser.UserID != userId) && !currentUser.IsAuthorizedPerResource("CMS.Friends", "Manage")))
        {
            RedirectToAccessDenied("CMS.Friends", "Manage");
        }

        FriendsReject.SelectedFriends = null;
        FriendsReject.IsLiveSite = true;

        PageTitle.TitleText = GetString("friends.rejectfriendship");
        // Multiple selection
        if (Request["ids"] != null)
        {
            string[] items = Request["ids"].Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
            if (items.Length > 0)
            {
                ArrayList friends = new ArrayList();
                foreach (string item in items)
                {
                    friends.Add(ValidationHelper.GetInteger(item, 0));
                }
                FriendsReject.SelectedFriends = friends;
                if (friends.Count == 1)
                {
                    friendshipId = Convert.ToInt32(friends[0]);
                }
            }
        }
        // For one user
        else
        {
            FriendsReject.RequestedUserID = requestedId;
        }

        FriendInfo fi = null;
        if (friendshipId != 0)
        {
            fi = FriendInfoProvider.GetFriendInfo(friendshipId);
            // Set edited object
            EditedObject = fi;
        }
        else if (requestedId != 0)
        {
            fi = FriendInfoProvider.GetFriendInfo(userId, requestedId);
            // Set edited object
            EditedObject = fi;
        }

        if (fi != null)
        {
            UserInfo requestedUser = (userId == fi.FriendRequestedUserID) ? UserInfoProvider.GetFullUserInfo(fi.FriendUserID) : UserInfoProvider.GetFullUserInfo(fi.FriendRequestedUserID);
            string fullUserName = Functions.GetFormattedUserName(requestedUser.UserName, requestedUser.FullName, requestedUser.UserNickName, true);
            Page.Title = GetString("friends.rejectfriendshipwith") + " " + HTMLHelper.HTMLEncode(fullUserName);
            PageTitle.TitleText = Page.Title;
        }

        // Set current user
        FriendsReject.UserID = userId;
    }
开发者ID:kbuck21991,项目名称:kentico-blank-project,代码行数:72,代码来源:Friends_Reject.aspx.cs

示例3: SetupControl

    /// <summary>
    /// Initializes the control properties.
    /// </summary>
    protected void SetupControl()
    {
        if (StopProcessing)
        {
            // Do nothing
        }
        else
        {
            // Initialize properties
            string script = "";

            // Set current user
            currentUser = CMSContext.CurrentUser;

            // Get Enable Friends setting
            bool friendsEnabled = UIHelper.IsFriendsModuleEnabled(CMSContext.CurrentSiteName);

            // Initialize strings
            lnkSignIn.Text = SignInText;
            lnkJoinCommunity.Text = JoinCommunityText;
            lnkMyProfile.Text = MyProfileText;
            lnkEditMyProfile.Text = EditMyProfileText;
            btnSignOut.Text = SignOutText;
            lnkCreateNewGroup.Text = CreateNewGroupText;
            lnkCreateNewBlog.Text = CreateNewBlogText;
            lnkJoinGroup.Text = JoinGroupText;
            lnkLeaveGroup.Text = LeaveGroupText;
            lnkRejectFriendship.Text = RejectFriendshipText;
            requestFriendshipElem.LinkText = RequestFriendshipText;
            lnkSendMessage.Text = SendMessageText;
            lnkAddToContactList.Text = AddToContactListText;
            lnkAddToIgnoreList.Text = AddToIgnoreListText;
            lnkInviteToGroup.Text = InviteGroupText;
            lnkManageGroup.Text = ManageGroupText;
            lnkMyMessages.Text = MyMessagesText;
            lnkMyFriends.Text = MyFriendsText;
            lnkMyInvitations.Text = MyInvitationsText;
            lnkMyTasks.Text = MyTasksText;

            // If current user is public...
            if (currentUser.IsPublic())
            {
                // Display Sign In link if set so
                if (DisplaySignIn)
                {
                    // SignInPath returns URL - because of settings value
                    lnkSignIn.NavigateUrl = CMSContext.ResolveCurrentPath(SignInPath);
                    pnlSignIn.Visible = true;
                    pnlSignInOut.Visible = true;
                }

                // Display Join the community link if set so
                if (DisplayJoinCommunity)
                {
                    lnkJoinCommunity.NavigateUrl = GetUrl(JoinCommunityPath);
                    pnlJoinCommunity.Visible = true;
                    pnlPersonalLinks.Visible = true;
                }
            }
            // If user is logged in
            else
            {
                // Display Sign out link if set so
                if (DisplaySignOut && !RequestHelper.IsWindowsAuthentication())
                {
                    pnlSignOut.Visible = true;
                    pnlSignInOut.Visible = true;
                }

                // Display Edit my profile link if set so
                if (DisplayEditMyProfileLink)
                {
                    lnkEditMyProfile.NavigateUrl = URLHelper.ResolveUrl(TreePathUtils.GetUrl(GroupMemberInfoProvider.GetMemberManagementPath(currentUser.UserName, CMSContext.CurrentSiteName)));
                    pnlEditMyProfile.Visible = true;
                    pnlProfileLinks.Visible = true;
                }

                // Display My profile link if set so
                if (DisplayMyProfileLink)
                {
                    lnkMyProfile.NavigateUrl = URLHelper.ResolveUrl(TreePathUtils.GetUrl(GroupMemberInfoProvider.GetMemberProfilePath(currentUser.UserName, CMSContext.CurrentSiteName)));
                    pnlMyProfile.Visible = true;
                    pnlProfileLinks.Visible = true;
                }

                // Display Create new group link if set so
                if (DisplayCreateNewGroup)
                {
                    lnkCreateNewGroup.NavigateUrl = GetUrl(CreateNewGroupPath);
                    pnlCreateNewGroup.Visible = true;
                    pnlGroupLinks.Visible = true;
                }

                // Display Create new blog link if set so
                if (DisplayCreateNewBlog)
                {
                    // Check that Community Module is present
//.........这里部分代码省略.........
开发者ID:v-jli,项目名称:jean0407large,代码行数:101,代码来源:Shortcuts.ascx.cs


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