┌────┐ ┌───┐ ┌──────┐ ┌─────┐ │User│ │App│ │Server│ │Store│ └──┬─┘ └─┬─┘ └───┬──┘ └──┬──┘ │ Login │ │ │ │────────────────────────────────>│ │ │ │ │ │ │ │ │ Request Role │ │ │ │────────────────────────────────────────>│ │ │ │ │ │ ╔═══════════════════════════════╤═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╗ ║ alt Role == VervangIdentiteit │ │ │ │ ║ ╟───────────────────────────────┘ │ │ │ ║ ║ │ │ │ Show Switch User Button │ │ ║ ║ │ │ │<────────────────────────────────────────│ │ ║ ║ │ │ │ │ │ ║ ║ │ Request user switch │ │ │ │ ║ ║ │────────────────────────────────>│ │ │ ║ ║ │ │ │ │ │ ║ ║ │ │ │ Make data API call with student UPN │ │ ║ ║ │ │ │────────────────────────────────────────>│ │ ║ ║ │ │ │ │ │ ║ ║ │ │ │ Return The Response │ │ ║ ║ │ │ │< ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─│ │ ║ ║ │ │ │ │ │ ║ ║ │ │ ╔════════════════════════════════╤══════════════════════════════════════════════════════════════════════════════════╗ ║ ║ │ │ ║ alt Response Status is Success │ │ │ ║ ║ ║ │ │ ╟────────────────────────────────┘ │ │ ║ ║ ║ │ │ ║ │ │ Move│User Data to Impersonator Store │ ║ ║ ║ │ │ ║ │──────────────────────────────────────────────────────────────────────────────────────────────────────────────>│ ║ ║ ║ │ │ ║ │ │ │ │ ║ ║ ║ │ │ ║ │ Deregister From Push Notifications │ │ ║ ║ ║ │ │ ║ │────────────────────────────────────────>│ │ ║ ║ ║ │ │ ║ │ │ │ │ ║ ║ ║ │ │ ║ │ │ │ Clear User Store │ ║ ║ ║ │ │ ║ │──────────────────────────────────────────────────────────────────────────────────────────────────────────────>│ ║ ║ ║ │ │ ║ │ │ │ │ ║ ║ ║ │ │ ║ │ │ │ Add Student UPN As Header to Network Calls From Impersonator Store │ ║ ║ ║ │ │ ║ │ │ │<────────────────────────────────────────────────────────────────────│ ║ ║ ║ │ │ ║ │ │ │ │ ║ ║ ║ │ │ ║ │ Redirect to Home Page │ │ ║ ║ ║ │ │ ║ │< ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─│ │ ║ ║ ║ │ │ ║ │ │ │ │ ║ ║ ║ │ │ ║ │ Fetch Impersonated Student Data │ │ ║ ║ ║ │ │ ║ │────────────────────────────────────────>│ │ ║ ║ ║ │ │ ║ │ │ │ │ ║ ║ ║ │ │ ║─│Response Error is Error ─ ─ ─ ─ ─ ─ ─ ─ ─│─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─│─║ ║ ║ │ │ ╚════════════════════════════════╧══════════════════════════════════════════════════════════════════════════════════╝ ║ ║ │ │ ╔══════════════════════════════╤══════════════╗ │ ║ ║ │ │ ║ alt Response is Unauthorized │ │ ║ │ ║ ║ │ │ ╟──────────────────────────────┘ │ ║ │ ║ ║ │ │ ║ │ Show You Do Not Have The Right Message │ ║ │ ║ ║ │ │ ║ │<────────────────────────────────────────│ ║ │ ║ ║ │ │ ║ │ │ │ ║ │ ║ ║ │ │ ║─│Response is Other Error ─ ─ ─ ─ ─ ─ ─ ─ ─│─║ │ ║ ║ │ │ ║ │ Show Generic Error Message │ ║ │ ║ ║ │ │ ║ │<────────────────────────────────────────│ ║ │ ║ ║ │ │ ║ │ │ │ ║ │ ║ ║ │ │ ╚══════════════════════════════╧══════════════╝ │ ║ ║─│Role == Student ─ ─ ─ ─ ─ ─ ─│─ ─│─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─│─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─│─ ─║ ║ │ │ │ Show Regular User Interface │ │ ║ ║ │ │ │<────────────────────────────────────────│ │ ║ ║ │ │ │ │ │ ║ ╚═══════════════════════════════╧═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╝ │ Clicks Revert to Myself Button │ │ │ │────────────────────────────────>│ │ │ │ │ │ │ │ │ Move│Impersonator Store to User Store │ │ │──────────────────────────────────────────────────────────────────────────────────────────────────────────────>│ │ │ │ │ │ │ │ Clear Impersonator Store │ │ │──────────────────────────────────────────────────────────────────────────────────────────────────────────────>│ │ │ │ │ │ │ │ Remove Student UPN From The Headers │ │ │ │<────────────────────────────────────────────────────────────────────│ │ │ │ │ │ │ Register for Push Notifications │ │ │ │────────────────────────────────────────>│ │ │ │ │ │ │ │ Redirect to Home Page │ │ │ │< ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─│ │ │ │ │ │ │ │ Fetch User Data │ │ │ │────────────────────────────────────────>│ │ │ │ │ │ ┌──┴─┐ ┌─┴─┐ ┌───┴──┐ ┌──┴──┐ │User│ │App│ │Server│ │Store│ └────┘ └───┘ └──────┘ └─────┘