⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 manageweblogpermissionsadmin.cs

📁 本系统是在asp版《在线文件管理器》的基础上设计制作
💻 CS
字号:
//------------------------------------------------------------------------------
// <copyright company="Telligent Systems">
//     Copyright (c) Telligent Systems Corporation.  All rights reserved.
// </copyright> 
//------------------------------------------------------------------------------

using System;
using System.Web.UI.WebControls;
using CommunityServer.Blogs.Components;
using CommunityServer.Components;
using CommunityServer.Controls;

namespace CommunityServer.Blogs.Controls
{
    /// <summary>
    /// Summary description for ManageWeblogPermissionsAdmin.
    /// </summary>
    public class ManageWeblogPermissionsAdmin : ManageSectionPermissionsAdmin
    {
        public ManageWeblogPermissionsAdmin()
        {
			
        }

        protected override void OnLoad(EventArgs e)
        {
            if(!CSContext.Current.User.IsBlogAdministrator)
                throw new CSException(CSExceptionType.AccessDenied,"User does not have access to the blog permissions");

            base.OnLoad (e);
        }

        protected override void AddRole(Int32 sectionID, Guid roleID)
        {
            WeblogPermission bp = null;
			bp = CommunityServer.Blogs.Components.WeblogPermissions.GetBlogPermission( sectionID, roleID );
			if( bp != null ) {
				bp.SectionID = sectionID;
				bp.RoleID = roleID;
				bp.ApplicationType = ApplicationType.Weblog;
			}
			else {
				bp = new WeblogPermission();
				bp.SectionID = sectionID;
				bp.RoleID = roleID;
				bp.ApplicationType = ApplicationType.Weblog;
				bp.AllowMask = 0x0;
				bp.DenyMask = 0x0;
			}
			Permissions.AddPermission(bp);
		}

        protected override void RemoveRole(Int32 sectionID, Guid roleID)
        {
            WeblogPermission bp = new WeblogPermission();
            bp.SectionID = sectionID;
            bp.RoleID = roleID;
            bp.ApplicationType = ApplicationType.Weblog;

            Permissions.RemovePermission(bp);
        }


        protected override String ExternalSkinFileName
        {
            get 
            {
                return base.CreateExternalSkinFileName("Blogs");
            }
        }

        protected override System.Collections.ArrayList GetGroups()
        {
            return WeblogGroups.GetWeblogGroups(false,true,false);
        }

        protected override ControlUserMode GetMode
        {
            get
            {
                return ControlUserMode.BlogSystemAdministrator;
            }
        }

        protected override void SetPermissions(RepeaterItem item)
        {
            WeblogPermission bp = item.DataItem as  WeblogPermission;
            SetText(bp.View,item.FindControl("lblView"));
            SetText(bp.Post,item.FindControl("lblPost"));
            SetText(bp.Reply,item.FindControl("lblReply"));
        }

        protected override string GetPermissionLink(int weblogID, Guid roleID)
        {
            Weblog wl = Weblogs.GetWeblog(weblogID,false,true);
            return BlogUrls.Instance().Permission(wl.ApplicationKey,roleID);
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -