use of org.simbasecurity.api.service.thrift.TRole 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.TRole 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.TRole in project simba-os by cegeka.
the class PolicyServiceImpl method addRoles.
@Override
public void addRoles(TPolicy policy, Set<TRole> roles) throws TException {
simbaExceptionHandlingCaller.call(() -> {
Policy attachedPolicy = policyRepository.refreshWithOptimisticLocking(policy.getId(), policy.getVersion());
Set<Role> attachedRoles = roles.stream().map(r -> roleRepository.refreshWithOptimisticLocking(r.getId(), r.getVersion())).collect(Collectors.toSet());
audit.log("Roles ''{0}'' added to policy ''{1}''", join(attachedRoles, Role::getName), attachedPolicy.getName());
attachedPolicy.addRoles(attachedRoles);
});
}
use of org.simbasecurity.api.service.thrift.TRole 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);
});
}
use of org.simbasecurity.api.service.thrift.TRole in project simba-os by cegeka.
the class PolicyServiceImpl method removeRole.
@Override
public void removeRole(TPolicy policy, TRole role) throws TException {
simbaExceptionHandlingCaller.call(() -> {
Policy attachedPolicy = policyRepository.refreshWithOptimisticLocking(policy.getId(), policy.getVersion());
Role attachedRole = roleRepository.refreshWithOptimisticLocking(role.getId(), role.getVersion());
audit.log("Role ''{0}'' removed from policy ''{1}''", attachedRole.getName(), attachedPolicy.getName());
attachedPolicy.removeRole(attachedRole);
});
}
Aggregations