use of org.simbasecurity.api.service.thrift.TGroup in project simba-os by cegeka.
the class GroupServiceImpl method removeRole.
@Override
public void removeRole(TGroup group, TRole role) throws TException {
simbaExceptionHandlingCaller.call(() -> {
Role attachedRole = roleRepository.refreshWithOptimisticLocking(role.getId(), role.getVersion());
Group attachedGroup = groupRepository.refreshWithOptimisticLocking(group.getId(), group.getVersion());
audit.log("Role ''{0}'' removed from group ''{1}''", attachedRole.getName(), attachedGroup.getName());
attachedGroup.removeRole(attachedRole);
});
}
use of org.simbasecurity.api.service.thrift.TGroup in project simba-os by cegeka.
the class GroupServiceImpl method addRoles.
@Override
public void addRoles(TGroup group, List<TRole> roles) throws TException {
simbaExceptionHandlingCaller.call(() -> {
Group attachedGroup = groupRepository.refreshWithOptimisticLocking(group.getId(), group.getVersion());
Collection<Role> attachedRoles = roles.stream().map(r -> roleRepository.refreshWithOptimisticLocking(r.getId(), r.getVersion())).collect(Collectors.toList());
audit.log("Roles ''{0}'' added to group ''{1}''", join(attachedRoles, Role::getName));
attachedGroup.addRoles(attachedRoles);
});
}
use of org.simbasecurity.api.service.thrift.TGroup in project simba-os by cegeka.
the class GroupServiceImpl method addRole.
@Override
public void addRole(TGroup group, TRole role) throws TException {
simbaExceptionHandlingCaller.call(() -> {
Role attachedRole = roleRepository.refreshWithOptimisticLocking(role.getId(), role.getVersion());
Group attachedGroup = groupRepository.refreshWithOptimisticLocking(group.getId(), group.getVersion());
audit.log("Role ''{0}'' added to group ''{1}''", attachedRole.getName(), attachedGroup.getName());
attachedGroup.addRole(attachedRole);
});
}
Aggregations