2022-08-17 08:50:24 -07:00
|
|
|
import { INodeProperties } from 'n8n-workflow';
|
2021-11-26 04:10:03 -08:00
|
|
|
|
|
|
|
export const userOperations: INodeProperties[] = [
|
|
|
|
{
|
|
|
|
displayName: 'Operation',
|
|
|
|
name: 'operation',
|
|
|
|
type: 'options',
|
|
|
|
noDataExpression: true,
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-17 08:50:24 -07:00
|
|
|
resource: ['user'],
|
2021-11-26 04:10:03 -08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
name: 'Delete',
|
|
|
|
value: 'delete',
|
|
|
|
description: 'Delete a user from the current organization',
|
2022-07-10 13:50:51 -07:00
|
|
|
action: 'Delete a user',
|
2021-11-26 04:10:03 -08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Get All',
|
|
|
|
value: 'getAll',
|
|
|
|
description: 'Retrieve all users in the current organization',
|
2022-07-10 13:50:51 -07:00
|
|
|
action: 'Get all users',
|
2021-11-26 04:10:03 -08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Update',
|
|
|
|
value: 'update',
|
|
|
|
description: 'Update a user in the current organization',
|
2022-07-10 13:50:51 -07:00
|
|
|
action: 'Update a user',
|
2021-11-26 04:10:03 -08:00
|
|
|
},
|
|
|
|
],
|
|
|
|
default: 'getAll',
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
export const userFields: INodeProperties[] = [
|
|
|
|
// ----------------------------------------
|
|
|
|
// user: update
|
|
|
|
// ----------------------------------------
|
|
|
|
{
|
|
|
|
displayName: 'User ID',
|
|
|
|
name: 'userId',
|
|
|
|
description: 'ID of the user to update',
|
|
|
|
type: 'string',
|
|
|
|
required: true,
|
|
|
|
default: '',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-17 08:50:24 -07:00
|
|
|
resource: ['user'],
|
|
|
|
operation: ['update'],
|
2021-11-26 04:10:03 -08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Update Fields',
|
|
|
|
name: 'updateFields',
|
|
|
|
type: 'collection',
|
|
|
|
placeholder: 'Add Field',
|
|
|
|
default: {},
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-17 08:50:24 -07:00
|
|
|
resource: ['user'],
|
|
|
|
operation: ['update'],
|
2021-11-26 04:10:03 -08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
displayName: 'Role',
|
|
|
|
name: 'role',
|
|
|
|
type: 'options',
|
|
|
|
default: 'Admin',
|
|
|
|
description: 'New role for the user',
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
name: 'Admin',
|
|
|
|
value: 'Admin',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Editor',
|
|
|
|
value: 'Editor',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Viewer',
|
|
|
|
value: 'Viewer',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
|
|
|
|
// ----------------------------------------
|
|
|
|
// user: delete
|
|
|
|
// ----------------------------------------
|
|
|
|
{
|
|
|
|
displayName: 'User ID',
|
|
|
|
name: 'userId',
|
|
|
|
description: 'ID of the user to delete',
|
|
|
|
type: 'string',
|
|
|
|
required: true,
|
|
|
|
default: '',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-17 08:50:24 -07:00
|
|
|
resource: ['user'],
|
|
|
|
operation: ['delete'],
|
2021-11-26 04:10:03 -08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// ----------------------------------------
|
|
|
|
// user: getAll
|
|
|
|
// ----------------------------------------
|
|
|
|
{
|
|
|
|
displayName: 'Return All',
|
|
|
|
name: 'returnAll',
|
|
|
|
type: 'boolean',
|
|
|
|
default: false,
|
|
|
|
description: 'Whether to return all results or only up to a given limit',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-17 08:50:24 -07:00
|
|
|
resource: ['user'],
|
|
|
|
operation: ['getAll'],
|
2021-11-26 04:10:03 -08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Limit',
|
|
|
|
name: 'limit',
|
|
|
|
type: 'number',
|
|
|
|
default: 50,
|
|
|
|
description: 'Max number of results to return',
|
|
|
|
typeOptions: {
|
|
|
|
minValue: 1,
|
|
|
|
},
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-17 08:50:24 -07:00
|
|
|
resource: ['user'],
|
|
|
|
operation: ['getAll'],
|
|
|
|
returnAll: [false],
|
2021-11-26 04:10:03 -08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
];
|