Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/unlcms/unl_user
https://github.com/unlcms/unl_user
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/unlcms/unl_user
- Owner: unlcms
- License: gpl-2.0
- Created: 2017-01-05T16:57:32.000Z (almost 8 years ago)
- Default Branch: 8.x-1.x
- Last Pushed: 2024-10-01T19:07:53.000Z (3 months ago)
- Last Synced: 2024-10-01T20:09:28.785Z (3 months ago)
- Language: PHP
- Size: 40 KB
- Stars: 0
- Watchers: 7
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# UNL_USER module
This module does the following
* allows searching and importing users into the system
* stores UNL information, such as the 'eduPersonAffiliation', to help with access restrictions## Why LDAP as a source of user information instead of directory.unl.edu?
LDAP gives us access to users that have their privacy flag set. This is important so that we can add any users to sites regardless of weather or not their privacy flag is set.Note that we use directory.unl.edu as a backup source of information in the case that either LDAP is down or the LDAP credentials are not provides/bad.
## Getting and setting UNL user data
UNL Specific user data is retrieved when an account is first created. Every login there-after will trigger an update, but it may not happen right away.To manually update user data:
```
$helper = new Helper();
$user = \Drupal\user\Entity\User::load(\Drupal::currentUser()->id());
$helper->updateUserData($user);
```To retrieve user data
```
/**
* @var UserDataInterface $userDataService
*/
$userDataService = \Drupal::service('user.data');//Specific field
$primaryAffiliation = $userDataService->get('unl_cas', \Drupal::currentUser()->id(), 'primaryAffiliation');//All UNL user data
$allUserData = $userDataService->get('unl_cas', \Drupal::currentUser()->id());```
## Testing
Tests are built in and can be run with the core `run-tests.sh` script```
php ./core/scripts/run-tests.sh --module unl_user --verbose --url "http://your-base-url.com/unlcms2/"
```