public class PrivilegedEntity extends Object
Call ObjectWrapper.wrap(Object) with an Entity wrapped in a PrivilegedEntity instance and it will be wrapped in a EntityHashModel where all fields and relations will be resolved in privileged mode.

This can be useful if you don't want to allow read rights by ACL, but someone should still be able to read field or relation values in a freemarker template.


  PrivilegedEntity privilegedEntity = new PrivilegedEntity(userEntity); // User entity without ACL
  TemplateModel templateModel = environment.getObjectWrapper().wrap(privilegedEntity);

  environment.setVariable("user", templateModel);

  <#-- firstname of user entity is resolved in privileged mode
       (couldn't be read otherwise if there's no ACL that allows it) -->
  • Constructor Details

    • PrivilegedEntity

      public PrivilegedEntity(Entity entity)
  • Method Details

    • getEntity

      public Entity getEntity()