fix: validate credential ownership in attribute sync update (#28873)
This commit is contained in:
1 parent
51e852f671
commit
cbb234cb35
3 files changed
+35
-2
No files matched your search
+2
-1
@@ -63,6 +63,7 @@ export interface ISyncFormData {
|
||||
id: string;
|
||||
name: string;
|
||||
credentialId?: number;
|
||||
integration?: AttributeSyncIntegrations;
|
||||
enabled: boolean;
|
||||
organizationId: number;
|
||||
ruleId: string;
|
||||
@@ -138,7 +139,7 @@ export interface IIntegrationAttributeSyncUpdateParams {
|
||||
integrationAttributeSync: Omit<
|
||||
IntegrationAttributeSync,
|
||||
"attributeSyncRule" | "syncFieldMappings" | "integration"
|
||||
>;
|
||||
> & { integration?: AttributeSyncIntegrations };
|
||||
attributeSyncRule: AttributeSyncRule;
|
||||
fieldMappingsToCreate: Omit<AttributeSyncFieldMapping, "id">[];
|
||||
fieldMappingsToUpdate: AttributeSyncFieldMapping[];
|
||||
|
||||
+7
@@ -217,4 +217,11 @@ export class IntegrationAttributeSyncService {
|
||||
async getAllByCredentialId(credentialId: number) {
|
||||
return this.deps.integrationAttributeSyncRepository.getAllByCredentialId(credentialId);
|
||||
}
|
||||
|
||||
async validateCredentialBelongsToOrg(credentialId: number, organizationId: number) {
|
||||
return this.deps.credentialRepository.findByIdAndTeamId({
|
||||
id: credentialId,
|
||||
teamId: organizationId,
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user