@@ -31,11 +31,13 @@ qx.Class.define("osparc.component.permissions.Study", {
3131 * @param studyData {Object} Object containing the serialized Study Data
3232 */
3333 construct : function ( studyData ) {
34+ // this info is lost when we deepCloneStudyObject
35+ this . __resourceType = studyData [ "resourceType" ] ;
3436 this . __studyData = osparc . data . model . Study . deepCloneStudyObject ( studyData ) ;
3537
3638 const initCollabs = [ ] ;
3739 if ( osparc . data . Permissions . getInstance ( ) . canDo ( "study.everyone.share" ) ) {
38- initCollabs . push ( this . self ( ) . getEveryoneObj ( ) ) ;
40+ initCollabs . push ( this . self ( ) . getEveryoneObj ( this . __resourceType === "study" ) ) ;
3941 }
4042 this . base ( arguments , this . __studyData , initCollabs ) ;
4143 } ,
@@ -95,20 +97,21 @@ qx.Class.define("osparc.component.permissions.Study", {
9597 return delete studyData [ "accessRights" ] [ gid ] ;
9698 } ,
9799
98- getEveryoneObj : function ( ) {
100+ getEveryoneObj : function ( isResourceStudy ) {
99101 return {
100102 "gid" : 1 ,
101103 "label" : "Everyone" ,
102104 "description" : "" ,
103105 "thumbnail" : null ,
104- "accessRights" : this . getCollaboratorAccessRight ( ) ,
106+ "accessRights" : isResourceStudy ? this . getCollaboratorAccessRight ( ) : this . getViewerAccessRight ( ) ,
105107 "collabType" : 0
106108 } ;
107109 }
108110 } ,
109111
110112 members : {
111113 __studyData : null ,
114+ __resourceType : null ,
112115
113116 _isUserOwner : function ( ) {
114117 return osparc . data . model . Study . isOwner ( this . __studyData ) ;
@@ -121,7 +124,7 @@ qx.Class.define("osparc.component.permissions.Study", {
121124 }
122125
123126 gids . forEach ( gid => {
124- this . __studyData [ "accessRights" ] [ gid ] = this . self ( ) . getCollaboratorAccessRight ( ) ;
127+ this . __studyData [ "accessRights" ] [ gid ] = this . __resourceType === "study" ? this . self ( ) . getCollaboratorAccessRight ( ) : this . self ( ) . getViewerAccessRight ( ) ;
125128 } ) ;
126129 const params = {
127130 url : {
0 commit comments