Skip to content

Commit a215c9d

Browse files
committed
myAccessRights
1 parent 766ee8f commit a215c9d

File tree

2 files changed

+12
-35
lines changed

2 files changed

+12
-35
lines changed

services/static-webserver/client/source/class/osparc/data/model/Tag.js

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ qx.Class.define("osparc.data.model.Tag", {
3333
name: tagData.name,
3434
description: tagData.description,
3535
color: tagData.color,
36-
accessRights: tagData.accessRights,
36+
myAccessRights: tagData.accessRights,
3737
});
3838
},
3939

@@ -65,6 +65,13 @@ qx.Class.define("osparc.data.model.Tag", {
6565
init: "#303030"
6666
},
6767

68+
myAccessRights: {
69+
check: "Object",
70+
nullable: false,
71+
init: null,
72+
event: "changeMyAccessRights"
73+
},
74+
6875
accessRights: {
6976
check: "Object",
7077
nullable: false,
@@ -74,24 +81,12 @@ qx.Class.define("osparc.data.model.Tag", {
7481
},
7582

7683
statics: {
77-
canIWrite: function(tagAccessRights) {
78-
const groupsStore = osparc.store.Groups.getInstance();
79-
const orgIDs = groupsStore.getOrganizationIds();
80-
orgIDs.push(groupsStore.getMyGroupId());
81-
if (orgIDs.length) {
82-
return osparc.share.CollaboratorsTag.canGroupsWrite(tagAccessRights, (orgIDs));
83-
}
84-
return false;
84+
canIWrite: function(myAccessRights) {
85+
return myAccessRights["write"];
8586
},
8687

87-
canIDelete: function(tagAccessRights) {
88-
const groupsStore = osparc.store.Groups.getInstance();
89-
const orgIDs = groupsStore.getOrganizationIds();
90-
orgIDs.push(groupsStore.getMyGroupId());
91-
if (orgIDs.length) {
92-
return osparc.share.CollaboratorsTag.canGroupsDelete(tagAccessRights, (orgIDs));
93-
}
94-
return false;
88+
canIDelete: function(myAccessRights) {
89+
return myAccessRights["delete"];
9590
},
9691
},
9792

services/static-webserver/client/source/class/osparc/share/CollaboratorsTag.js

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -31,24 +31,6 @@ qx.Class.define("osparc.share.CollaboratorsTag", {
3131
},
3232

3333
statics: {
34-
canGroupsWrite: function(accessRights, gIds) {
35-
let canWrite = false;
36-
for (let i=0; i<gIds.length && !canWrite; i++) {
37-
const gid = gIds[i];
38-
canWrite = (gid in accessRights) ? accessRights[gid]["write"] : false;
39-
}
40-
return canWrite;
41-
},
42-
43-
canGroupsDelete: function(accessRights, gIds) {
44-
let canWrite = false;
45-
for (let i=0; i<gIds.length && !canWrite; i++) {
46-
const gid = gIds[i];
47-
canWrite = (gid in accessRights) ? accessRights[gid]["delete"] : false;
48-
}
49-
return canWrite;
50-
},
51-
5234
getViewerAccessRight: function() {
5335
return {
5436
"read": true,

0 commit comments

Comments
 (0)