Skip to content

Commit 95700cf

Browse files
committed
canIWrite
1 parent eaeddc5 commit 95700cf

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
lines changed

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,4 +135,21 @@ qx.Class.define("osparc.data.model.Function", {
135135
init: {}
136136
},
137137
},
138+
139+
statics: {
140+
canIWrite: function(accessRights) {
141+
const groupsStore = osparc.store.Groups.getInstance();
142+
const orgIDs = groupsStore.getOrganizationIds();
143+
orgIDs.push(groupsStore.getMyGroupId());
144+
if (orgIDs.length) {
145+
let canWrite = false;
146+
for (let i=0; i<gIds.length && !canWrite; i++) {
147+
const gid = gIds[i];
148+
canWrite = (gid in accessRights) ? accessRights[gid]["write"] : false;
149+
}
150+
return canWrite;
151+
}
152+
return false;
153+
},
154+
}
138155
});

services/static-webserver/client/source/class/osparc/info/FunctionLarge.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@ qx.Class.define("osparc.info.FunctionLarge", {
4646

4747
members: {
4848
__canIWrite: function() {
49-
// return osparc.data.model.Function.canIWrite(this.getFunction().getAccessRights());
50-
return true;
49+
return osparc.data.model.Function.canIWrite(this.getFunction().getAccessRights());
5150
},
5251

5352
_rebuildLayout: function() {
@@ -104,13 +103,6 @@ qx.Class.define("osparc.info.FunctionLarge", {
104103
ctx: this
105104
}
106105
},
107-
/*
108-
"AUTHOR": {
109-
label: this.tr("Author"),
110-
view: osparc.info.StudyUtils.createOwner(this.getFunction()),
111-
action: null
112-
},
113-
*/
114106
"ACCESS_RIGHTS": {
115107
label: this.tr("Access"),
116108
view: osparc.info.StudyUtils.createAccessRights(this.getFunction()),

0 commit comments

Comments
 (0)