mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 18:41:14 +00:00
feat(core): Allow transferring credentials from any project to any team project (#9563)
This commit is contained in:
@@ -28,6 +28,7 @@ import { SharedCredentialsRepository } from '@/databases/repositories/sharedCred
|
||||
import { In } from '@n8n/typeorm';
|
||||
import { SharedCredentials } from '@/databases/entities/SharedCredentials';
|
||||
import { ProjectRelationRepository } from '@/databases/repositories/projectRelation.repository';
|
||||
import { z } from 'zod';
|
||||
|
||||
@RestController('/credentials')
|
||||
export class CredentialsController {
|
||||
@@ -324,4 +325,16 @@ export class CredentialsController {
|
||||
credentialsName: credential.name,
|
||||
});
|
||||
}
|
||||
|
||||
@Put('/:credentialId/transfer')
|
||||
@ProjectScope('credential:move')
|
||||
async transfer(req: CredentialRequest.Transfer) {
|
||||
const body = z.object({ destinationProjectId: z.string() }).parse(req.body);
|
||||
|
||||
return await this.enterpriseCredentialsService.transferOne(
|
||||
req.user,
|
||||
req.params.credentialId,
|
||||
body.destinationProjectId,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user