Skip to content

feat: enforce permission-aware service and admin access - #11

Merged
arapsum merged 9 commits into
mainfrom
feature/permissions
Jul 14, 2026
Merged

arapsum merged 9 commits into
mainfrom
feature/permissions

Conversation

@arapsum

@arapsum arapsum commented Jul 14, 2026

Copy link
Copy Markdown
Owner

Summary

  • expose each authenticated user's effective roles and permissions
  • enforce permission-specific RBAC policies across protected service routes
  • conditionally render admin navigation, actions, routes, and forbidden states
  • expand authorization-boundary coverage in service and admin tests
  • merge request and user-model fixture corrections for the current seeded identities and roles

Test fixes

  • privileged request cases authenticate as the seeded administrator
  • customer order cases explicitly establish ownership and permission state
  • user model lookups, password operations, duplicate checks, and snapshots use current seeded emails
  • seed-dependent checkout and role-permission snapshots were reviewed with cargo insta review

Verification

  • cargo test --test mod requests -- --test-threads=1: 226 passed
  • cargo test --test mod models::user -- --test-threads=1: 33 passed, 1 intentionally ignored
  • cargo test --all-features --all -- --test-threads=1: 552 passed before two reviewed stale snapshots; both failing cases then passed directly
  • cargo clippy --all-features -- -D warnings -W clippy::pedantic -W clippy::nursery -W rust-2018-idioms
  • cargo fmt --all -- --check
  • pnpm run fmt
  • pnpm run lint
  • pnpm exec tsc --noEmit
  • pnpm run build
  • pnpm test: 12 passed
  • git diff --check; no pending snapshot files

arapsum added 9 commits July 14, 2026 12:08
Add the admin application access permission and seed it for staff-facing roles.

Return each authenticated user's deduplicated roles and permissions from the current-user endpoints.
Protect role and permission reads and mutations with their corresponding permissions.

Support method-aware and path-aware middleware rules so shared Axum routes cannot bypass authorization.
Guard feature routes and provide an access-denied destination for authenticated users without administrative access.

Filter navigation and command results, and hide catalogue, order, people, role, and permission actions the current user cannot perform.

Centralize permission names and access checks for consistent reuse across future admin features.
Exercise effective access lookup for staff, customers, and unknown users with reviewed Insta snapshots.

Cover unauthenticated and unauthorized role and permission requests across read and mutation methods.

Verify the admin access helpers and align client error fixtures with the structured API error contract.
Authenticate privileged request cases as the seeded administrator and update John Doe's current email.

Make order ownership and denial fixtures explicitly establish customer and permission state.

Review snapshots for the expanded staff roles and updated user assignments.
Use the current John Doe email in duplicate, lookup, password, token, and profile model cases.

Review user snapshots for the updated John Doe and Morgan Grimes seed addresses.

Preserve the intended repository assertions while eliminating false not-found and duplicate-success results.
# Conflicts:
#	service/tests/requests/roles.rs
#	service/tests/requests/snapshots/auth/[email protected]
#	service/tests/requests/snapshots/auth/[email protected]
Record John Doe's current email in the checkout result.

Include the two newly seeded staff role-permission grants in the complete assignment list.

Review both changes through cargo insta review and verify the previously failing cases directly.
@arapsum
arapsum merged commit 571226d into main Jul 14, 2026
7 checks passed
@arapsum
arapsum deleted the feature/permissions branch July 14, 2026 10:23
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.

1 participant