Exemple #1
0
 public RewrittenRequestWrapper(HttpServletRequest request) {
   super(request);
   newURI =
       VosaoContext.getInstance()
           .getBusiness()
           .getRewriteUrlBusiness()
           .rewrite(request.getRequestURI());
   newServletPath =
       VosaoContext.getInstance()
           .getBusiness()
           .getRewriteUrlBusiness()
           .rewrite(request.getServletPath());
 }
 private void addGuestPerission(FolderEntity root) {
   UserEntity tester = addUser("tester", "*****@*****.**", UserRole.ADMIN);
   VosaoContext.getInstance().setUser(tester);
   GroupEntity guests = addGroup("guests");
   GroupEntity developers = addGroup("developers");
   addUserGroup(tester, developers);
   addPermission(root, guests, FolderPermissionType.READ);
 }
 public void execute(HttpServletRequest request, HttpServletResponse response)
     throws ServletException, IOException {
   String msg = request.getParameter("message");
   if (msg == null) {
     logger.error("Message is null");
     return;
   }
   try {
     Message message =
         (Message) StreamUtil.toObject(Base64.decodeBase64(request.getParameter("message")));
     VosaoContext.getInstance().setUser(UserHelper.ADMIN);
     getMessageQueue().execute(message);
   } catch (Exception e) {
     logger.error(e.getMessage());
     e.printStackTrace();
   }
 }
 @Override
 public void remove(String filename) {
   String path = FolderUtil.getFilePath(filename);
   String name = FolderUtil.getFileName(filename);
   TreeItemDecorator<FolderEntity> folder =
       getFolderBusiness().findFolderByPath(getFolderBusiness().getTree(), path);
   if (folder == null) {
     logger.error("Folder not found. " + path);
     return;
   }
   FileEntity file = getDao().getFileDao().getByName(folder.getEntity().getId(), name);
   if (file == null) {
     logger.error("File not found. " + filename);
     return;
   }
   FolderPermissionEntity perm =
       getFolderPermissionBusiness()
           .getPermission(folder.getEntity(), VosaoContext.getInstance().getUser());
   if (perm.isChangeGranted()) {
     getDao().getFileDao().remove(file.getId());
     getSystemService().getFileCache().remove(filename);
   }
 }
 private MessageQueue getMessageQueue() {
   return VosaoContext.getInstance().getMessageQueue();
 }
 private Business getBusiness() {
   return VosaoContext.getInstance().getBusiness();
 }
 @Override
 public ContentPermissionEntity getPermission(String url) {
   return getBusiness()
       .getContentPermissionBusiness()
       .getPermission(url, VosaoContext.getInstance().getUser());
 }
Exemple #8
0
 protected boolean isLoggedIn(final HttpServletRequest request) {
   return VosaoContext.getInstance().getSession().getString(AuthenticationFilter.USER_SESSION_ATTR)
       != null;
 }
Exemple #9
0
 protected MessageQueue getMessageQueue() {
   return VosaoContext.getInstance().getMessageQueue();
 }
Exemple #10
0
 protected Business getBusiness() {
   return VosaoContext.getInstance().getBusiness();
 }