Skip to content

Commit e2afd0a

Browse files
committed
TAGS
1 parent be6dd57 commit e2afd0a

File tree

1 file changed

+18
-37
lines changed

1 file changed

+18
-37
lines changed

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

Lines changed: 18 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -38,30 +38,6 @@ qx.Class.define("osparc.share.CollaboratorsTag", {
3838
canIDelete: function(myAccessRights) {
3939
return myAccessRights["delete"];
4040
},
41-
42-
getViewerAccessRight: function() {
43-
return {
44-
"read": true,
45-
"write": false,
46-
"delete": false
47-
};
48-
},
49-
50-
getCollaboratorAccessRight: function() {
51-
return {
52-
"read": true,
53-
"write": true,
54-
"delete": false
55-
};
56-
},
57-
58-
getOwnerAccessRight: function() {
59-
return {
60-
"read": true,
61-
"write": true,
62-
"delete": true
63-
};
64-
}
6541
},
6642

6743
members: {
@@ -72,8 +48,9 @@ qx.Class.define("osparc.share.CollaboratorsTag", {
7248
return;
7349
}
7450

51+
const readAccessRole = osparc.data.Roles.STUDY["read"];
7552
const newCollaborators = {};
76-
gids.forEach(gid => newCollaborators[gid] = this.self().getViewerAccessRight());
53+
gids.forEach(gid => newCollaborators[gid] = readAccessRole.accessRights);
7754
osparc.store.Tags.getInstance().addCollaborators(this.__tag.getTagId(), newCollaborators)
7855
.then(() => {
7956
const text = this.tr("Tag successfully shared");
@@ -121,41 +98,45 @@ qx.Class.define("osparc.share.CollaboratorsTag", {
12198
},
12299

123100
_promoteToEditor: function(collaborator, item) {
101+
const writeAccessRole = osparc.data.Roles.STUDY["write"];
124102
this.__make(
125103
collaborator["gid"],
126-
this.self().getCollaboratorAccessRight(),
127-
this.tr(`Successfully promoted to ${osparc.data.Roles.STUDY["write"].label}`),
128-
this.tr(`Something went wrong while promoting to ${osparc.data.Roles.STUDY["write"].label}`),
104+
writeAccessRole.accessRights,
105+
this.tr(`Successfully promoted to ${writeAccessRole.label}`),
106+
this.tr(`Something went wrong while promoting to ${writeAccessRole.label}`),
129107
item
130108
);
131109
},
132110

133111
_promoteToOwner: function(collaborator, item) {
112+
const deleteAccessRole = osparc.data.Roles.STUDY["delete"];
134113
this.__make(
135114
collaborator["gid"],
136-
this.self().getOwnerAccessRight(),
137-
this.tr(`Successfully promoted to ${osparc.data.Roles.STUDY["delete"].label}`),
138-
this.tr(`Something went wrong while promoting to ${osparc.data.Roles.STUDY["delete"].label}`),
115+
deleteAccessRole.accessRights,
116+
this.tr(`Successfully promoted to ${deleteAccessRole.label}`),
117+
this.tr(`Something went wrong while promoting to ${deleteAccessRole.label}`),
139118
item
140119
);
141120
},
142121

143122
_demoteToUser: async function(collaborator, item) {
123+
const readAccessRole = osparc.data.Roles.STUDY["read"];
144124
this.__make(
145125
collaborator["gid"],
146-
this.self().getViewerAccessRight(),
147-
this.tr(`Successfully demoted to ${osparc.data.Roles.STUDY["read"].label}`),
148-
this.tr(`Something went wrong while demoting to ${osparc.data.Roles.STUDY["read"].label}`),
126+
readAccessRole.accessRights,
127+
this.tr(`Successfully demoted to ${readAccessRole.label}`),
128+
this.tr(`Something went wrong while demoting to ${readAccessRole.label}`),
149129
item
150130
);
151131
},
152132

153133
_demoteToEditor: function(collaborator, item) {
134+
const writeAccessRole = osparc.data.Roles.STUDY["write"];
154135
this.__make(
155136
collaborator["gid"],
156-
this.self().getCollaboratorAccessRight(),
157-
this.tr(`Successfully demoted to ${osparc.data.Roles.STUDY["write"].label}`),
158-
this.tr(`Something went wrong while demoting to ${osparc.data.Roles.STUDY["write"].label}`),
137+
writeAccessRole.accessRights,
138+
this.tr(`Successfully demoted to ${writeAccessRole.label}`),
139+
this.tr(`Something went wrong while demoting to ${writeAccessRole.label}`),
159140
item
160141
);
161142
}

0 commit comments

Comments
 (0)