A common situation that occurs when using Cosign module is that it can create lots of headaches for administrative users and developers when trying to test out different roles and permissions. This can certainly be a problem during development, but can also hinder the ability to replicate and verify user-reported errors and bugs. Since Cosign module default behavior dictates that the local Drupal user must match the remote Cosign user, it's non-trivial for an admin to login as or masquerade another user.
To fix this, I propose adding hook invocations in the Cosign module user authentication logic to allow other modules to modify the default behavior. The first obvious use-case for a contributed module would be to hook into these invocations to allow administrators to impersonate other users. While the primary hook needed is when the remote user mis-matches with the local Drupal user, other hooks for each of the possible scenarios might as well be added too. The result would be the following 5 hooks:
- Local/Remote user mis-match
- Local/Remote user match
- New local user created to match remote user
- New local user NOT created even though no local user matches the remote user
- No remote user found
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | Cosign-add-api-1795890-0.patch | 7.04 KB | kevinchampion |
Comments
Comment #1
kevinchampion commentedHere's a patch.
Comment #2
mlhess commentedI will test this and see if I can get it committed to -dev
Comment #3
kevinchampion commentedTo get a better idea of the purpose and a use case for the API, take a look at cosign_impersonate, a module I'm working on to allow users to masquerade as other users while under Cosign authentication:
http://drupal.org/sandbox/kevinchampion/1815060
Comment #4
mlhess commentedComment #5
mlhess commentedThis has been applied.