def share(self,file): file_name = os.path.basename(file) user = cherrypy.session['cur_user'] group = cherrypy.session['group'] html = check_login() aggre_keys = encrypt_handler.get_aggre_key(group) html += """ <h2> File : %s </h2>""" % file_name html += """ Select the Group you wanna share the file with <br> <form method="post" action=/share_file > <input type="hidden" value=" """ + file +""" " name="file"> Group : <select name="group">""" for x in range(1,groups+1): html += """ <option value=" """ + str(x) + """ " > """ + str(x) + """ </option>""" html +="""</select><br> <input type=submit value="Share"></form>""" html += footer return html
def share(self, file): file_name = os.path.basename(file) user = cherrypy.session['cur_user'] group = cherrypy.session['group'] html = check_login() aggre_keys = encrypt_handler.get_aggre_key(group) html += """ <h2> File : %s </h2>""" % file_name html += """ Select the Group you wanna share the file with <br> <form method="post" action=/share_file > <input type="hidden" value=" """ + file + """ " name="file"> Group : <select name="group">""" for x in range(1, groups + 1): html += """ <option value=" """ + str(x) + """ " > """ + str( x) + """ </option>""" html += """</select><br> <input type=submit value="Share"></form>""" html += footer return html
def share_file(self, group, file): html = check_login() file_name = os.path.basename(file) user = cherrypy.session['cur_user'] uemail = [db_handler.fetch_member_email(group)] keys = encrypt_handler.get_aggre_key(group) for i,j in zip(range(0,len(uemail[0].keys())),range(1,len(keys))): out = db_handler.file_share(uemail[0].keys()[i],file_name,keys[j],group) skey = keys[0] msg = " %s shared %s with you! key = %s " % (user,file_name,skey) if out != "Share Exists!": for u in uemail: send_mail.send_email(u.values(),msg) html += """ File Shared, \nResult : %s """ % out else: html += """ File Sharing Failed, \nResult : %s """ % out html += footer return html
def share_file(self, group, file): html = check_login() file_name = os.path.basename(file) user = cherrypy.session['cur_user'] uemail = [db_handler.fetch_member_email(group)] keys = encrypt_handler.get_aggre_key(group) for i, j in zip(range(0, len(uemail[0].keys())), range(1, len(keys))): out = db_handler.file_share(uemail[0].keys()[i], file_name, keys[j], group) skey = keys[0] msg = " %s shared %s with you! key = %s " % (user, file_name, skey) if out != "Share Exists!": for u in uemail: send_mail.send_email(u.values(), msg) html += """ File Shared, \nResult : %s """ % out else: html += """ File Sharing Failed, \nResult : %s """ % out html += footer return html