Fix some enhancements & new features

This commit is contained in:
Ludovic CANDELLIER
2020-07-26 16:51:45 +02:00
parent fcd26d13de
commit 1179b5ca31
54 changed files with 975 additions and 341 deletions

View File

@@ -0,0 +1,29 @@
function getCurrentUser() {
var user = $('#current_user').html();
return (typeof(user) != 'undefined') ? user : false;
}
function isConnected() {
return getCurrentUser() ? true : false;
}
function hasRole(str) {
return checkRole('admin') ? true : checkRole(str);
}
function checkRole(str) {
return (global.roles.indexOf(str) == -1 ) ? false : true;
}
function isAdmin() {
return hasRole('admin');
}
function hasPermission(str) {
if (isAdmin()) {
return true;
} else {
return (global.permissions.indexOf(str) == -1 ) ? false : true;
}
}