Rename add user operation as create user

This commit is contained in:
Iván Ovejero 2021-01-18 18:55:07 -03:00
parent cbeeffe805
commit 233a390075
2 changed files with 15 additions and 16 deletions

View file

@ -49,10 +49,9 @@ export async function nextCloudApiRequest(this: IHookFunctions | IExecuteFunctio
const resource = this.getNodeParameter('resource', 0); const resource = this.getNodeParameter('resource', 0);
const operation = this.getNodeParameter('operation', 0); const operation = this.getNodeParameter('operation', 0);
if (resource === 'user' && operation === 'add') { if (resource === 'user' && operation === 'create') {
options.uri = options.uri.replace('/remote.php/webdav', ''); options.uri = options.uri.replace('/remote.php/webdav', '');
} }
console.log(options);
return await this.helpers.request(options); return await this.helpers.request(options);
} else { } else {
const credentials = this.getCredentials('nextCloudOAuth2Api'); const credentials = this.getCredentials('nextCloudOAuth2Api');

View file

@ -199,12 +199,12 @@ export class NextCloud implements INodeType {
}, },
options: [ options: [
{ {
name: 'Add', name: 'Create',
value: 'add', value: 'Create',
description: 'Add a user to a NextCloud organization', description: 'Invite a user to a NextCloud organization',
}, },
], ],
default: 'add', default: 'create',
description: 'The operation to perform.', description: 'The operation to perform.',
}, },
@ -507,7 +507,7 @@ export class NextCloud implements INodeType {
// ---------------------------------- // ----------------------------------
// ---------------------------------- // ----------------------------------
// user:add // user:create
// ---------------------------------- // ----------------------------------
{ {
displayName: 'User ID', displayName: 'User ID',
@ -521,12 +521,12 @@ export class NextCloud implements INodeType {
'user', 'user',
], ],
operation: [ operation: [
'add', 'create',
], ],
}, },
}, },
placeholder: 'john', placeholder: 'john',
description: 'The ID of the user to add.', description: 'The ID of the user to invite.',
}, },
{ {
displayName: 'Email', displayName: 'Email',
@ -540,12 +540,12 @@ export class NextCloud implements INodeType {
'user', 'user',
], ],
operation: [ operation: [
'add', 'create',
], ],
}, },
}, },
placeholder: 'john@email.com', placeholder: 'john@email.com',
description: 'The email of the user to add.', description: 'The email of the user to invite.',
}, },
{ {
displayName: 'Additional Fields', displayName: 'Additional Fields',
@ -558,7 +558,7 @@ export class NextCloud implements INodeType {
'user', 'user',
], ],
operation: [ operation: [
'add', 'create',
], ],
}, },
}, },
@ -568,7 +568,7 @@ export class NextCloud implements INodeType {
name: 'displayName', name: 'displayName',
type: 'string', type: 'string',
default: '', default: '',
description: 'The display name of the user to add.', description: 'The display name of the user to invite.',
}, },
], ],
}, },
@ -695,9 +695,9 @@ export class NextCloud implements INodeType {
} else if (resource === 'user') { } else if (resource === 'user') {
if (operation === 'add') { if (operation === 'create') {
// ---------------------------------- // ----------------------------------
// user:add // user:create
// ---------------------------------- // ----------------------------------
requestMethod = 'POST'; requestMethod = 'POST';
@ -766,7 +766,7 @@ export class NextCloud implements INodeType {
items[i].binary![binaryPropertyName] = await this.helpers.prepareBinaryData(responseData, endpoint); items[i].binary![binaryPropertyName] = await this.helpers.prepareBinaryData(responseData, endpoint);
} else if (resource === 'user' && operation === 'add') { } else if (resource === 'user' && operation === 'create') {
const jsonResponseData: IDataObject = await new Promise((resolve, reject) => { const jsonResponseData: IDataObject = await new Promise((resolve, reject) => {
parseString(responseData, { explicitArray: false }, (err, data) => { parseString(responseData, { explicitArray: false }, (err, data) => {