Accessing Attributes of People in SSP-Open-Source-Project
Person attributes are available through the PersonAttributesService
, which is a Spring managed bean that may be injected into classes that need it.
@Autowired private PersonAttributesService personAttributeService;
The PersonAttributesService
currently has one method -- getAttributes
-- with the following signature (we can add a method that fetches attributes for multiple people at once if needed):
Map<String,List<String>> getAttributes(HttpServletRequest req, HttpServletResponse res, String username) throws ObjectNotFoundException;
Use the PersonAttributesService
bean as in the following example:
Map<String,List<String>> attr = personAttributeService.getAttributes(req, res, "admin"); String mail = attr.get("mail").get(0);
Configuring Attributes in SSP-Platform
The person attributes available to SSP as a whole can be defined, configured, and aggregated in the personDirectoryContext.xml
file within SSP-Platform. (Location: SSP-Platform/uportal-war/src/main/resources/properties/contexts/personDirectoryContext.xml
). SSP uses the Jasig Person Directory project for attributes. Configuration instructions can be found in the Person Directory Manual.