Skip to content

Commit

Permalink
Fixed: Decrypt a field on embedded entity-view failed
Browse files Browse the repository at this point in the history
(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

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1860365 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
nmalin committed May 29, 2019
1 parent 5d2b8b9 commit 69d4c76
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -569,11 +569,14 @@ public static void getValue(ResultSet rs, int ind, ModelField curField, GenericE
}

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 -----

Expand Down

0 comments on commit 69d4c76

Please sign in to comment.