Beispiel #1
0
 public bool HasRight(string permissionName)
 {
     using (var context = new AuthDbContext())
     {
         return(context.Users.Any(u => u.Name == userName && u.MappingUserRoles.Any(ur => ur.Role.MappingRolePermissions.Any(rp => rp.Permission.Name == permissionName))) ||
                context.Users.Any(u => u.Name == userName && u.MappingUserRoles.Any(ur => ur.Role.MappingRoleGroups.Any(rg => rg.Group.MappingGroupPermissions.Any(gp => gp.Permission.Name == permissionName)))));
     }
 }
Beispiel #2
0
        public bool Login(string userName, string password)
        {
            var result = false;

            using (var context = new AuthDbContext())
            {
                result = context.Users.Any(e => e.Name == userName && e.Password == password);
            }

            if (result)
            {
                AuthImp.userName = userName;
            }

            return(result);
        }