@@ -349,22 +349,16 @@ qx.Class.define("osparc.desktop.organizations.MembersList", {
349349 return ;
350350 }
351351
352- const params = {
353- url : {
354- "gid" : this . __currentOrg . getGroupId ( ) ,
355- "uid" : "id" in listedMember ? listedMember [ "id" ] : listedMember [ "key" ]
356- } ,
357- data : {
358- "accessRights" : this . self ( ) . getNoReadAccess ( )
359- }
360- } ;
361- osparc . data . Resources . fetch ( "organizationMembers" , "patch" , params )
352+ const orgId = this . __currentOrg . getGroupId ( ) ;
353+ const userId = "id" in listedMember ? listedMember [ "id" ] : listedMember [ "key" ]
354+ const newAccessRights = this . self ( ) . getNoReadAccess ( ) ;
355+ const groupsStore = osparc . store . Groups . getInstance ( ) ;
356+ groupsStore . patchAccessRights ( orgId , userId , newAccessRights )
362357 . then ( ( ) => {
363358 if ( msg === undefined ) {
364359 msg = this . tr ( `Successfully demoted to ${ osparc . data . Roles . ORG [ 0 ] . label } ` ) ;
365360 }
366361 osparc . FlashMessenger . getInstance ( ) . logAs ( msg ) ;
367- osparc . store . Store . getInstance ( ) . reset ( "organizationMembers" ) ;
368362 this . __reloadOrgMembers ( ) ;
369363 } )
370364 . catch ( err => {
@@ -378,19 +372,13 @@ qx.Class.define("osparc.desktop.organizations.MembersList", {
378372 return ;
379373 }
380374
381- const params = {
382- url : {
383- "gid" : this . __currentOrg . getGroupId ( ) ,
384- "uid" : listedMember [ "id" ]
385- } ,
386- data : {
387- "accessRights" : this . self ( ) . getWriteAccess ( )
388- }
389- } ;
390- osparc . data . Resources . fetch ( "organizationMembers" , "patch" , params )
375+ const orgId = this . __currentOrg . getGroupId ( ) ;
376+ const userId = listedMember [ "id" ] ;
377+ const newAccessRights = this . self ( ) . getWriteAccess ( ) ;
378+ const groupsStore = osparc . store . Groups . getInstance ( ) ;
379+ groupsStore . patchAccessRights ( orgId , userId , newAccessRights )
391380 . then ( ( ) => {
392381 osparc . FlashMessenger . getInstance ( ) . logAs ( this . tr ( `Successfully promoted to ${ osparc . data . Roles . ORG [ 2 ] . label } ` ) ) ;
393- osparc . store . Store . getInstance ( ) . reset ( "organizationMembers" ) ;
394382 this . __reloadOrgMembers ( ) ;
395383 } )
396384 . catch ( err => {
@@ -404,19 +392,13 @@ qx.Class.define("osparc.desktop.organizations.MembersList", {
404392 return ;
405393 }
406394
407- const params = {
408- url : {
409- "gid" : this . __currentOrg . getGroupId ( ) ,
410- "uid" : listedMember [ "id" ]
411- } ,
412- data : {
413- "accessRights" : this . self ( ) . getDeleteAccess ( )
414- }
415- } ;
416- osparc . data . Resources . fetch ( "organizationMembers" , "patch" , params )
395+ const orgId = this . __currentOrg . getGroupId ( ) ;
396+ const userId = listedMember [ "id" ] ;
397+ const newAccessRights = this . self ( ) . getDeleteAccess ( ) ;
398+ const groupsStore = osparc . store . Groups . getInstance ( ) ;
399+ groupsStore . patchAccessRights ( orgId , userId , newAccessRights )
417400 . then ( ( ) => {
418401 osparc . FlashMessenger . getInstance ( ) . logAs ( this . tr ( `Successfully promoted to ${ osparc . data . Roles . ORG [ 3 ] . label } ` ) ) ;
419- osparc . store . Store . getInstance ( ) . reset ( "organizationMembers" ) ;
420402 this . __reloadOrgMembers ( ) ;
421403 } )
422404 . catch ( err => {
@@ -430,19 +412,13 @@ qx.Class.define("osparc.desktop.organizations.MembersList", {
430412 return ;
431413 }
432414
433- const params = {
434- url : {
435- "gid" : this . __currentOrg . getGroupId ( ) ,
436- "uid" : listedMember [ "id" ]
437- } ,
438- data : {
439- "accessRights" : this . self ( ) . getReadAccess ( )
440- }
441- } ;
442- osparc . data . Resources . fetch ( "organizationMembers" , "patch" , params )
415+ const orgId = this . __currentOrg . getGroupId ( ) ;
416+ const userId = listedMember [ "id" ] ;
417+ const newAccessRights = this . self ( ) . getReadAccess ( ) ;
418+ const groupsStore = osparc . store . Groups . getInstance ( ) ;
419+ groupsStore . patchAccessRights ( orgId , userId , newAccessRights )
443420 . then ( ( ) => {
444421 osparc . FlashMessenger . getInstance ( ) . logAs ( this . tr ( `Successfully demoted to ${ osparc . data . Roles . ORG [ 1 ] . label } ` ) ) ;
445- osparc . store . Store . getInstance ( ) . reset ( "organizationMembers" ) ;
446422 this . __reloadOrgMembers ( ) ;
447423 } )
448424 . catch ( err => {
@@ -456,19 +432,13 @@ qx.Class.define("osparc.desktop.organizations.MembersList", {
456432 return ;
457433 }
458434
459- const params = {
460- url : {
461- "gid" : this . __currentOrg . getGroupId ( ) ,
462- "uid" : listedMember [ "id" ]
463- } ,
464- data : {
465- "accessRights" : this . self ( ) . getWriteAccess ( )
466- }
467- } ;
468- osparc . data . Resources . fetch ( "organizationMembers" , "patch" , params )
435+ const orgId = this . __currentOrg . getGroupId ( ) ;
436+ const userId = listedMember [ "id" ] ;
437+ const newAccessRights = this . self ( ) . getWriteAccess ( ) ;
438+ const groupsStore = osparc . store . Groups . getInstance ( ) ;
439+ groupsStore . patchAccessRights ( orgId , userId , newAccessRights )
469440 . then ( ( ) => {
470441 osparc . FlashMessenger . getInstance ( ) . logAs ( this . tr ( `Successfully demoted to ${ osparc . data . Roles . ORG [ 3 ] . label } ` ) ) ;
471- osparc . store . Store . getInstance ( ) . reset ( "organizationMembers" ) ;
472442 this . __reloadOrgMembers ( ) ;
473443 } )
474444 . catch ( err => {
0 commit comments