Browse Source

登录权限问题

zhangbin 1 year ago
parent
commit
c413dc492f

+ 7 - 1
xpgx-common/src/main/java/com/miaxis/common/core/domain/model/LoginUser.java

@@ -295,7 +295,13 @@ public class LoginUser implements UserDetails
 
     @Override
     public Collection<? extends GrantedAuthority> getAuthorities() {
-        return Collections.emptyList();
+        if (this.getStudent() != null){
+            List<SimpleGrantedAuthority> roleList = new ArrayList<SimpleGrantedAuthority>();
+            roleList.add(new SimpleGrantedAuthority("ROLE_STUDENT"));
+            return roleList;
+        }else {
+            return Collections.emptyList();
+        }
     }
 
 }