Skip to main content

Instructor Currency Update - Permission Access Control

Overview

This update implements permission-based access control for safety training assignment, restricting navigation and functionality based on member level and trainer qualifications.

Change Request Summary

Update permissions on who can assign safety training by implementing access control at both navigation and functional levels.

Total Time Estimate

9.5-11.5 hours (excluding testing and requirement clarification)

Implementation Components

1. Navigation Access Control

Description: Update navigation to show instructor currency only for T2 Members

File: www/src/services/userService.js

Function: setUserNav

Changes:

  • Implement member level verification
  • Restrict currency navigation to T2+ members only

Time Estimate: 30 minutes

2. Checkbox Permission System

File: api/src/features/account/safety-training/service/instructor.service.js
Function: getInstructorCurrencyCheckboxes

Changes:

  • Add notallow or disable key in checkbox based on member level and skill
  • Create new functions to get Trainer level
  • Create new function to get Trainer specific skill for Instructor checkbox
  • Map out logic and add new key in checkbox
  • Return all applicable checkboxes with new key (frontend will disable accordingly)

Time Estimate: 4-5 hours

3. Backend Validation

File: api/src/features/account/safety-training/service/instructor.service.js
Function: saveInstructorMember

Changes:

  • Create validation function to verify checkbox values match permission logic
  • Prevent saving if entry is suspicious (either frontend or direct API call)
  • Implement security checks for unauthorized access attempts

Time Estimate: 2 hours

4. Frontend Checkbox Handling

File: www/src/assets/scripts/app/account/safety-training/templates/modal.instructor.js

Changes:

  • Handle new permission key and disable checkboxes accordingly
  • Update UI to show disabled state for restricted options

Time Estimate: 1 hour

5. Validation Logic Separation

Files:

  • www/src/assets/scripts/app/account/safety-training/views/modal.instructor.js
  • www/src/assets/scripts/app/account/safety-training/views/modal.instructor.validate.js

Changes:

  • Create new file to separate instructor validation from common trainer/military logic
  • Update validation logic and remove old sequence logic
  • Ensure compatibility with other currency types (Trainer, Military, Coach)

Time Estimate: 2-3 hours

6. Testing Requirements

Testing Scope:

  • Verify navigation restrictions for different member levels
  • Test checkbox disable functionality
  • Validate backend permission checks
  • Ensure compatibility across all currency types

Outstanding Questions

Logic Requirements

  1. Sequence Logic: Need final sequence logic specification
  2. Checkbox Disable Logic: Need final checkbox disable logic requirements
  3. Trainer Approval Level Update Logic:
    • Example scenario: Trainer is current and has proper levels and proper skill but approval level is not proper
    • Need clarification on Trainer Approval level increase module behavior

Dependencies

  • Final sequence logic specifications
  • Checkbox disable logic requirements
  • Trainer approval level update logic clarification