Search in sources :

Example 1 with GroupAuthority

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;
}
Also used : SimpleGrantedAuthority(org.springframework.security.core.authority.SimpleGrantedAuthority) SimpleGrantedAuthority(org.springframework.security.core.authority.SimpleGrantedAuthority) GrantedAuthority(org.springframework.security.core.GrantedAuthority) GroupAuthority(gemma.gsec.model.GroupAuthority)

Example 2 with GroupAuthority

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);
}
Also used : GroupAuthority(gemma.gsec.model.GroupAuthority) GroupAuthority(gemma.gsec.model.GroupAuthority) UserGroup(gemma.gsec.model.UserGroup)

Aggregations

GroupAuthority (gemma.gsec.model.GroupAuthority)2 UserGroup (gemma.gsec.model.UserGroup)1 GrantedAuthority (org.springframework.security.core.GrantedAuthority)1 SimpleGrantedAuthority (org.springframework.security.core.authority.SimpleGrantedAuthority)1