1- monkvision/backend/apps/monkvision/db/users.db:
Added roleID column in users table
Added a new user for testing , credentials are :
username : test1@gmail.com
password : test1123
this user has roleID as 2 which points to dba role in roles table.
Added roles table with columns (role , roleID)
2-monkvision/backend/apps/monkvision/apis/lib/userid.js :
modified login() using JOIN on roles table to return role for logged in user.
3-monkvision/backend/apps/monkvision/apis/login.js :
modified login api to return role along with other data
FRONTEND:
4- monkvision/frontend/apps/monkvision/js/loginmanager.mjs:
modified to set the current role as resp.role
5- monkvision/frontend/apps/monkvision/js/constants.mjs:
modified to add 2 test roles namely admin and dba
admin has rights to view all three dashboard (dash1,dash2,dash3)
dba has rights to view only dash2.
6- monkvision/frontend/apps/monkvision/js/main.mjs:
modified to show/hide dashboard icon based on the result of securityguard.isAllowed() function using a new variable showDash.
7- monkvision/frontend/apps/monkvision/main.html :
modified to add a condition before showing the dashboard icon using {{#showDash}} if-else .
Role based dashboard access
Following files have been changed:
BACKEND:
1- monkvision/backend/apps/monkvision/db/users.db: Added roleID column in users table Added a new user for testing , credentials are : username : test1@gmail.com password : test1123 this user has roleID as 2 which points to dba role in roles table. Added roles table with columns (role , roleID)
2-monkvision/backend/apps/monkvision/apis/lib/userid.js : modified login() using JOIN on roles table to return role for logged in user.
3-monkvision/backend/apps/monkvision/apis/login.js : modified login api to return role along with other data
FRONTEND:
4- monkvision/frontend/apps/monkvision/js/loginmanager.mjs: modified to set the current role as resp.role
5- monkvision/frontend/apps/monkvision/js/constants.mjs: modified to add 2 test roles namely admin and dba admin has rights to view all three dashboard (dash1,dash2,dash3) dba has rights to view only dash2.
6- monkvision/frontend/apps/monkvision/js/main.mjs: modified to show/hide dashboard icon based on the result of securityguard.isAllowed() function using a new variable showDash.
7- monkvision/frontend/apps/monkvision/main.html : modified to add a condition before showing the dashboard icon using {{#showDash}} if-else .