use of gemma.gsec.model.GroupAuthority in project Gemma by PavlidisLab.
the class UserManagerImpl method loadGroupAuthorities.
private List<GrantedAuthority> loadGroupAuthorities(User user) {
Collection<GroupAuthority> authorities = userService.loadGroupAuthorities(user);
List<GrantedAuthority> result = new ArrayList<>();
for (GroupAuthority ga : authorities) {
String roleName = this.getRolePrefix() + ga.getAuthority();
result.add(new SimpleGrantedAuthority(roleName));
}
return result;
}
use of gemma.gsec.model.GroupAuthority in project Gemma by PavlidisLab.
the class UserManagerImpl method addGroupAuthority.
@Override
public void addGroupAuthority(String groupName, GrantedAuthority authority) {
UserGroup g = this.loadGroup(groupName);
for (gemma.gsec.model.GroupAuthority ga : g.getAuthorities()) {
if (ga.getAuthority().equals(authority.getAuthority())) {
logger.warn("Group already has authority" + authority.getAuthority());
return;
}
}
GroupAuthority auth = ubic.gemma.model.common.auditAndSecurity.GroupAuthority.Factory.newInstance();
auth.setAuthority(authority.getAuthority());
g.getAuthorities().add(auth);
userService.update(g);
}
Aggregations