use of cz.metacentrum.perun.core.api.AttributesManager in project perun by CESNET.
the class ElixirBonaFideStatus method approveApplication.
/**
* Add new bonaFideStatus to the user attribute.
*/
@Override
public Application approveApplication(PerunSession session, Application app) throws GroupNotExistsException, WrongAttributeAssignmentException, AttributeNotExistsException, PrivilegeException, UserNotExistsException, WrongAttributeValueException, WrongReferenceAttributeValueException {
User user = app.getUser();
Group group = app.getGroup();
AttributesManager am = session.getPerun().getAttributesManager();
Attribute attestation = am.getAttribute(session, group, A_G_D_groupAttestation);
String newValue = attestation.valueAsString();
Attribute bonaFideStatus = am.getAttribute(session, user, A_U_D_userBonaFideStatus);
List<String> value = new ArrayList<>();
if (bonaFideStatus.getValue() != null && bonaFideStatus.valueAsList() != null) {
value = bonaFideStatus.valueAsList();
}
value.add(newValue);
bonaFideStatus.setValue(value);
am.setAttribute(session, user, bonaFideStatus);
return app;
}
Aggregations