Skip to content

Commit 3c05604

Browse files
authored
[Frontend] 🎨 TIP enhancements (#6197)
1 parent 68f1951 commit 3c05604

File tree

4 files changed

+17
-11
lines changed

4 files changed

+17
-11
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ qx.Class.define("osparc.data.Permissions", {
233233
},
234234

235235
// https://blog.nodeswat.com/implement-access-control-in-node-js-8567e7b484d1#2405
236-
__canRoleDo: function(role, action) {
236+
canRoleDo: function(role, action) {
237237
role = role.toLowerCase();
238238
// Check if role exists
239239
const roles = this.self().ROLES_APP;
@@ -250,13 +250,13 @@ qx.Class.define("osparc.data.Permissions", {
250250
return false;
251251
}
252252
// Check child roles until one returns true or all return false
253-
return roleObj.inherits.some(childRole => this.__canRoleDo(childRole, action));
253+
return roleObj.inherits.some(childRole => this.canRoleDo(childRole, action));
254254
},
255255

256256
canDo: function(action, showMsg) {
257257
let canDo = false;
258258
if (this.getRole()) {
259-
canDo = this.__canRoleDo(this.getRole(), action);
259+
canDo = this.canRoleDo(this.getRole(), action);
260260
}
261261
if (showMsg && !canDo) {
262262
let msg = "Operation not permitted";

services/static-webserver/client/source/class/osparc/desktop/account/MyAccount.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,14 @@ qx.Class.define("osparc.desktop.account.MyAccount", {
6868
converter: lastName => authData.getFirstName() + " " + lastName
6969
});
7070

71-
const role = authData.getFriendlyRole();
72-
const roleLabel = new qx.ui.basic.Label(role).set({
73-
font: "text-13",
74-
alignX: "center"
75-
});
76-
layout.add(roleLabel);
71+
if (authData.getRole() !== "user") {
72+
const role = authData.getFriendlyRole();
73+
const roleLabel = new qx.ui.basic.Label(role).set({
74+
font: "text-13",
75+
alignX: "center"
76+
});
77+
layout.add(roleLabel);
78+
}
7779

7880
const emailLabel = new qx.ui.basic.Label(email).set({
7981
font: "text-13",

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,11 @@ qx.Class.define("osparc.share.CollaboratorsStudy", {
262262
const uid = collab["id"];
263263
if (this._resourceType === "study") {
264264
osparc.notification.Notifications.postNewStudy(uid, this._serializedDataCopy["uuid"]);
265-
} else {
266-
osparc.notification.Notifications.postNewTemplate(uid, this._serializedDataCopy["uuid"]);
265+
} else if (this._resourceType === "template") {
266+
// do not push TEMPLATE_SHARED notification if users are not supposed to see the templates
267+
if (osparc.data.Permissions.getInstance().canRoleDo("user", "dashboard.templates.read")) {
268+
osparc.notification.Notifications.postNewTemplate(uid, this._serializedDataCopy["uuid"]);
269+
}
267270
}
268271
}
269272
});

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ qx.Class.define("osparc.share.ShareePermissions", {
5555
.then(metadata => {
5656
label.setValue(metadata["name"] + " : " + metadata["version"])
5757
infoButton.addListener("execute", () => {
58+
metadata["resourceType"] = "service";
5859
const resourceDetails = new osparc.dashboard.ResourceDetails(metadata);
5960
osparc.dashboard.ResourceDetails.popUpInWindow(resourceDetails);
6061
}, this);

0 commit comments

Comments
 (0)