Create Authorization Domain and Role Resource #321

Closed
opened 2026-01-06 16:13:01 +01:00 by moritz · 0 comments
Owner

Create the authorization domain in Ash with the Role resource. This establishes the foundation for all authorization logic.

Tasks:

  1. Create lib/mv/authorization/ directory
  2. Create lib/mv/authorization/role.ex Ash resource with:
    • id (UUIDv7, primary key)
    • name (String, unique, required) - e.g., "Vorstand", "Admin"
    • description (String, optional)
    • permission_set_name (String, required) - must be one of: "own_data", "read_only", "normal_user", "admin"
    • is_system_role (Boolean, default false) - prevents deletion
    • timestamps
  3. Add validation: permission_set_name must exist in PermissionSets.all_permission_sets/0
  4. Add role_id (UUID, nullable, foreign key) to users table
  5. Add belongs_to :role relationship in User resource
  6. Run mix ash.codegen to generate migrations
  7. Review and apply migrations

Acceptance Criteria:

  • Role resource created with all fields
  • Migration applied successfully
  • User.role relationship works
  • Validation prevents invalid permission_set_name
  • is_system_role flag present
Create the authorization domain in Ash with the `Role` resource. This establishes the foundation for all authorization logic. **Tasks:** 1. Create `lib/mv/authorization/` directory 2. Create `lib/mv/authorization/role.ex` Ash resource with: - `id` (UUIDv7, primary key) - `name` (String, unique, required) - e.g., "Vorstand", "Admin" - `description` (String, optional) - `permission_set_name` (String, required) - must be one of: "own_data", "read_only", "normal_user", "admin" - `is_system_role` (Boolean, default false) - prevents deletion - timestamps 3. Add validation: `permission_set_name` must exist in `PermissionSets.all_permission_sets/0` 4. Add `role_id` (UUID, nullable, foreign key) to `users` table 5. Add `belongs_to :role` relationship in User resource 6. Run `mix ash.codegen` to generate migrations 7. Review and apply migrations **Acceptance Criteria:** - [ ] Role resource created with all fields - [ ] Migration applied successfully - [ ] User.role relationship works - [ ] Validation prevents invalid `permission_set_name` - [ ] `is_system_role` flag present
moritz added this to the Sprint 10: 11.12-08.01 project 2026-01-06 16:13:01 +01:00
moritz self-assigned this 2026-01-06 16:13:04 +01:00
moritz added this to the Accounts & Logins milestone 2026-01-08 17:14:57 +01:00
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: local-it/mitgliederverwaltung#321
No description provided.