forked from projects/fipamo
113 lines
2.6 KiB
JavaScript
113 lines
2.6 KiB
JavaScript
|
var roles = {
|
||
|
hnic: {
|
||
|
"client_admin": {
|
||
|
"create": true,
|
||
|
"read": true,
|
||
|
"update": true,
|
||
|
"delete": true
|
||
|
},
|
||
|
"client_user": {
|
||
|
"create": true,
|
||
|
"read": true,
|
||
|
"update": true,
|
||
|
"delete": true
|
||
|
},
|
||
|
"client_project": {
|
||
|
"create": true,
|
||
|
"read": true,
|
||
|
"update": true,
|
||
|
"delete": true
|
||
|
},
|
||
|
"folio_project": {
|
||
|
"create": true,
|
||
|
"read": true,
|
||
|
"update": true,
|
||
|
"delete": true
|
||
|
},
|
||
|
"bookmark": {
|
||
|
"create": true,
|
||
|
"read": true,
|
||
|
"update": true,
|
||
|
"delete": true
|
||
|
}
|
||
|
|
||
|
},
|
||
|
client: {
|
||
|
"client_admin": {
|
||
|
"create": false,
|
||
|
"read": true,
|
||
|
"update": false,
|
||
|
"delete": false
|
||
|
},
|
||
|
"client_user": {
|
||
|
"create": true,
|
||
|
"read": true,
|
||
|
"update": true,
|
||
|
"delete": true
|
||
|
},
|
||
|
"client_project": {
|
||
|
"create": true,
|
||
|
"read": true,
|
||
|
"update": true,
|
||
|
"delete": false
|
||
|
},
|
||
|
"folio_project": {
|
||
|
"create": false,
|
||
|
"read": false,
|
||
|
"update": false,
|
||
|
"delete": false
|
||
|
}
|
||
|
},
|
||
|
user: {
|
||
|
"client_admin": {
|
||
|
"create": false,
|
||
|
"read": false,
|
||
|
"update": false,
|
||
|
"delete": false
|
||
|
},
|
||
|
"client_user": {
|
||
|
"create": false,
|
||
|
"read": true,
|
||
|
"update": false,
|
||
|
"delete": false
|
||
|
},
|
||
|
"client_project": {
|
||
|
"create": false,
|
||
|
"read": true,
|
||
|
"update": true,
|
||
|
"delete": false
|
||
|
},
|
||
|
"folio_project": {
|
||
|
"create": false,
|
||
|
"read": false,
|
||
|
"update": false,
|
||
|
"delete": false
|
||
|
},
|
||
|
"bookmark": {
|
||
|
"create": true,
|
||
|
"read": true,
|
||
|
"update": true,
|
||
|
"delete": true
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
module.exports = {
|
||
|
TASK_CREATE: 'create',
|
||
|
TASK_UPDATE: 'update',
|
||
|
TASK_READ: 'read',
|
||
|
TASK_DELETE: 'delete',
|
||
|
OBJECT_CLIENT_ADMIN: 'client_admin',
|
||
|
OBJECT_CLIENT_USER: 'client_user',
|
||
|
OBJECT_PROJECT_CLIENT: 'client_project',
|
||
|
OBJECT_PROJECT_FOLIO: 'folio_project',
|
||
|
OBJECT_BOOKMARK: 'bookmark',
|
||
|
check: function(role, object, task) {
|
||
|
for (var i = 0; i < object.length; i++) {
|
||
|
if(!roles[role][object[i]][task])
|
||
|
return false
|
||
|
}
|
||
|
return true;
|
||
|
},
|
||
|
hey: function() {}
|
||
|
};
|