use of io.apiman.manager.api.beans.idm.UpdateRoleBean in project apiman by apiman.
the class RoleResourceImpl method update.
/**
* @see IRoleResource#update(java.lang.String, io.apiman.manager.api.beans.idm.UpdateRoleBean)
*/
@Override
public void update(String roleId, UpdateRoleBean bean) throws RoleNotFoundException, NotAuthorizedException {
securityContext.checkAdminPermissions();
try {
RoleBean role = getRoleFromStorage(roleId);
if (bean.getDescription() != null) {
role.setDescription(bean.getDescription());
}
if (bean.getAutoGrant() != null) {
role.setAutoGrant(bean.getAutoGrant());
}
if (bean.getName() != null) {
role.setName(bean.getName());
}
if (bean.getPermissions() != null) {
role.getPermissions().clear();
role.getPermissions().addAll(bean.getPermissions());
}
storage.updateRole(role);
} catch (StorageException e) {
throw new SystemErrorException(e);
}
}
Aggregations