Search in sources :

Example 1 with UserGroup

use of gemma.gsec.model.UserGroup in project Gemma by PavlidisLab.

the class UserManagerImpl method deleteGroup.

@Override
public void deleteGroup(String groupName) {
    UserGroup group = this.loadGroup(groupName);
    userService.delete(group);
}
Also used : UserGroup(gemma.gsec.model.UserGroup)

Example 2 with UserGroup

use of gemma.gsec.model.UserGroup in project Gemma by PavlidisLab.

the class UserManagerImpl method createGroup.

@Override
public void createGroup(String groupName, List<GrantedAuthority> authorities) {
    UserGroup g = ubic.gemma.model.common.auditAndSecurity.UserGroup.Factory.newInstance();
    g.setName(groupName);
    for (GrantedAuthority ga : authorities) {
        g.getAuthorities().add(ubic.gemma.model.common.auditAndSecurity.GroupAuthority.Factory.newInstance(ga.getAuthority()));
    }
    userService.create(g);
}
Also used : SimpleGrantedAuthority(org.springframework.security.core.authority.SimpleGrantedAuthority) GrantedAuthority(org.springframework.security.core.GrantedAuthority) UserGroup(gemma.gsec.model.UserGroup)

Example 3 with UserGroup

use of gemma.gsec.model.UserGroup in project Gemma by PavlidisLab.

the class UserManagerImpl method renameGroup.

@Override
public void renameGroup(String oldName, String newName) {
    UserGroup group = userService.findGroupByName(oldName);
    group.setName(newName);
    userService.update(group);
}
Also used : UserGroup(gemma.gsec.model.UserGroup)

Example 4 with UserGroup

use of gemma.gsec.model.UserGroup in project Gemma by PavlidisLab.

the class UserManagerImpl method addUserToGroup.

@Override
public void addUserToGroup(String username, String groupName) {
    User u = this.loadUser(username);
    UserGroup g = this.loadGroup(groupName);
    userService.addUserToGroup(g, u);
}
Also used : User(gemma.gsec.model.User) UserGroup(gemma.gsec.model.UserGroup)

Example 5 with UserGroup

use of gemma.gsec.model.UserGroup in project Gemma by PavlidisLab.

the class UserManagerImpl method removeGroupAuthority.

@Override
public void removeGroupAuthority(String groupName, GrantedAuthority authority) {
    UserGroup group = this.loadGroup(groupName);
    userService.removeGroupAuthority(group, authority.getAuthority());
}
Also used : UserGroup(gemma.gsec.model.UserGroup)

Aggregations

UserGroup (gemma.gsec.model.UserGroup)15 User (gemma.gsec.model.User)5 GrantedAuthority (org.springframework.security.core.GrantedAuthority)4 SimpleGrantedAuthority (org.springframework.security.core.authority.SimpleGrantedAuthority)4 GroupAuthority (gemma.gsec.model.GroupAuthority)2 ArrayList (java.util.ArrayList)2 Test (org.junit.Test)2 Secured (org.springframework.security.access.annotation.Secured)2 BaseSpringContextTest (ubic.gemma.core.testing.BaseSpringContextTest)2 UserDetailsImpl (gemma.gsec.authentication.UserDetailsImpl)1 UserExistsException (gemma.gsec.authentication.UserExistsException)1 AccessDeniedException (org.springframework.security.access.AccessDeniedException)1 Transactional (org.springframework.transaction.annotation.Transactional)1 ExpressionExperiment (ubic.gemma.model.expression.experiment.ExpressionExperiment)1