This module adds funcionality related to MyAcademicID data points that can be leveraged in Drupal applications.
Include the repository in your project's composer.json file:
"repositories": [
...
{
"type": "vcs",
"url": "https://github.com/EuropeanUniversityFoundation/myacademicid_user_fields"
}
],
Then you can require the package as usual:
composer require euf/myacademicid_user_fields
Finally, install the module:
drush en myacademicid_user_fields
This module adds new base fields to the User entity that match OpenID Connect claims from MyAcademicID:
schac_home_organization;schac_personal_unique_code;voperson_external_affiliation.
The field names follow the convention maid_{claim}.
This module defines two groups of Events and corresponding EventSubscribers to handle the main use cases:
User{Claim}ChangeEvents are dispatched when the corresponding User fields change;- the built-in
MyacademicidUserFieldsSubscriberlogs messages accordingly; SetUser{Claim}Events are dispatched when the corresponding user fields should be set to a given value;- the built-in
SetUser{Claim}EventSubscribers set the field values if the User entity passes validation.
This module adds one permission: Administer MyAcademicID user fields.
Users with this permission can edit MyAcademicID user fields (their own or any user's, depending on other core permissions).
Users without this permission will see their MyAcademicID claims printed as plain text in their user account form.
For applications relying on the OpenID Connect protocol, the MyAcademicID claims should be mapped to the new base fields, so that any change upon login will propagate across the system.
For applications implementing an OAuth2 Server or similar, this module can be used to set the claims based on the relevant business logic.
Assuming there is a properly configured phpunit.xml at the project root, run the tests with the following command:
vendor/bin/phpunit web/modules/contrib/myacademicid_user_fields/tests