def alreadyexists(self, ): return pages.get_template('errors/alreadyexists.html').render() @cherrypy.expose def loginerror(self, ): return pages.get_template('errors/loginerror.html').render() @cherrypy.expose def wrongmethod(self, ): return pages.get_template('errors/wrongmethod.html').render() #There are lots of other objects ad classes represeting subfolders of the website so we attatch them root = webapproot() root.login = weblogin.LoginScreen() root.auth = ManageUsers.ManageAuthorization() root.modules = modules.WebInterface() root.settings = settings.Settings() root.errors = Errors() root.pages = usrpages.KaithemPage() #Start cherrrypy dn = os.path.dirname(os.path.realpath(__file__)) if __name__ == '__main__': server_config = { 'server.socket_host': '0.0.0.0', 'server.socket_port': 8001, 'server.ssl_module': 'builtin', 'server.ssl_certificate': os.path.join(dn, 'ssl/certificate.cert'), 'server.ssl_private_key': os.path.join(dn, 'ssl/certificate.key'), }
choice = 0 print("Welcome to Project Allocator Admin console!\n") while (choice != 4): print("\nEnter 1 to manage users") print("Enter 2 to manage Areas of Expertise") print("Enter 3 to archive") print("Enter 4 to exit") choice = raw_input() try: choice = int(choice) except ValueError: print "\nError! Invalid input.\n" choice = 0 continue if (choice == 1): ManageUsers.manage_users() elif (choice == 2): manage_AOE() elif (choice == 3): archive.archiveAll() elif (choice == 4): continue else: print "\nError! Invalid input.\n"
file.close() def UpdateWrite(): global Serial global Curr_Id file = open('Users.txt',mode = 'a') file2= open('curr.txt',mode='w') for a in Serial: file.write(',') file.write(str(a)) file.close() file2.write(str(Curr_Id)) file2.close() def press(key): global IgnoreLoops global Speed while key == char_w: SmartCam.Static = False SmartCam.GUI.UpdateGUI(key) if Speed<10: Speed = Speed + 0.1 if Speed >= 10: Speed = Speed + (0.003*Speed) if Speed >=180: key = None def release(key): global action global Speed global Curr_Id global prev_keyu if key == char_u: SmartCam.action = key prev_key = key if key == char_plus and prev_key == char_u: UpdateRead() ManageUsers.addUser(Curr_Id) Serial.add(Curr_Id) Curr_Id = Curr_Id + 1 UpdateWrite() if key == char_e: SmartCam.Create = true if key == char_minus and prev_key == char_u: UpdateRead() a = input('Enter User Id') Curr_Id = int(a) if Curr_Id in Serial: ManageUsers.removeUser(Curr_Id) else: pass if key == char_q: SmartCam.GUI.UpdateGUI(key) SmartCam.Access = False SmartCam.came = False SmartCam.Static = True SmartCam.GUION = False if key == char_s: Speed = 0 SmartCam.Static = True def handler(): with Listener(on_press=press,on_release=release) as listen: listen.join()
def passwd(*args): import ManageUsers ManageUsers.passwd().call(*args)
def whoami(*args): import ManageUsers ManageUsers.whoami().call(*args)
def delUser(*args): import ManageUsers ManageUsers.delUser().call(*args)
def delKey(*args): import ManageUsers ManageUsers.delKey().call(*args)
def modUser(*args): import ManageUsers ManageUsers.modUser().call(*args)
def addKey(*args): import ManageUsers ManageUsers.addKey().call(*args)
def addUser(*args): import ManageUsers ManageUsers.addUser().call(*args)
def keys(*args): import ManageUsers ManageUsers.keys().call(*args)
def users(*args): import ManageUsers ManageUsers.users().call(*args)