Split user remove and archive actions
Restore RemoveUser as a hard delete operation and surface dependency\nconflicts with a dedicated IAM error.\n\nAdd a new ArchiveUser flow that deactivates profiles while keeping the\nmember in the organization, then expose both actions across Connect, MCP,\nCLI, n8n, console UI, and e2e coverage. Signed-off-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Bryan FRIMIN <bryan@frimin.fr>
This commit is contained in:
committed by
Bryan Frimin
parent
a71a7bb56f
commit
1e08a23ddc
@@ -0,0 +1,71 @@
|
||||
// Copyright (c) 2026 Probo Inc <hello@getprobo.com>.
|
||||
//
|
||||
// Permission to use, copy, modify, and/or distribute this software for any
|
||||
// purpose with or without fee is hereby granted, provided that the above
|
||||
// copyright notice and this permission notice appear in all copies.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
// AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
// OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
// PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
import type { INodeProperties, IExecuteFunctions, INodeExecutionData } from 'n8n-workflow';
|
||||
import { proboConnectApiRequest } from '../../GenericFunctions';
|
||||
|
||||
export const description: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Organization ID',
|
||||
name: 'organizationId',
|
||||
type: 'string',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['user'],
|
||||
operation: ['archiveUser'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
description: 'The ID of the organization',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
displayName: 'User ID',
|
||||
name: 'userId',
|
||||
type: 'string',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['user'],
|
||||
operation: ['archiveUser'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
description: 'The ID of the user (profile) to archive in the organization',
|
||||
required: true,
|
||||
},
|
||||
];
|
||||
|
||||
export async function execute(
|
||||
this: IExecuteFunctions,
|
||||
itemIndex: number,
|
||||
): Promise<INodeExecutionData> {
|
||||
const organizationId = this.getNodeParameter('organizationId', itemIndex) as string;
|
||||
const userId = this.getNodeParameter('userId', itemIndex) as string;
|
||||
|
||||
const query = `
|
||||
mutation ArchiveUser($input: ArchiveUserInput!) {
|
||||
archiveUser(input: $input) {
|
||||
archivedProfileId
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
const input = { organizationId, profileId: userId };
|
||||
const responseData = await proboConnectApiRequest.call(this, query, { input });
|
||||
|
||||
return {
|
||||
json: responseData,
|
||||
pairedItem: { item: itemIndex },
|
||||
};
|
||||
}
|
||||
@@ -13,6 +13,7 @@
|
||||
// PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
import type { INodeProperties } from 'n8n-workflow';
|
||||
import * as archiveUserOp from './archiveUser.operation';
|
||||
import * as listUsersOp from './listUsers.operation';
|
||||
import * as getUserOp from './getUser.operation';
|
||||
import * as createUserOp from './createUser.operation';
|
||||
@@ -35,7 +36,7 @@ export const description: INodeProperties[] = [
|
||||
options: [
|
||||
{
|
||||
name: 'Archive',
|
||||
value: 'removeUser',
|
||||
value: 'archiveUser',
|
||||
description: 'Archive a user in the organization',
|
||||
action: 'Archive a user',
|
||||
},
|
||||
@@ -63,6 +64,12 @@ export const description: INodeProperties[] = [
|
||||
description: 'List all users in the organization',
|
||||
action: 'List users',
|
||||
},
|
||||
{
|
||||
name: 'Remove',
|
||||
value: 'removeUser',
|
||||
description: 'Remove a user from the organization',
|
||||
action: 'Remove a user',
|
||||
},
|
||||
{
|
||||
name: 'Update',
|
||||
value: 'updateUser',
|
||||
@@ -78,6 +85,7 @@ export const description: INodeProperties[] = [
|
||||
],
|
||||
default: 'listUsers',
|
||||
},
|
||||
...archiveUserOp.description,
|
||||
...listUsersOp.description,
|
||||
...getUserOp.description,
|
||||
...createUserOp.description,
|
||||
@@ -88,6 +96,7 @@ export const description: INodeProperties[] = [
|
||||
];
|
||||
|
||||
export {
|
||||
archiveUserOp as archiveUser,
|
||||
listUsersOp as listUsers,
|
||||
getUserOp as getUser,
|
||||
createUserOp as createUser,
|
||||
|
||||
@@ -41,7 +41,7 @@ export const description: INodeProperties[] = [
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
description: 'The ID of the user (profile) to archive in the organization',
|
||||
description: 'The ID of the user (profile) to remove from the organization',
|
||||
required: true,
|
||||
},
|
||||
];
|
||||
@@ -56,7 +56,7 @@ export async function execute(
|
||||
const query = `
|
||||
mutation RemoveUser($input: RemoveUserInput!) {
|
||||
removeUser(input: $input) {
|
||||
archivedProfileId: deletedProfileId
|
||||
deletedProfileId
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
Reference in New Issue
Block a user