mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 10:31:15 +00:00
feat(core): Allow transferring credentials in Public API (#10259)
This commit is contained in:
@@ -19,6 +19,8 @@ import {
|
||||
toJsonSchema,
|
||||
} from './credentials.service';
|
||||
import { Container } from 'typedi';
|
||||
import { z } from 'zod';
|
||||
import { EnterpriseCredentialsService } from '@/credentials/credentials.service.ee';
|
||||
|
||||
export = {
|
||||
createCredential: [
|
||||
@@ -44,6 +46,20 @@ export = {
|
||||
}
|
||||
},
|
||||
],
|
||||
transferCredential: [
|
||||
projectScope('credential:move', 'credential'),
|
||||
async (req: CredentialRequest.Transfer, res: express.Response) => {
|
||||
const body = z.object({ destinationProjectId: z.string() }).parse(req.body);
|
||||
|
||||
await Container.get(EnterpriseCredentialsService).transferOne(
|
||||
req.user,
|
||||
req.params.workflowId,
|
||||
body.destinationProjectId,
|
||||
);
|
||||
|
||||
res.status(204).send();
|
||||
},
|
||||
],
|
||||
deleteCredential: [
|
||||
projectScope('credential:delete', 'credential'),
|
||||
async (
|
||||
|
||||
Reference in New Issue
Block a user