Skip to content

Commit 02f1b04

Browse files
committed
Added access levels
1 parent 595c286 commit 02f1b04

File tree

1 file changed

+36
-1
lines changed

1 file changed

+36
-1
lines changed

src/visu/pars/Objectmanagement/Objects/basicObject.ts

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ export function createBasicObject(basicShape: IBasicShape, dynamicElements : Map
2121
let fillColor = (basicShape.has_inside_color) ? basicShape.fill_color : 'none';
2222
// Tooltip
2323
let tooltip = basicShape.tooltip;
24-
let relPoints = [] as number[][];
2524

2625
// Create an object with the initial parameters
2726
let initial : IBasicObject= {
@@ -59,6 +58,9 @@ export function createBasicObject(basicShape: IBasicShape, dynamicElements : Map
5958
transformedCornerCoord : absCornerCoord,
6059
relCoord : relCoord,
6160
relMidpointCoord : relMidpointCoord,
61+
// Access variables
62+
writeAccess : true,
63+
readAccess : true
6264
}
6365

6466
// Processing the variables for visual elements
@@ -437,5 +439,38 @@ export function createBasicObject(basicShape: IBasicShape, dynamicElements : Map
437439
}
438440
});
439441

442+
// Define the object access variables
443+
Object.defineProperty(initial, "writeAccess", {
444+
get: function() {
445+
let current = ComSocket.singleton().oVisuVariables.get(".currentuserlevel")!.value;
446+
let currentNum = Number(current);
447+
if (currentNum !== NaN){
448+
if (basicShape.access_levels[currentNum].includes("w")){
449+
return true
450+
} else {
451+
return false
452+
}
453+
} else {
454+
return (false)
455+
}
456+
}
457+
});
458+
459+
Object.defineProperty(initial, "readAccess", {
460+
get: function() {
461+
let current = ComSocket.singleton().oVisuVariables.get(".currentuserlevel")!.value;
462+
let currentNum = Number(current);
463+
if (currentNum !== NaN){
464+
if (basicShape.access_levels[currentNum].includes("r")){
465+
return true
466+
} else {
467+
return false
468+
}
469+
} else {
470+
return (false)
471+
}
472+
}
473+
});
474+
440475
return initial;
441476
}

0 commit comments

Comments
 (0)