private boolean isSimpleDocumentAuthorized(String userId, SimpleDocument attachment)
     throws Exception {
   AccessController<SimpleDocument> accessController =
       AccessControllerProvider.getAccessController("simpleDocumentAccessController");
   return accessController.isUserAuthorized(
       userId,
       attachment,
       AccessControlContext.init().onOperationsOf(AccessControlOperation.download));
 }
 /**
  * Is the specified user can access this publication?
  *
  * <p>A user can access a publication if he has enough rights to access both the application
  * instance in which is managed this publication and one of the nodes to which this publication
  * belongs to.
  *
  * @param user a user in Silverpeas.
  * @return true if the user can access this publication, false otherwise.
  */
 @Override
 public boolean canBeAccessedBy(final UserDetail user) {
   AccessController<String> accessController =
       AccessControllerProvider.getAccessController("componentAccessController");
   boolean canBeAccessed =
       accessController.isUserAuthorized(user.getId(), getComponentInstanceId());
   if (canBeAccessed) {
     AccessController<NodePK> nodeAccessController =
         AccessControllerProvider.getAccessController("nodeAccessController");
     Collection<NodePK> nodes =
         getPublicationBm().getAllFatherPK(new PublicationPK(getId(), getInstanceId()));
     for (NodePK aNode : nodes) {
       canBeAccessed = nodeAccessController.isUserAuthorized(user.getId(), aNode);
       if (canBeAccessed) {
         break;
       }
     }
   }
   return canBeAccessed;
 }