Skip to content

Role and Permission Implementation Plan

İrem Önen edited this page Apr 27, 2026 · 1 revision

This document defines the final application-level authorization plan for Admin, Moderator, and Verification Coordinator roles in the Neighborhood Emergency Preparedness Hub.

User.role remains dedicated to community identity (STANDARD / EXPERT). Staff authorization is managed separately.


1. Role model

The system will use a separate staff-role axis with these values:

  • NONE
  • MODERATOR
  • VERIFICATION_COORDINATOR
  • ADMIN

These staff roles are independent from STANDARD and EXPERT.


2. Scope decision

Moderators are global.

A moderator can moderate content across all hubs. No hub-scoped moderation logic will be implemented.


3. Permission matrix

3.1 Forum permissions

Permission Moderator Verification Coordinator Admin
View hidden posts in moderation views Yes No Yes
Change post status (ACTIVE, HIDDEN, REMOVED) Yes No Yes
Delete any post Yes No Yes
Delete any comment Yes No Yes
Manage pin/lock features No feature implemented No No feature implemented
Change forum global settings No No Yes

3.2 Help requests and offers permissions

Permission Moderator Verification Coordinator Admin
Edit/delete any help request for policy reasons Yes No Yes
Edit/delete any help offer for policy reasons Yes No Yes
Delete any help comment for policy reasons Yes No Yes
Force help request status changes for moderation Yes No Yes

3.3 Accounts and role-management permissions

Permission Moderator Verification Coordinator Admin
View public user profile Yes Yes Yes
Suspend/deactivate users (is_active=False) No No Yes
Assign or revoke staff roles No No Yes
Manage STANDARD / EXPERT role values No No Yes
Manage Django operational flags (is_staff, is_superuser) through API No No No

3.4 Expertise certification permissions

Permission Moderator Verification Coordinator Admin
View submitted expertise certification documents No Yes Yes
Approve expertise certification No Yes Yes
Reject expertise certification with reason No Yes Yes
Request resubmission of certification No Yes Yes
Manually override final certification decision No No Yes

4. Verification Coordinator responsibilities

The Verification Coordinator is responsible only for expertise-certification workflow.

Responsibilities:

  • Review submitted certification evidence for expert claims.
  • Mark submissions as approved, rejected, or resubmission-required.
  • Record decision metadata (reviewer, timestamp, decision, reason).
  • Trigger updates to expert-verification state in user-facing profile data.

Non-responsibilities:

  • No forum moderation powers.
  • No help-request/offer moderation powers.
  • No account suspension powers.
  • No staff-role assignment powers.
  • No platform configuration powers.

5. Data model plan

A separate staff-role field will be added to accounts.User:

  • staff_role: enum with NONE, MODERATOR, VERIFICATION_COORDINATOR, ADMIN.

Certification workflow state will be represented explicitly:

  • certification_status: NOT_SUBMITTED, PENDING_REVIEW, APPROVED, REJECTED, RESUBMISSION_REQUIRED.
  • certification_reviewed_by (FK to reviewer user).
  • certification_reviewed_at (datetime).
  • certification_review_note (text).

REGISTER and PATCH /me flows will not allow client-side mutation of staff_role.


6. Backend authorization enforcement

Dedicated DRF permission classes will be implemented:

  • IsModeratorOrAdmin
  • IsVerificationCoordinatorOrAdmin
  • IsAdminOnly

Rules:

  • Moderation endpoints require IsModeratorOrAdmin.
  • Certification-review endpoints require IsVerificationCoordinatorOrAdmin.
  • Staff-role assignment, suspension, and platform configuration require IsAdminOnly.
  • Existing author-only write guards remain for normal users and are bypassed only on explicitly designated moderation endpoints.

7. API plan

The API surface will include dedicated endpoints for:

  • Forum moderation actions.
  • Help-content moderation actions.
  • Expertise certification review actions.
  • Admin-only staff-role management.
  • Admin-only account suspension/reactivation.

No pin/lock endpoint family will be added.


8. Frontend and mobile plan

Web and mobile clients will read and enforce role-based UI from authenticated user data.

Client behavior:

  • Show moderation pages/actions only for MODERATOR and ADMIN.
  • Show certification-review pages/actions only for VERIFICATION_COORDINATOR and ADMIN.
  • Show staff-role management and account suspension UI only for ADMIN.
  • Do not render pin/lock controls.

9. Audit and compliance plan

All privileged actions will be written to an audit trail.

Audit events include:

  • Actor user ID and staff role.
  • Target entity type and ID.
  • Action name.
  • Old and new values for state-changing operations.
  • Timestamp.

Actions to log:

  • Forum and help-content moderation decisions.
  • Certification approval/rejection/resubmission decisions.
  • Staff-role assignment/revocation.
  • Account suspension/reactivation.

10. Testing and rollout plan

Test coverage will include:

  • Permission-allow and permission-deny cases for each role and endpoint family.
  • Verification workflow transition tests.
  • Regression tests for existing standard/expert behavior.

Rollout sequence:

  1. Add schema and migrations.
  2. Add permission classes and protected endpoints.
  3. Add audit logging.
  4. Expose role fields in authenticated user payloads.
  5. Update frontend and mobile role-gated UI.
  6. Execute role-based integration tests.

Final authority split

  • Moderator: Global content moderation for forum/help domains only.
  • Verification Coordinator: Expertise certification assessment only.
  • Admin: Full authority across moderation, verification, user lifecycle, and staff-role governance.

Clone this wiki locally