Add validation for DefaultEdgeRuleChain in DeviceProfile

- Refactored parameter name for clarity
This commit is contained in:
Yevhenii 2025-05-21 12:56:23 +03:00
parent 2ed8b4fe9d
commit 48c1842d42

View File

@ -209,12 +209,12 @@ public class DeviceProfileDataValidator extends AbstractHasOtaPackageValidator<D
validateOtaPackage(tenantId, deviceProfile, deviceProfile.getId());
}
private void validateRuleChain(TenantId tenantId, TenantId deviceTenantId, RuleChainId ruleChainId) {
private void validateRuleChain(TenantId tenantId, TenantId deviceProfileTenantId, RuleChainId ruleChainId) {
RuleChain ruleChain = ruleChainService.findRuleChainById(tenantId, ruleChainId);
if (ruleChain == null) {
throw new DataValidationException("Can't assign non-existent rule chain!");
}
if (!ruleChain.getTenantId().equals(deviceTenantId)) {
if (!ruleChain.getTenantId().equals(deviceProfileTenantId)) {
throw new DataValidationException("Can't assign rule chain from different tenant!");
}
}