feat: RBAC (#8922)

Signed-off-by: Oleg Ivaniv <me@olegivaniv.com>
Co-authored-by: Val <68596159+valya@users.noreply.github.com>
Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
Co-authored-by: Valya Bullions <valya@n8n.io>
Co-authored-by: Danny Martini <danny@n8n.io>
Co-authored-by: Danny Martini <despair.blue@gmail.com>
Co-authored-by: Iván Ovejero <ivov.src@gmail.com>
Co-authored-by: Omar Ajoue <krynble@gmail.com>
Co-authored-by: oleg <me@olegivaniv.com>
Co-authored-by: Michael Kret <michael.k@radency.com>
Co-authored-by: Michael Kret <88898367+michael-radency@users.noreply.github.com>
Co-authored-by: Elias Meire <elias@meire.dev>
Co-authored-by: Giulio Andreini <andreini@netseven.it>
Co-authored-by: Giulio Andreini <g.andreini@gmail.com>
Co-authored-by: Ayato Hayashi <go12limchangyong@gmail.com>
This commit is contained in:
Csaba Tuncsik
2024-05-17 10:53:15 +02:00
committed by GitHub
parent b1f977ebd0
commit 596c472ecc
292 changed files with 14129 additions and 3989 deletions

View File

@@ -25,15 +25,25 @@ export async function getCredentialsNewName(
return await makeRestApiRequest(context, 'GET', '/credentials/new', name ? { name } : {});
}
export async function getAllCredentials(context: IRestApiContext): Promise<ICredentialsResponse[]> {
return await makeRestApiRequest(context, 'GET', '/credentials');
export async function getAllCredentials(
context: IRestApiContext,
filter?: object,
): Promise<ICredentialsResponse[]> {
return await makeRestApiRequest(context, 'GET', '/credentials', {
includeScopes: true,
...(filter ? { filter } : {}),
});
}
export async function createNewCredential(
context: IRestApiContext,
data: ICredentialsDecrypted,
projectId?: string,
): Promise<ICredentialsResponse> {
return await makeRestApiRequest(context, 'POST', '/credentials', data as unknown as IDataObject);
return await makeRestApiRequest(context, 'POST', '/credentials', {
...data,
projectId,
} as unknown as IDataObject);
}
export async function deleteCredential(context: IRestApiContext, id: string): Promise<boolean> {

View File

@@ -0,0 +1,7 @@
import type { IRestApiContext } from '@/Interface';
import type { RoleMap } from '@/types/roles.types';
import { makeRestApiRequest } from '@/utils/apiUtils';
export const getRoles = async (context: IRestApiContext): Promise<RoleMap> => {
return await makeRestApiRequest(context, 'GET', '/roles');
};

View File

@@ -8,12 +8,12 @@ import type {
import type { ExecutionFilters, ExecutionOptions, IDataObject } from 'n8n-workflow';
import { makeRestApiRequest } from '@/utils/apiUtils';
export async function getNewWorkflow(context: IRestApiContext, name?: string) {
export async function getNewWorkflow(context: IRestApiContext, data?: IDataObject) {
const response = await makeRestApiRequest<NewWorkflowResponse>(
context,
'GET',
'/workflows/new',
name ? { name } : {},
data,
);
return {
name: response.name,
@@ -29,9 +29,10 @@ export async function getWorkflow(context: IRestApiContext, id: string, filter?:
}
export async function getWorkflows(context: IRestApiContext, filter?: object) {
const sendData = filter ? { filter } : undefined;
return await makeRestApiRequest<IWorkflowDb[]>(context, 'GET', '/workflows', sendData);
return await makeRestApiRequest<IWorkflowDb[]>(context, 'GET', '/workflows', {
includeScopes: true,
...(filter ? { filter } : {}),
});
}
export async function getActiveWorkflows(context: IRestApiContext) {