SourceCode/RFrameGenerate.BLL/Organization/PermissionManage.cs

(开头部分) 19KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web;
using RFrameGenerate.Common;
using RFrameGenerate.DAL;
using RFrameGenerate.Model;
using System.Web.Caching;
using RFramework.SQLServer;
using System.ComponentModel;
using System.Reflection;

namespace RFrameGenerate.BLL
{
    /// <summary>
    /// 权限管理
    /// </summary>
    public class PermissionManage
    {
        /// <summary>
        /// 根据当前登录的用户 权限码 判断用户是否具有当前的权限
        /// </summary>
        /// <param name="type">权限码类型</param>
        /// <returns></returns>
        public bool IsPermission(Type type)
        {
            if (CurrentManage.LoginType == DictionaryConst.LoginType.Merchant || CurrentManage.LoginType == DictionaryConst.LoginType.HeadOffice || CurrentManage.LoginType == DictionaryConst.LoginType.Agent)
                return true;//商家有所有权限

            string permissionCode;
            object[] tables = type.GetCustomAttributes(typeof(RemarkAttribute), true);
            if (tables.Length > 0)
                permissionCode = ((RemarkAttribute)(tables[0])).Value;
            else
                permissionCode = ((RemarkAttribute)Activator.CreateInstance(typeof(RemarkAttribute))).Value;
            return IsPermission(CurrentUser.GetCurrUserGuid(), permissionCode);
        }
        /// <summary>
        /// 根据当前登录的用户 权限码 判断用户是否具有当前的权限
        /// </summary>
        /// <param name="permissionCode">权限码</param>
        /// <returns></returns>
        public bool IsPermission(string permissionCode)
        {
            if (CurrentManage.LoginType == DictionaryConst.LoginType.Merchant || CurrentManage.LoginType == DictionaryConst.LoginType.HeadOffice || CurrentManage.LoginType == DictionaryConst.LoginType.Agent)
                return true;//商家有所有权限

            return IsPermission(CurrentUser.GetCurrUserGuid(), permissionCode);
        }
        /// <summary>
        /// 根据当前登录的用户 权限码 判断用户是否具有当前的权限
        /// </summary>
        /// <param name="userguid">用户GUID</param>
        /// <param name="permissionCode">权限码</param>
        /// <returns></returns>
        private bool IsPermission(Guid userguid, string permissionCode)
        {
            if (CurrentManage.LoginType == DictionaryConst.LoginType.Merchant || CurrentManage.LoginType == DictionaryConst.LoginType.HeadOffice || CurrentManage.LoginType == DictionaryConst.LoginType.Agent)
后面还有 381 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。