Trading Assistant API Documentation - v0.1.0
    Preparing search index...

    Function canChangeRole

    • Validate role transition Checks if a role change is allowed based on business rules

      Parameters

      • currentRole: UserRole

        Current user role

      • newRole: UserRole

        Proposed new role

      • actorRole: UserRole

        Role of user making the change

      Returns boolean

      true if role transition is valid

      canChangeRole('customer', 'admin', 'superadmin') // true
      canChangeRole('admin', 'superadmin', 'admin') // false