TekMonksGitHub / monkvision

Dashboarding framework
Other
1 stars 10 forks source link

role based dashboard access #39

Closed ritikaSrivastava11 closed 3 years ago

ritikaSrivastava11 commented 3 years ago

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 .

TekMonksGitHub commented 3 years ago

See code comments - rejecting for revision.