mirror of
https://github.com/ets-cfuhrman-pfe/EvalueTonSavoir.git
synced 2025-08-11 21:23:54 -04:00
Merge pull request #274 from ets-cfuhrman-pfe/debug-oidc-1
Some checks failed
CI/CD Pipeline for Backend / build_and_push_backend (push) Failing after 17s
CI/CD Pipeline for Nginx Router / build_and_push_nginx (push) Failing after 17s
CI/CD Pipeline for Frontend / build_and_push_frontend (push) Failing after 17s
Tests / lint-and-tests (client) (push) Failing after 1m7s
Tests / lint-and-tests (server) (push) Failing after 1m0s
Some checks failed
CI/CD Pipeline for Backend / build_and_push_backend (push) Failing after 17s
CI/CD Pipeline for Nginx Router / build_and_push_nginx (push) Failing after 17s
CI/CD Pipeline for Frontend / build_and_push_frontend (push) Failing after 17s
Tests / lint-and-tests (client) (push) Failing after 1m7s
Tests / lint-and-tests (server) (push) Failing after 1m0s
hard-code teacher role
This commit is contained in:
commit
8412218bb2
1 changed files with 11 additions and 1 deletions
|
|
@ -73,6 +73,8 @@ class ApiService {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log("ApiService: isLoggedIn: Token:", token);
|
||||||
|
|
||||||
// Update token expiry
|
// Update token expiry
|
||||||
this.saveToken(token);
|
this.saveToken(token);
|
||||||
|
|
||||||
|
|
@ -88,11 +90,19 @@ class ApiService {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
console.log("ApiService: isLoggedInTeacher: Token:", token);
|
||||||
const decodedToken = jwtDecode(token) as { roles: string[] };
|
const decodedToken = jwtDecode(token) as { roles: string[] };
|
||||||
|
|
||||||
|
/////// REMOVE BELOW
|
||||||
|
// automatically add teacher role if not present
|
||||||
|
if (!decodedToken.roles.includes('teacher')) {
|
||||||
|
decodedToken.roles.push('teacher');
|
||||||
|
}
|
||||||
|
////// REMOVE ABOVE
|
||||||
const userRoles = decodedToken.roles;
|
const userRoles = decodedToken.roles;
|
||||||
const requiredRole = 'teacher';
|
const requiredRole = 'teacher';
|
||||||
|
|
||||||
|
console.log("ApiService: isLoggedInTeacher: UserRoles:", userRoles);
|
||||||
if (!userRoles || !userRoles.includes(requiredRole)) {
|
if (!userRoles || !userRoles.includes(requiredRole)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue