Skip to content

Commit

Permalink
[kbss-cvut/record-manager-ui#202] Remove Security Role
Browse files Browse the repository at this point in the history
  • Loading branch information
palagdan committed Sep 25, 2024
1 parent 39e7503 commit a55b08f
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 93 deletions.
7 changes: 1 addition & 6 deletions src/main/java/cz/cvut/kbss/study/model/Role.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,7 @@ public enum Role {
this.iri = iri;
}

public static Role getFromSecurityRole(cz.cvut.kbss.study.security.model.Role r) {
return switch (r) {
case USER -> user;
case ADMIN -> administrator;
};
}


public String getIri() {
return iri;
Expand Down
36 changes: 0 additions & 36 deletions src/main/java/cz/cvut/kbss/study/security/model/Role.java

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
package cz.cvut.kbss.study.service.security;

import cz.cvut.kbss.study.exception.NotFoundException;
import cz.cvut.kbss.study.model.PatientRecord;
import cz.cvut.kbss.study.model.RoleGroup;
import cz.cvut.kbss.study.model.User;
import cz.cvut.kbss.study.model.Vocabulary;
import cz.cvut.kbss.study.model.*;
import cz.cvut.kbss.study.persistence.dao.PatientRecordDao;
import cz.cvut.kbss.study.persistence.dao.UserDao;
import cz.cvut.kbss.study.security.model.Role;
import cz.cvut.kbss.study.security.model.UserDetails;
import cz.cvut.kbss.study.service.ConfigReader;
import cz.cvut.kbss.study.util.ConfigParam;
Expand Down Expand Up @@ -106,8 +102,7 @@ private User resolveAccountFromOAuthPrincipal(Jwt principal) {

RoleGroup roleGroup = new RoleGroup();
user.setRoleGroup(roleGroup);
roles.stream().map(Role::forName).filter(Optional::isPresent).map(Optional::get)
.forEach(r -> roleGroup.addRole(cz.cvut.kbss.study.model.Role.getFromSecurityRole(r)));
roles.forEach(r -> roleGroup.addRole(Role.fromIriOrName(r)));
return user;
}

Expand Down
44 changes: 0 additions & 44 deletions src/test/java/cz/cvut/kbss/study/security/model/RoleTest.java

This file was deleted.

0 comments on commit a55b08f

Please sign in to comment.