feat(admin): users-management page with admin/agent role toggles#57
Merged
Conversation
Port escalated-laravel#94 to ASP.NET Core. Adds AdminUsersController
exposing the shared Vue page (Escalated/Admin/Users/Index) backed by:
- IUserDirectory — host-supplied lookup of name/email/id (the plugin
has no host User entity of its own); NullUserDirectory ships as the
default so the plugin still boots before the host wires it up.
- role_user join against two well-known role slugs (escalated-admin,
escalated-agent) for the admin/agent flags. Admins are agents — the
same contract the Laravel reference emits.
PATCH .../users/{userId}/role takes {role, value}. Self-demote on
admin is rejected so the admin cannot lock themselves out of the panel.
7 xUnit cases mirror the Pest cases in
tests/Feature/Admin/UserControllerTest.php so any behavior change
here is easy to compare against the canonical reference.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Port escalated-laravel#94 (
1b2c5b3e16a68056f1f9f90a6df6c733393a4519) to ASP.NET Core. Adds an admin users-management page so admins can grant or revoke admin / agent access from the panel — surfaces the same shared Vue page (Escalated/Admin/Users/Index) other host plugins already render.AdminUsersController(GET /support/admin/users,PATCH /support/admin/users/{userId}/role) emits/accepts the same JSON shape the canonical Laravel controller does, so the shared Vue page renders unchanged.IUserDirectory.NullUserDirectoryships as the default so the plugin boots before the host wires it up (the users page just shows an empty list until the host registers their own implementation).role_userjoin against two well-known slugs (escalated-admin,escalated-agent). Admins are agents — same contract the Laravel reference emits.Notes for reviewers
currentUserIdquery param, mirroring thecauserIdpattern used elsewhere in the plugin (AdminTicketController,AgentTicketController) — the plugin defers auth identity to the host.tests/Feature/Admin/UserControllerTest.phpso any behavior change here is easy to compare against the canonical reference.package.jsonexists in this repo to bump for@escalated-dev/escalated— the .NET host app consumes the shared Vue bundle out-of-band.Test plan
tests/Escalated.Tests/Controllers/AdminUsersControllerTests.csdotnet build+dotnet test(waited on for this PR)IUserDirectoryshould be able to load/support/admin/users, search filters the list, toggling Admin grants both flags, and a self-demote is rejected.