Initial commit implementing sortable and filterable tables for attract using Vue.
42 lines
1.0 KiB
JavaScript
42 lines
1.0 KiB
JavaScript
class ProjectAuth {
|
|
constructor() {
|
|
this.canCreateTask = false;
|
|
this.canCreateAsset = false;
|
|
}
|
|
}
|
|
|
|
class Auth {
|
|
constructor() {
|
|
this.perProjectAuth = {}
|
|
}
|
|
|
|
canUserCreateTask(projectId) {
|
|
let projectAuth = this.getProjectAuth(projectId);
|
|
return projectAuth.canCreateTask;
|
|
}
|
|
|
|
canUserCreateAsset(projectId) {
|
|
let projectAuth = this.getProjectAuth(projectId);
|
|
return projectAuth.canCreateAsset;
|
|
}
|
|
|
|
setUserCanCreateTask(projectId, canCreateTask) {
|
|
let projectAuth = this.getProjectAuth(projectId);
|
|
projectAuth.canCreateTask = canCreateTask;
|
|
}
|
|
|
|
setUserCanCreateAsset(projectId, canCreateAsset) {
|
|
let projectAuth = this.getProjectAuth(projectId);
|
|
projectAuth.canCreateAsset = canCreateAsset;
|
|
}
|
|
|
|
getProjectAuth(projectId) {
|
|
this.perProjectAuth[projectId] = this.perProjectAuth[projectId] || new ProjectAuth();
|
|
return this.perProjectAuth[projectId];
|
|
}
|
|
}
|
|
|
|
let AttractAuth = new Auth();
|
|
|
|
export {AttractAuth}
|