@@ -38,34 +38,6 @@ qx.Class.define("osparc.share.CollaboratorsFunction", {
3838 }
3939 return canWrite ;
4040 } ,
41-
42- canGroupsDelete : function ( accessRights , gIds ) {
43- let canWrite = false ;
44- for ( let i = 0 ; i < gIds . length && ! canWrite ; i ++ ) {
45- const gid = gIds [ i ] ;
46- canWrite = ( gid in accessRights ) ? accessRights [ gid ] [ "delete" ] : false ;
47- }
48- return canWrite ;
49- } ,
50-
51- __getDeleters : function ( functionData ) {
52- const deleters = [ ] ;
53- Object . entries ( functionData [ "accessRights" ] ) . forEach ( ( [ key , value ] ) => {
54- if ( value [ "delete" ] ) {
55- deleters . push ( key ) ;
56- }
57- } ) ;
58- return deleters ;
59- } ,
60-
61- // checks that if the user to remove is an owner, there will still be another owner
62- canCollaboratorBeRemoved : function ( functionData , gid ) {
63- const ownerGids = this . __getDeleters ( functionData ) ;
64- if ( ownerGids . includes ( gid . toString ( ) ) ) {
65- return ownerGids . length > 1 ;
66- }
67- return true ;
68- } ,
6941 } ,
7042
7143 members : {
@@ -74,8 +46,8 @@ qx.Class.define("osparc.share.CollaboratorsFunction", {
7446 return ;
7547 }
7648
77- const readAccessRole = osparc . data . Roles . STUDY [ "read" ] ;
78- const writeAccessRole = osparc . data . Roles . STUDY [ "write" ] ;
49+ const readAccessRole = osparc . data . Roles . FUNCTION [ "read" ] ;
50+ const writeAccessRole = osparc . data . Roles . FUNCTION [ "write" ] ;
7951 if ( ! newAccessRights ) {
8052 newAccessRights = this . _resourceType === "function" ? writeAccessRole . accessRights : readAccessRole . accessRights ;
8153 }
@@ -131,7 +103,7 @@ qx.Class.define("osparc.share.CollaboratorsFunction", {
131103 } ,
132104
133105 _promoteToEditor : function ( collaborator , item ) {
134- const writeAccessRole = osparc . data . Roles . STUDY [ "write" ] ;
106+ const writeAccessRole = osparc . data . Roles . FUNCTION [ "write" ] ;
135107 this . __make (
136108 collaborator [ "gid" ] ,
137109 writeAccessRole . accessRights ,
@@ -142,18 +114,11 @@ qx.Class.define("osparc.share.CollaboratorsFunction", {
142114 } ,
143115
144116 _promoteToOwner : function ( collaborator , item ) {
145- const deleteAccessRole = osparc . data . Roles . STUDY [ "delete" ] ;
146- this . __make (
147- collaborator [ "gid" ] ,
148- deleteAccessRole . accessRights ,
149- this . tr ( `Successfully promoted to ${ deleteAccessRole . label } ` ) ,
150- this . tr ( `Something went wrong while promoting to ${ deleteAccessRole . label } ` ) ,
151- item
152- ) ;
117+ osparc . FlashMessenger . logAs ( this . tr ( "Operation not available" ) , "WARNING" ) ;
153118 } ,
154119
155120 _demoteToUser : async function ( collaborator , item ) {
156- const readAccessRole = osparc . data . Roles . STUDY [ "read" ] ;
121+ const readAccessRole = osparc . data . Roles . FUNCTION [ "read" ] ;
157122 const groupId = collaborator [ "gid" ] ;
158123 const demoteToUser = ( gid , itm ) => {
159124 this . __make (
@@ -186,14 +151,7 @@ qx.Class.define("osparc.share.CollaboratorsFunction", {
186151 } ,
187152
188153 _demoteToEditor : function ( collaborator , item ) {
189- const writeAccessRole = osparc . data . Roles . STUDY [ "write" ] ;
190- this . __make (
191- collaborator [ "gid" ] ,
192- writeAccessRole . accessRights ,
193- this . tr ( `Successfully demoted to ${ writeAccessRole . label } ` ) ,
194- this . tr ( `Something went wrong while demoting to ${ writeAccessRole . label } ` ) ,
195- item
196- ) ;
154+ osparc . FlashMessenger . logAs ( this . tr ( "Operation not available" ) , "WARNING" ) ;
197155 } ,
198156 }
199157} ) ;
0 commit comments