File tree Expand file tree Collapse file tree 1 file changed +21
-6
lines changed Expand file tree Collapse file tree 1 file changed +21
-6
lines changed Original file line number Diff line number Diff line change @@ -132,12 +132,27 @@ export class CreateKeyboardStatisticsCommand extends AbstractCommand<ICreateKeyb
132132 } ;
133133 }
134134 const keyboardDefinition = keyboardDefinitionSnapshot . data ( ) ! ;
135- if ( keyboardDefinition . author_uid !== uid ) {
136- return {
137- success : false ,
138- errorCode : ERROR_KEYBOARD_DEFINITION_NOT_FOUND ,
139- errorMessage : `The user is not an owner of the keyboard definition ${ keyboardDefinitionId } .` ,
140- } ;
135+ if ( keyboardDefinition . author_type === 'organization' ) {
136+ const organizationId = keyboardDefinition . organization_id ;
137+ const result = await this . checkUserIsOrganizationMember (
138+ uid ,
139+ organizationId
140+ ) ;
141+ if ( ! result ) {
142+ return {
143+ success : false ,
144+ errorCode : ERROR_KEYBOARD_DEFINITION_NOT_FOUND ,
145+ errorMessage : `The user is not a member of the organization ${ organizationId } .` ,
146+ } ;
147+ }
148+ } else {
149+ if ( keyboardDefinition . author_uid !== uid ) {
150+ return {
151+ success : false ,
152+ errorCode : ERROR_KEYBOARD_DEFINITION_NOT_FOUND ,
153+ errorMessage : `The user is not an owner of the keyboard definition ${ keyboardDefinitionId } .` ,
154+ } ;
155+ }
141156 }
142157 return {
143158 success : true ,
You can’t perform that action at this time.
0 commit comments