Exemple #1
0
        /// <summary>
        /// 检测合作者权限
        /// </summary>
        /// <param name="partner"></param>
        /// <returns></returns>
        private bool CheckModulePower(Partner partner)
        {
            //不需要权限
            if (Code <= 0)
            {
                return(true);
            }

            //访问的模块为Admin权限,通关
            if (EnumUtility.ContainsEnumItem(partner.Authorize.Role, Role.Admin))
            {
                return(true);
            }

            //Use权限,且访问的模块拥有Editor或Use权限
            if (EnumUtility.ContainsEnumItem((int)Code, Role.Use) && (EnumUtility.ContainsEnumItem(partner.Authorize.Role, Role.Editor) || EnumUtility.ContainsEnumItem(partner.Authorize.Role, Role.Use)))
            {
                return(true);
            }

            //Editor权限,且访问的模块拥有Editer权限
            if (EnumUtility.ContainsEnumItem((int)Code, Role.Editor) && EnumUtility.ContainsEnumItem(partner.Authorize.Role, Role.Editor))
            {
                return(true);
            }

            return(false);
        }