Tech Blog

Getting user roles within the AEK

The AEK has several hooks into the native apps at its disposal, but a common request – especially from customers with RoleSync – is how to get some kind of information about the content a user has access to. This is done by retrieving the roles associated with that user, which we can get via a web service endpoint.

This particular service is always setup as a part of your Connect Layer even if a service endpoint hasn’t been defined in App Manager for it, and the path is typically /login (relative to the path of your typical campusM Connect Layer deployment). If you’re not sure, this information can be provided by submitting a support ticket. Once setup and defined (normally) as LOGIN, the AEK can access it in the usual way:

{% set serviceClient = aek.get_service("LOGIN") %}
{% set roles = serviceClient.response.roleNames %}

This returns an array of roleName objects for further use within the AEK.

Leave a Reply