Skip to content

add support to have multiple depths of impersonation#238

Open
ainesophaur wants to merge 1 commit into
404labfr:masterfrom
ainesophaur:feature/impersonation-stack
Open

add support to have multiple depths of impersonation#238
ainesophaur wants to merge 1 commit into
404labfr:masterfrom
ainesophaur:feature/impersonation-stack

Conversation

@ainesophaur
Copy link
Copy Markdown

I needed the ability to impersonate users at multiple depths and leave impersonate in the order that it was entered. This PR brings the functionality by creating a stack of impersonations saved in the session, keyed by guard.

The proposed change allows super user -> admin -> user and then subsequent calls to leave will unwind the stack, user -> admin, then admin -> super user. The current packages behavior only keeps the last "impersonator", so going further than one level of impersonation causes the existing impersonation identities to be discarded.

I added to tests to verify functionality but I can certainly add more if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant