@@ -33,7 +33,7 @@ const TYPE_USER = 'User';
3333const TYPE_PASSWORD = 'Password' ;
3434const CREATE_REF = 'new1' ;
3535
36- const SUSPEND_PERMISSIONS = [ 'email-receive ' , 'email-send ' ] as const ;
36+ const SUSPEND_PERMISSIONS = [ 'emailReceive ' , 'emailSend ' ] as const ;
3737
3838export interface StalwartAccountCreate {
3939 name : string ;
@@ -205,16 +205,34 @@ export class StalwartService implements OnModuleInit, OnModuleDestroy {
205205 throw new StalwartApiError ( `Account '${ email } ' not found` , null ) ;
206206 }
207207
208- const value = suspended ? true : null ;
209- const patch = Object . fromEntries (
210- SUSPEND_PERMISSIONS . map ( ( p ) => [ `disabledPermissions/${ p } ` , value ] ) ,
208+ const disabledPermissions = Object . fromEntries (
209+ SUSPEND_PERMISSIONS . map ( ( p ) => [ p , true ] ) ,
211210 ) ;
211+ const permissions = suspended
212+ ? {
213+ '@type' : 'Merge' ,
214+ enabledPermissions : { } ,
215+ disabledPermissions,
216+ }
217+ : { '@type' : 'Inherit' } ;
212218
213219 const response = await this . jmapCall < JmapSetResponse < StalwartAccount > > ( [
214- [ JMAP_METHOD . ACCOUNT_SET , { update : { [ account . id ] : patch } } , 's1' ] ,
220+ [
221+ JMAP_METHOD . ACCOUNT_SET ,
222+ {
223+ update : {
224+ [ account . id ] : {
225+ permissions,
226+ } ,
227+ } ,
228+ } ,
229+ 's1' ,
230+ ] ,
215231 ] ) ;
216232 const set = firstResponse ( response ) ;
217233
234+ this . logger . debug ( `[DEBUG] x:Account/set response: ${ JSON . stringify ( set ) } ` ) ;
235+
218236 const failed = set . notUpdated ?. [ account . id ] ;
219237 if ( failed ) {
220238 throw new StalwartApiError (
0 commit comments