Commit graph

16 commits

Author SHA1 Message Date
cf220b9730 refactor: extract shared helpers for RoleLive modules
Extract format_error and permission_set_badge_class functions into
MvWeb.RoleLive.Helpers module to eliminate code duplication between
Index and Show LiveViews.
2026-01-08 14:25:28 +01:00
3e8f29bf31 fix: add actor and domain parameters to user count functions in Show
Add actor and domain parameters to recalculate_user_count and
load_user_count to ensure consistent authorization. Clarify that
load_user_count is for initial display while recalculate_user_count
is for fresh count before deletion.
2026-01-08 14:09:28 +01:00
266df8a8ad fix: add actor and domain parameters to user count functions
Add actor parameter to load_user_counts and recalculate_user_count
in Index LiveView to ensure consistent authorization and policy
enforcement. Also add domain parameter for clarity.
2026-01-08 14:09:27 +01:00
c27b903018
refactor: replace cond with if in handle_delete_role functions
All checks were successful
continuous-integration/drone/push Build is passing
2026-01-08 13:56:08 +01:00
4f371352e2 refactor: extract ensure_user_role_loaded into shared on_mount hook
Move duplicate ensure_user_role_loaded logic into MvWeb.LiveHelpers
on_mount hook to eliminate code duplication across RoleLive modules
and centralize security-related user role loading.
2026-01-08 13:50:33 +01:00
2c36621259 fix: eliminate duplicate user_count queries in delete handlers
Calculate user_count once and reuse the value instead of calling
recalculate_user_count twice, reducing unnecessary database queries.
2026-01-08 13:50:28 +01:00
f4b0d1c9a8 fix: add actor parameter to Authorization.get_role in Index
Ensure consistent authorization by passing actor parameter to
get_role call, matching the pattern used in Show LiveView.
2026-01-08 13:50:26 +01:00
fe8b4a65dd
fix: use reraise instead of raise in rescue blocks
Replace raise with reraise to preserve the original stacktrace when
re-raising exceptions in rescue blocks, improving error debugging.
2026-01-08 13:30:36 +01:00
fbc962ce94
refactor: reduce nesting depth in RoleLive handle_event functions 2026-01-08 13:30:20 +01:00
8afccf1dd0
feat: prevent deletion of roles with assigned users
All checks were successful
continuous-integration/drone/push Build is passing
2026-01-08 12:06:15 +01:00
1dd7c0eaa0 fix: improve contrast for 'No description' text to meet WCAG 2 AA
All checks were successful
continuous-integration/drone/push Build is passing
Change text-base-content/50 to text-base-content/70 for better
accessibility contrast ratio in role index and show pages
2026-01-08 12:00:38 +01:00
b65b5a376b feat: add user count display for each role
- Add Users column showing number of users assigned to each role
- Load user counts efficiently in single query to avoid N+1
- Similar implementation to membership fee types member count
2026-01-08 11:42:29 +01:00
303b81d37d refactor: reduce nesting depth in RoleLive.Index.mount
Extract role loading logic into separate private functions to fix Credo warning about nested function body.
2026-01-06 23:57:57 +01:00
a5081793b0
feat: assign admin role to admin user in seeds
Some checks failed
continuous-integration/drone/push Build is failing
- Create Admin role if it doesn't exist
- Assign Admin role to admin@mv.local user
- Remove separate create_admin_role script (integrated into seeds)
2026-01-06 23:55:46 +01:00
7b3362dc48
feat: add visible buttons with text for role CRUD operations
- Add text labels to Edit and Delete buttons in index page
- Change button size from btn-xs to btn-sm for better visibility
- Add Delete button to show page for non-system roles
- Implement handle_event for delete in show page
- Add format_error helper to show page
2026-01-06 23:48:36 +01:00
8820ce6429
feat: implement role management LiveViews
Add complete CRUD interface for role management under /admin/roles.

- Index page with table showing name, description, permission_set_name, is_system_role
- Show page for role details
- Form component for create/edit with permission_set_name dropdown
- System role badge and disabled delete button
- Flash messages for success/error
- Authorization checks using MvWeb.Authorization helpers
- Comprehensive test coverage (22 tests)

Routes added under /admin scope. All LiveViews load user role
for authorization checks. Form uses custom dropdown for permission sets.
2026-01-06 23:36:26 +01:00