class urn_perun_user_facility_attribute_def_def_shell extends UserFacilityAttributesModuleAbstract implements UserFacilityAttributesModuleImplApi {

	@Override
	public void checkAttributeSemantics(PerunSessionImpl session, User user, Facility facility, Attribute attribute) throws WrongReferenceAttributeValueException, WrongAttributeAssignmentException {
		String shell = attribute.valueAsString();

		if (shell == null) return;

		List<String> allowedShells = allShellsAtSpecifiedFacility(session, facility, user);

		if (allowedShells.isEmpty()) {
			throw new WrongReferenceAttributeValueException(attribute, null, user, facility, "There are no shells available at associated facilities");
		}

		if (!allowedShells.contains(shell)) {
			throw new WrongReferenceAttributeValueException(attribute, null, user, facility, "Such shell is not allowed at specified facility for the user.");
		}
	}

}