Переглянути джерело

fix: 添加门户新角色

zhaoxingrui 4 роки тому
батько
коміт
75b3647eda

+ 1 - 0
web/src/main/java/cn/seecoder/web/infrastructure/config/AuthTools.java

@@ -82,6 +82,7 @@ public class AuthTools {
         log.info("checkProjOwnership verifying projectId: " + projectId);
         try {
             List<ProjectVO> projects = seecoderGitlabApi.getAllProjectsByUserId(userPO.getId());
+            System.out.println(projects.size());
             if (projects.stream().noneMatch(project -> project.getProjectId().equals(projectId))){
                 log.error("checkProjOwnership projectId none match " + projectId);
                 return false;

+ 16 - 4
web/src/main/java/cn/seecoder/web/infrastructure/security/WebSecurityConstants.java

@@ -17,22 +17,34 @@ public abstract class WebSecurityConstants {
 	public static final String STUDENT_ROLE = "STUDENT";
 	public static final String TEACHER_ROLE = "TEACHER";
 	public static final String ADMIN_ROLE = "ADMIN";
-	
+	public static final String STAFF_ROLE = "STAFF";
+	public static final String HR_ROLE = "HR";
+	public static final String SEEC_ROLE = "SEEC";
+	public static final String SEECX_ROLE = "SEECX";
+
 	public static final GrantedAuthority STUDENT_AUTHORITY = new SimpleGrantedAuthority(ROLE_PREFIX + STUDENT_ROLE);
 	public static final GrantedAuthority TEACHER_AUTHORITY = new SimpleGrantedAuthority(ROLE_PREFIX + TEACHER_ROLE);
 	public static final GrantedAuthority ADMIN_AUTHORITY = new SimpleGrantedAuthority(ROLE_PREFIX + ADMIN_ROLE);
+	public static final GrantedAuthority STAFF_AUTHORITY = new SimpleGrantedAuthority(ROLE_PREFIX + STAFF_ROLE);
+	public static final GrantedAuthority HR_AUTHORITY = new SimpleGrantedAuthority(ROLE_PREFIX + HR_ROLE);
+	public static final GrantedAuthority SEEC_AUTHORITY = new SimpleGrantedAuthority(ROLE_PREFIX + SEEC_ROLE);
+	public static final GrantedAuthority SEECX_AUTHORITY = new SimpleGrantedAuthority(ROLE_PREFIX + SEECX_ROLE);
 
 
 
 	private static final Map<UserIdentity,GrantedAuthority> authorityTable= new HashMap<>();
-	
+
 	static {
 		authorityTable.put(UserIdentity.STUDENT, STUDENT_AUTHORITY);
 		authorityTable.put(UserIdentity.TEACHER, TEACHER_AUTHORITY);
 		authorityTable.put(UserIdentity.ADMIN, ADMIN_AUTHORITY);
+		authorityTable.put(UserIdentity.STAFF, STAFF_AUTHORITY);
+		authorityTable.put(UserIdentity.HR, HR_AUTHORITY);
+		authorityTable.put(UserIdentity.SEEC, SEEC_AUTHORITY);
+		authorityTable.put(UserIdentity.SEECX, SEECX_AUTHORITY);
 	}
-	
+
 	public static GrantedAuthority getAuthority(UserIdentity identity){
 		return authorityTable.get(identity);
 	}
-}
+}

+ 13 - 1
web/src/main/java/cn/seecoder/web/model/enums/UserIdentity.java

@@ -11,7 +11,19 @@ public enum UserIdentity {
 	TEACHER("教师"),
 
 	@JsonProperty("管理员")
-	ADMIN("管理员");
+	ADMIN("管理员"),
+
+    @JsonProperty("职员")
+    STAFF("职员"),
+
+    @JsonProperty("HR")
+    HR("HR"),
+
+    @JsonProperty("SEEC")
+    SEEC("SEEC"),
+
+    @JsonProperty("SEECX")
+    SEECX("SEECX");
 
 	private final String name;
 

+ 2 - 2
web/src/main/resources/application-prod.yaml

@@ -28,7 +28,7 @@ seecoder:
     debugging: false
     ingressHostSuffix: .devcloud.seec.seecoder.cn
   gitlab:
-    host: http://environment-13-31.seec.svc.cluster.local:8080
+    host: https://environment-13-31.seec.svc.cluster.local:8080
     webhookProxy: http://environment-21-70.seec.svc.cluster.local:8080/hook
     token: wXDeETv2Kmt-JhiApJ9H
   git:
@@ -39,4 +39,4 @@ seecoder:
     registry: 172.19.51.6:8092
     registryUsername: admin
     registryPassword: NJU67nexus
-    tls: false
+    tls: false

+ 1 - 1
web/src/main/resources/application.yml

@@ -1,3 +1,3 @@
 spring:
   profiles:
-    active: prod
+    active: prod