Esempio n. 1
0
 def post(self, *args, **kwargs):
     user = self.get_current_user()
     shared_file = FileUpload.by_uuid(self.get_argument('uuid', ''))
     if shared_file is not None and shared_file in user.team.files:
         logging.info("%s deleted a shared file %s" % (user.handle, shared_file.uuid))
         shared_file.delete_data()
         self.dbsession.delete(shared_file)
         self.dbsession.commit()
         self.redirect('/user/share/files')
     else:
         self.redirect("/404")
Esempio n. 2
0
 def get(self, *args, **kwargs):
     ''' Get a file and send it to the user '''
     user = self.get_current_user()
     shared_file = FileUpload.by_uuid(self.get_argument('uuid', ''))
     if shared_file is not None and shared_file in user.team.files:
         self.set_header('Content-Type', shared_file.content_type)
         self.set_header('Content-Length', shared_file.byte_size)
         self.set_header('Content-Disposition', 'attachment; filename=%s' % shared_file.file_name)
         self.write(shared_file.data)
     else:
         self.render("public/404.html")
Esempio n. 3
0
 def get(self, *args, **kwargs):
     ''' Get a file and send it to the user '''
     user = self.get_current_user()
     shared_file = FileUpload.by_uuid(self.get_argument('uuid', ''))
     if shared_file is not None and shared_file in user.team.files:
         self.set_header('Content-Type', shared_file.content_type)
         self.set_header('Content-Length', shared_file.byte_size)
         self.set_header('Content-Disposition',
                         'attachment; filename=%s' % shared_file.file_name)
         self.write(shared_file.data)
     else:
         self.render("public/404.html")
Esempio n. 4
0
 def get(self, *args, **kwargs):
     if options.team_sharing:
         ''' Get a file and send it to the user '''
         user = self.get_current_user()
         shared_file = FileUpload.by_uuid(self.get_argument('uuid', ''))
         if user.has_permission(ADMIN_PERMISSION) or (
                 shared_file is not None
                 and shared_file in user.team.files):
             self.set_header('Content-Type', shared_file.content_type)
             self.set_header('Content-Length', shared_file.byte_size)
             self.set_header(
                 'Content-Disposition',
                 'attachment; filename=%s' % (shared_file.file_name))
             self.write(shared_file.data)
         else:
             self.render("public/404.html")
     else:
         self.redirect("/404")
Esempio n. 5
0
 def get(self, *args, **kwargs):
     if options.team_sharing:
         """ Get a file and send it to the user """
         user = self.get_current_user()
         shared_file = FileUpload.by_uuid(self.get_argument("uuid", ""))
         if user.is_admin() or (shared_file is not None
                                and shared_file in user.team.files):
             self.set_header("Content-Type", shared_file.content_type)
             self.set_header("Content-Length", shared_file.byte_size)
             self.set_header(
                 "Content-Disposition",
                 "attachment; filename=%s" % (shared_file.file_name),
             )
             self.write(shared_file.data)
         else:
             self.render("public/404.html")
     else:
         self.redirect("/404")
Esempio n. 6
0
 def post(self, *args, **kwargs):
     if options.team_sharing:
         user = self.get_current_user()
         shared_file = FileUpload.by_uuid(self.get_argument('uuid', ''))
         if user.has_permission(ADMIN_PERMISSION):
             logging.info("%s deleted a shared file %s" %
                          (user.handle, shared_file.uuid))
             shared_file.delete_data()
             self.dbsession.delete(shared_file)
             self.dbsession.commit()
             self.redirect('/admin/view/fileshare')
         if shared_file is not None and shared_file in user.team.files:
             logging.info("%s deleted a shared file %s" %
                          (user.handle, shared_file.uuid))
             shared_file.delete_data()
             self.dbsession.delete(shared_file)
             self.dbsession.commit()
             self.redirect('/user/share/files')
         else:
             self.redirect("/404")
     else:
         self.redirect("/404")
Esempio n. 7
0
 def post(self, *args, **kwargs):
     if options.team_sharing:
         user = self.get_current_user()
         shared_file = FileUpload.by_uuid(self.get_argument("uuid", ""))
         if user.is_admin():
             logging.info("%s deleted a shared file %s" %
                          (user.handle, shared_file.uuid))
             shared_file.delete_data()
             self.dbsession.delete(shared_file)
             self.dbsession.commit()
             self.redirect("/admin/view/fileshare")
         elif shared_file is not None and shared_file in user.team.files:
             logging.info("%s deleted a shared file %s" %
                          (user.handle, shared_file.uuid))
             shared_file.delete_data()
             self.dbsession.delete(shared_file)
             self.dbsession.commit()
             self.redirect("/user/share/files")
         else:
             self.redirect("/404")
     else:
         self.redirect("/404")