@@ -122,36 +122,40 @@ qx.Class.define("osparc.dashboard.CardBase", {
122122 const groupsStore = osparc . store . Groups . getInstance ( ) ;
123123 const myGroupId = groupsStore . getMyGroupId ( ) ;
124124
125- if ( sharedWith === "show-all" ) {
126- // show all
127- return false ;
128- } else if ( sharedWith === "shared-with-everyone" ) {
129- const everyoneGroupIds = [
130- groupsStore . getEveryoneProductGroup ( ) . getGroupId ( ) ,
131- groupsStore . getEveryoneGroup ( ) . getGroupId ( ) ,
132- ] ;
133- const found = Object . keys ( checks ) . some ( gId => everyoneGroupIds . includes ( parseInt ( gId ) ) ) ;
134- // show those that are shared with "1" or product everyone's groupId
135- return ! found ;
136- } else if ( sharedWith === "my-resources" ) {
137- if ( myGroupId in checks ) {
138- const myAccessRights = checks [ myGroupId ] ;
139- const totalAccess = "delete" in myAccessRights ? myAccessRights [ "delete" ] : myAccessRights [ "write" ] ;
140- // show those that I have ownership of: have explicit delete (study/template) or write (service) access
141- return ! totalAccess ;
125+ switch ( sharedWith ) {
126+ case "show-all" :
127+ return false ;
128+ case "shared-with-everyone" : {
129+ const everyoneGroupIds = [
130+ groupsStore . getEveryoneProductGroup ( ) . getGroupId ( ) ,
131+ groupsStore . getEveryoneGroup ( ) . getGroupId ( ) ,
132+ ] ;
133+ const found = Object . keys ( checks ) . some ( gId => everyoneGroupIds . includes ( parseInt ( gId ) ) ) ;
134+ // show those that are shared with "1" or product everyone's groupId
135+ return ! found ;
142136 }
143- return true ;
144- } else if ( sharedWith === "shared-with-me" ) {
145- if ( myGroupId in checks ) {
146- const myAccessRights = checks [ myGroupId ] ;
147- const totalAccess = "delete" in myAccessRights ? myAccessRights [ "delete" ] : myAccessRights [ "write" ] ;
148- // hide those that I'm ownership of: have explicit and delete (study/template) or write (service) access
149- return totalAccess ;
137+ case "my-resources" : {
138+ if ( myGroupId in checks ) {
139+ const myAccessRights = checks [ myGroupId ] ;
140+ const totalAccess = "delete" in myAccessRights ? myAccessRights [ "delete" ] : myAccessRights [ "write" ] ;
141+ // show those that I have ownership of: have explicit delete (study/template) or write (service) access
142+ return ! totalAccess ;
143+ }
144+ return true ;
145+ }
146+ case "shared-with-me" : {
147+ if ( myGroupId in checks ) {
148+ const myAccessRights = checks [ myGroupId ] ;
149+ const totalAccess = "delete" in myAccessRights ? myAccessRights [ "delete" ] : myAccessRights [ "write" ] ;
150+ // hide those that I'm ownership of: have explicit and delete (study/template) or write (service) access
151+ return totalAccess ;
152+ }
153+ // if we get here, it means that it was shared-with-me via an organization
154+ return false ;
150155 }
151- // if we get here, it means that it was shared-with-me via an organization
152- return false ;
156+ default :
157+ return true ;
153158 }
154- return true ;
155159 }
156160 return false ;
157161 } ,
0 commit comments