opf/openproject — pull request #2062 by oliverguenther (2014-10-17 12:16:11+00:00)
Title: Allow attribute mapping through flexible strategy 

OpenProject currently employs a fixed attribute mapping schema for
userdata extracted from OmniAuth::AuthHash.

For some strategies (e.g., LDAP), various attribute names are used to
determine user attributes. Thus, an override to the fixed mapping from
within a strategy is desirable.

This feature allows the attribute mapping hash to be merged with
attribute overrides from within an OmniAuth strategy.

The attribute mapping steps are as follows:

1. Create the default/fxied attribute map in `omniauth_hash_to_user_attributes` as before.
2. Check whether `omniauth_hash_to_user_attributes` also exists in the used strategy class (This is contained in the counterpart implementation in `openproject-auth_plugins`).
3. If it exists, merge the default hash with the strategy mapping, thus allowing overrides to all user attributes.

The motivation for this feature arises from my OmniAuth strategy integrations for `CAS` Single-Sign On and `LDAP`, which both require patches to override the mapping at the moment.

- [The respective discussion in the boards can be found here](https://community.openproject.org/topics/3107)
- [The corresponding work package](https://community.openproject.org/work_packages/16841)