コード例 #1
0
        public static bool CheckAdminControlersPermissions(Type item)
        {
            List <string> RolesList = LS.CurrentUser.RolesList;

            if (RolesList.Contains("Admin"))
            {
                return(true);
            }
            else if (RolesList.Count() == 0)
            {
                return(false);
            }
            else if (RolesList.Count() == 1 && RolesList.Contains("Anonymous"))
            {
                return(false);
            }

            List <string> DomainRolesList = RP.GetAdminCurrentSettingsRepository().RolesList;
            List <string> SystemRolesList = RP.GetRolesReprository().Where(r => r.IsSystem).Select(r => r.Title).ToList();

            foreach (string SystemRoles in SystemRolesList)
            {
                DomainRolesList.Remove(SystemRoles);
            }

            if (DomainRolesList.Intersect(RolesList).Count() == 0)
            {
                return(false);
            }

            List <string> MenuPermissionsList = new List <string>();

            foreach (Role role in RP.GetRolesReprository().Where(r => RolesList.Contains(r.Title)).ToList())
            {
                MenuPermissionsList.AddRange(role.MenuPermissionsList);
            }

            if (MenuPermissionsList.Contains(item.Name))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #2
0
 public static List <Role> GetRoleObjectsList()
 {
     return(RP.GetRolesReprository().ToList());
 }
コード例 #3
0
 public static List <string> GetRoleList()
 {
     return(RP.GetRolesReprository().Select(r => r.Title).ToList());
 }