2018-11-11 20:49:26 +01:00
|
|
|
export const 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
|
|
|
|
},
|
|
|
|
"post":
|
2018-12-19 18:56:18 +01:00
|
|
|
{
|
|
|
|
"create": true,
|
|
|
|
"read": true,
|
|
|
|
"update": true,
|
|
|
|
"delete": true
|
|
|
|
},
|
|
|
|
"settings":
|
2018-11-11 20:49:26 +01:00
|
|
|
{
|
|
|
|
"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
|
|
|
|
},
|
|
|
|
"post":
|
|
|
|
{
|
|
|
|
"create": false,
|
|
|
|
"read": false,
|
|
|
|
"update": false,
|
|
|
|
"delete": false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
export const TASK_CREATE = 'create'
|
|
|
|
export const TASK_UPDATE = 'update'
|
|
|
|
export const TASK_READ = 'read'
|
|
|
|
export const TASK_DELETE = 'delete'
|
|
|
|
export const OBJECT_CLIENT_ADMIN = 'client_admin'
|
|
|
|
export const OBJECT_CLIENT_USER = 'client_user'
|
|
|
|
export const OBJECT_PROJECT_CLIENT = 'client_project'
|
|
|
|
export const OBJECT_PROJECT_FOLIO = 'folio_project'
|
|
|
|
export const OBJECT_BOOKMARK = 'bookmark'
|
|
|
|
export const OBJECT_POST = 'post'
|
2018-12-19 18:56:18 +01:00
|
|
|
export const OBJECT_SETTINGS = 'settings'
|
2018-11-11 20:49:26 +01:00
|
|
|
export default class RightsManager
|
|
|
|
{
|
|
|
|
//--------------------------
|
|
|
|
// constructor
|
|
|
|
//--------------------------
|
|
|
|
constructor()
|
|
|
|
{
|
|
|
|
var self = this;
|
|
|
|
}
|
|
|
|
//--------------------------
|
|
|
|
// methods
|
|
|
|
//--------------------------
|
|
|
|
check(role, object, task)
|
|
|
|
{
|
2018-12-08 19:21:48 +01:00
|
|
|
//console.log(role + " *** " + object + " *** " + task);
|
2018-11-11 20:49:26 +01:00
|
|
|
return roles[role][object][task];
|
|
|
|
}
|
|
|
|
//--------------------------
|
|
|
|
// event handlers
|
|
|
|
//--------------------------
|
|
|
|
}
|