Skip to content

Commit eb24d6b

Browse files
Merge branch 'master' into fix-api-base-url-generation
2 parents fcd1abb + 21fce72 commit eb24d6b

File tree

2 files changed

+34
-18
lines changed

2 files changed

+34
-18
lines changed

services/static-webserver/client/source/class/osparc/dashboard/CardBase.js

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -118,31 +118,44 @@ qx.Class.define("osparc.dashboard.CardBase", {
118118
},
119119

120120
filterSharedWith: function(checks, sharedWith) {
121-
if (sharedWith && sharedWith !== "show-all") {
121+
if (sharedWith && checks) {
122122
const groupsStore = osparc.store.Groups.getInstance();
123123
const myGroupId = groupsStore.getMyGroupId();
124-
if (checks && myGroupId in checks) {
125-
const myAccessRights = checks[myGroupId];
126-
const totalAccess = "delete" in myAccessRights ? myAccessRights["delete"] : myAccessRights["write"];
127-
if (sharedWith === "my-resources") {
128-
return !totalAccess;
129-
} else if (sharedWith === "shared-with-me") {
130-
return totalAccess;
131-
} else if (sharedWith === "shared-with-everyone") {
124+
125+
switch (sharedWith) {
126+
case "show-all":
127+
return false;
128+
case "my-resources": {
129+
if (myGroupId in checks) {
130+
const myAccessRights = checks[myGroupId];
131+
const totalAccess = "delete" in myAccessRights ? myAccessRights["delete"] : myAccessRights["write"];
132+
// show those that I have ownership of: have explicit delete (study/template) or write (service) access
133+
return !totalAccess;
134+
}
135+
return true;
136+
}
137+
case "shared-with-me": {
138+
if (myGroupId in checks) {
139+
const myAccessRights = checks[myGroupId];
140+
const totalAccess = "delete" in myAccessRights ? myAccessRights["delete"] : myAccessRights["write"];
141+
// hide those that I'm ownership of: have explicit and delete (study/template) or write (service) access
142+
return totalAccess;
143+
}
144+
// if we get here, it means that it was shared-with-me via an organization
145+
return false;
146+
}
147+
case "shared-with-everyone": {
132148
const everyoneGroupIds = [
133149
groupsStore.getEveryoneProductGroup().getGroupId(),
134150
groupsStore.getEveryoneGroup().getGroupId(),
135151
];
136152
const found = Object.keys(checks).some(gId => everyoneGroupIds.includes(parseInt(gId)));
153+
// show those that are shared with "1" or product everyone's groupId
137154
return !found;
138155
}
139-
return false;
140-
}
141-
// if we get here, it means that it was shared-with-me via an organization
142-
if (sharedWith === "shared-with-me") {
143-
return false;
156+
default:
157+
return true;
144158
}
145-
return true;
146159
}
147160
return false;
148161
},

services/static-webserver/client/source/class/osparc/dashboard/SearchBarFilter.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,14 @@ qx.Class.define("osparc.dashboard.SearchBarFilter", {
4747
getSharedWithOptions: function(resourceType) {
4848
return [{
4949
id: "show-all",
50-
label: qx.locale.Manager.tr("All ") + osparc.product.Utils.resourceTypeToAlias(resourceType, {
50+
label: qx.locale.Manager.tr("All") + " " + osparc.product.Utils.resourceTypeToAlias(resourceType, {
5151
firstUpperCase: true,
5252
plural: true
5353
}),
5454
icon: "@FontAwesome5Solid/home/20"
5555
}, {
5656
id: "my-resources",
57-
label: qx.locale.Manager.tr("My ") + osparc.product.Utils.resourceTypeToAlias(resourceType, {
57+
label: qx.locale.Manager.tr("My") + " " + osparc.product.Utils.resourceTypeToAlias(resourceType, {
5858
firstUpperCase: true,
5959
plural: true
6060
}),
@@ -65,7 +65,10 @@ qx.Class.define("osparc.dashboard.SearchBarFilter", {
6565
icon: "@FontAwesome5Solid/users/20"
6666
}, {
6767
id: "shared-with-everyone",
68-
label: qx.locale.Manager.tr("Shared with Everyone"),
68+
label: qx.locale.Manager.tr("Public") + " " + osparc.product.Utils.resourceTypeToAlias(resourceType, {
69+
firstUpperCase: true,
70+
plural: true
71+
}),
6972
icon: "@FontAwesome5Solid/globe/20"
7073
}];
7174
}

0 commit comments

Comments
 (0)