Skip to content

[BISON-19] Add impersonation functionality for users and update permissions#22

Merged
JMRhodes merged 3 commits into
developfrom
feature/BISON-19/user-impersonation
Aug 26, 2025
Merged

[BISON-19] Add impersonation functionality for users and update permissions#22
JMRhodes merged 3 commits into
developfrom
feature/BISON-19/user-impersonation

Conversation

@JMRhodes
Copy link
Copy Markdown

This pull request introduces user impersonation functionality to the application, allowing certain users to impersonate others through the admin panel. The implementation includes UI changes, permission checks, and the integration of a third-party package to support this feature.

User Impersonation Feature:

  • Added the stechstudio/filament-impersonate package to composer.json to provide impersonation capabilities.
  • Updated the EditUser page to include an "Impersonate User" action in the header actions, grouped under an "Actions" button, using the new package.

Permissions and Role Management:

  • Added the admin.users.impersonate permission to the config/roles_permissions.php configuration.
  • Implemented canImpersonate and canBeImpersonated methods in the User model to restrict impersonation so that only users with the SUPER_ADMIN role or the admin.users.impersonate permission can impersonate, and to prevent SUPER_ADMIN users from being impersonated.

Jira:
https://moderntribe.atlassian.net/browse/BISON-19

@JMRhodes JMRhodes requested a review from Copilot August 20, 2025 18:22
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces user impersonation functionality to allow authorized administrators to impersonate other users through the admin panel. The implementation integrates a third-party Filament package and adds proper permission controls.

  • Added stechstudio/filament-impersonate package dependency for impersonation capabilities
  • Implemented permission-based access control with canImpersonate and canBeImpersonated methods in the User model
  • Updated the EditUser admin page to include an "Impersonate User" action in a grouped button interface

Reviewed Changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.

File Description
config/roles_permissions.php Added admin.users.impersonate permission to SUPER_ADMIN role
composer.json Added stechstudio/filament-impersonate package dependency
app/Models/User.php Implemented impersonation permission methods with role-based access control
app/Filament/Resources/Users/Pages/EditUser.php Added impersonate action to EditUser page header with grouped button UI

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread app/Models/User.php Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown

@dpellenwood dpellenwood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🪄

Base automatically changed from feature/BISON-20/mfa to develop August 26, 2025 15:07
@JMRhodes JMRhodes merged commit 0a7dbe2 into develop Aug 26, 2025
@JMRhodes JMRhodes deleted the feature/BISON-19/user-impersonation branch August 26, 2025 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants