示例#1
0
 protected override bool AuthorizeCore(HttpContextBase httpContext)
 {
     if (CurrentUser != null)
     {
         var userGroupIds = CurrentUser.UserGroupIds.GetIds();
         foreach (var userGroupId in userGroupIds)
         {
             if (userGroupId == 1)//super admin
             {
                 return(true);
             }
             if (userGroupId != 0 && userGroupId != 1 && !string.IsNullOrEmpty(UserGroups))
             {
                 var usergroup = accountService.GetUserGroup(userGroupId);
                 if (usergroup != null && UserGroups.Contains(usergroup.Name))
                 {
                     return(true);
                 }
             }
         }
     }
     return(false);
 }