Author: nmalin
Date: Wed May 29 18:54:04 2019
New Revision: 1860366
URL:
http://svn.apache.org/viewvc?rev=1860366&view=revLog:
Fixed: Backport: Decrypt a field on embedded entity-view failed
(OFBIZ-11078)
When you tried to decrypt a field present on embedded entity-view, key use is the view name and not the final entity who contains this field.
You currently have the problem on PartyContactMechDetail where if you want to displaying the ftpPassword for a FtpAddress, the view failed and tried to use ContactMechDetail to decrypt instead of FtpAddress
To solve it, we iterate on the entity contains the field in the view while is an entity-view :
PartyContactMechDetail.ftpPassword
-> ContactMechDetail.ftpPassword
-> FtpAddress.ftpPassword
-> key found FtpAddress
Modified:
ofbiz/ofbiz-framework/branches/release18.12/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/SqlJdbcUtil.java
Modified: ofbiz/ofbiz-framework/branches/release18.12/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/SqlJdbcUtil.java
URL:
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/branches/release18.12/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/SqlJdbcUtil.java?rev=1860366&r1=1860365&r2=1860366&view=diff==============================================================================
--- ofbiz/ofbiz-framework/branches/release18.12/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/SqlJdbcUtil.java (original)
+++ ofbiz/ofbiz-framework/branches/release18.12/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/SqlJdbcUtil.java Wed May 29 18:54:04 2019
@@ -569,11 +569,14 @@ public final class SqlJdbcUtil {
}
ModelEntity model = entity.getModelEntity();
- String encryptionKeyName = entity.getEntityName();
- if (curField.getEncryptMethod().isEncrypted() && model instanceof ModelViewEntity) {
+ while (curField.getEncryptMethod().isEncrypted() && model instanceof ModelViewEntity) {
ModelViewEntity modelView = (ModelViewEntity) model;
- encryptionKeyName = modelView.getAliasedEntity(modelView.getAlias(curField.getName()).getEntityAlias(), entity.getDelegator().getModelReader()).getEntityName();
+ String entityName = modelView.getAliasedEntity(
+ modelView.getAlias(curField.getName()).getEntityAlias(), entity.getDelegator().getModelReader()
+ ).getEntityName();
+ model = entity.getDelegator().getModelEntity(entityName);
}
+ String encryptionKeyName = model.getEntityName();
// ----- Try out the new handler code -----