feat: add UI-level authorization helpers
Implement MvWeb.Authorization module with can?/3 and can_access_page?/2 functions for conditional rendering in LiveView templates. - can?/3 supports both resource atoms and record structs with scope checking - can_access_page?/2 checks page access permissions - All functions use PermissionSets module for consistency with backend - Graceful handling of nil users and invalid permission sets - Comprehensive test coverage with 17 test cases
This commit is contained in:
parent
ea29fbb58b
commit
ff9c8d2d64
3 changed files with 424 additions and 0 deletions
|
|
@ -89,6 +89,9 @@ defmodule MvWeb do
|
|||
# Core UI components
|
||||
import MvWeb.CoreComponents
|
||||
|
||||
# Authorization helpers
|
||||
import MvWeb.Authorization, only: [can?: 3, can_access_page?: 2]
|
||||
|
||||
# Common modules used in templates
|
||||
alias Phoenix.LiveView.JS
|
||||
alias MvWeb.Layouts
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue