first commit
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,244 @@
|
||||
import type { UserProperties } from '../../Interfaces';
|
||||
|
||||
export const userCreateDescription: UserProperties = [
|
||||
{
|
||||
displayName: 'Username',
|
||||
name: 'username',
|
||||
type: 'string',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['user'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Auth Service',
|
||||
name: 'authService',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'Email',
|
||||
value: 'email',
|
||||
},
|
||||
{
|
||||
name: 'Gitlab',
|
||||
value: 'gitlab',
|
||||
},
|
||||
{
|
||||
name: 'Google',
|
||||
value: 'google',
|
||||
},
|
||||
{
|
||||
name: 'LDAP',
|
||||
value: 'ldap',
|
||||
},
|
||||
{
|
||||
name: 'Office365',
|
||||
value: 'office365',
|
||||
},
|
||||
{
|
||||
name: 'SAML',
|
||||
value: 'saml',
|
||||
},
|
||||
],
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['user'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Auth Data',
|
||||
name: 'authData',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['user'],
|
||||
operation: ['create'],
|
||||
},
|
||||
hide: {
|
||||
authService: ['email'],
|
||||
},
|
||||
},
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Email',
|
||||
name: 'email',
|
||||
type: 'string',
|
||||
placeholder: 'name@email.com',
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['user'],
|
||||
operation: ['create'],
|
||||
authService: ['email'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Password',
|
||||
name: 'password',
|
||||
type: 'string',
|
||||
typeOptions: {
|
||||
password: true,
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['user'],
|
||||
operation: ['create'],
|
||||
authService: ['email'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
description: 'The password used for email authentication',
|
||||
},
|
||||
{
|
||||
displayName: 'Additional Fields',
|
||||
name: 'additionalFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: ['create'],
|
||||
resource: ['user'],
|
||||
},
|
||||
},
|
||||
default: {},
|
||||
options: [
|
||||
{
|
||||
displayName: 'First Name',
|
||||
name: 'first_name',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Last Name',
|
||||
name: 'last_name',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Locale',
|
||||
name: 'locale',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Nickname',
|
||||
name: 'nickname',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Notification Settings',
|
||||
name: 'notificationUi',
|
||||
type: 'fixedCollection',
|
||||
placeholder: 'Add Notification Setting',
|
||||
default: {},
|
||||
typeOptions: {
|
||||
multipleValues: false,
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Notify',
|
||||
name: 'notificationValues',
|
||||
values: [
|
||||
{
|
||||
displayName: 'Channel',
|
||||
name: 'channel',
|
||||
type: 'boolean',
|
||||
default: true,
|
||||
description:
|
||||
'Whether to enable channel-wide notifications (@channel, @all, etc.), "false" to disable. Defaults to "true".',
|
||||
},
|
||||
{
|
||||
displayName: 'Desktop',
|
||||
name: 'desktop',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'All',
|
||||
value: 'all',
|
||||
description: 'Notifications for all activity',
|
||||
},
|
||||
{
|
||||
name: 'Mention',
|
||||
value: 'mention',
|
||||
description: 'Mentions and direct messages only',
|
||||
},
|
||||
{
|
||||
name: 'None',
|
||||
value: 'none',
|
||||
description: 'Mentions and direct messages only',
|
||||
},
|
||||
],
|
||||
default: 'all',
|
||||
},
|
||||
{
|
||||
displayName: 'Desktop Sound',
|
||||
name: 'desktop_sound',
|
||||
type: 'boolean',
|
||||
default: true,
|
||||
description:
|
||||
'Whether to enable sound on desktop notifications, "false" to disable. Defaults to "true".',
|
||||
},
|
||||
{
|
||||
displayName: 'Email',
|
||||
name: 'email',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description:
|
||||
'Whether to enable email notifications, "false" to disable. Defaults to "false".',
|
||||
},
|
||||
{
|
||||
displayName: 'First Name',
|
||||
name: 'first_name',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description:
|
||||
'Whether to enable mentions for first name. Defaults to "true" if a first name is set, "false" otherwise.',
|
||||
},
|
||||
{
|
||||
displayName: 'Mention Keys',
|
||||
name: 'mention_keys',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description:
|
||||
'A comma-separated list of words to count as mentions. Defaults to username and @username.',
|
||||
},
|
||||
{
|
||||
displayName: 'Push',
|
||||
name: 'push',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'All',
|
||||
value: 'all',
|
||||
description: 'Notifications for all activity',
|
||||
},
|
||||
{
|
||||
name: 'Mention',
|
||||
value: 'mention',
|
||||
description: 'Mentions and direct messages only',
|
||||
},
|
||||
{
|
||||
name: 'None',
|
||||
value: 'none',
|
||||
description: 'Mentions and direct messages only',
|
||||
},
|
||||
],
|
||||
default: 'mention',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
@@ -0,0 +1,37 @@
|
||||
import type { IExecuteFunctions, IDataObject, INodeExecutionData } from 'n8n-workflow';
|
||||
|
||||
import { apiRequest } from '../../../transport';
|
||||
|
||||
export async function create(
|
||||
this: IExecuteFunctions,
|
||||
index: number,
|
||||
): Promise<INodeExecutionData[]> {
|
||||
const username = this.getNodeParameter('username', index) as string;
|
||||
const authService = this.getNodeParameter('authService', index) as string;
|
||||
const additionalFields = this.getNodeParameter('additionalFields', index);
|
||||
|
||||
const qs = {} as IDataObject;
|
||||
const requestMethod = 'POST';
|
||||
const endpoint = 'users';
|
||||
const body = {} as IDataObject;
|
||||
|
||||
body.auth_service = authService;
|
||||
|
||||
body.username = username;
|
||||
Object.assign(body, additionalFields);
|
||||
|
||||
if (body.notificationUi) {
|
||||
body.notify_props = (body.notificationUi as IDataObject).notificationValues;
|
||||
}
|
||||
|
||||
if (authService === 'email') {
|
||||
body.email = this.getNodeParameter('email', index) as string;
|
||||
body.password = this.getNodeParameter('password', index) as string;
|
||||
} else {
|
||||
body.auth_data = this.getNodeParameter('authData', index) as string;
|
||||
}
|
||||
|
||||
const responseData = await apiRequest.call(this, requestMethod, endpoint, body, qs);
|
||||
|
||||
return this.helpers.returnJsonArray(responseData as IDataObject[]);
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
import { userCreateDescription as description } from './description';
|
||||
import { create as execute } from './execute';
|
||||
|
||||
export { description, execute };
|
||||
Reference in New Issue
Block a user