diff options
author | mkaay <mkaay@mkaay.de> | 2011-02-05 14:45:36 +0100 |
---|---|---|
committer | mkaay <mkaay@mkaay.de> | 2011-02-05 14:45:36 +0100 |
commit | 4c2bc3442e7e953444c28745cbec6ff7b3139b0b (patch) | |
tree | eafa93db353cf4a80c51c9b81211e529ac805759 /module/setup.py | |
parent | created unified authentication system (same data for webinterface an GUI/CLI,... (diff) | |
download | pyload-4c2bc3442e7e953444c28745cbec6ff7b3139b0b.tar.xz |
user editor
Diffstat (limited to 'module/setup.py')
-rw-r--r-- | module/setup.py | 38 |
1 files changed, 32 insertions, 6 deletions
diff --git a/module/setup.py b/module/setup.py index e837e08ae..d8776f607 100644 --- a/module/setup.py +++ b/module/setup.py @@ -293,17 +293,43 @@ class Setup(): translation = gettext.translation("setup", join(self.path, "locale"), languages=[self.config["general"]["language"]]) translation.install(unicode=(True if sys.getfilesystemencoding().startswith("utf") else False)) - print _("Setting new username and password") - print "" from module.DatabaseBackend import DatabaseBackend import module.UserDatabase #register user backend db = DatabaseBackend(None) db.setup() - print "" - username = self.ask(_("Username"), "User") - password = self.ask("", "", password=True) - db.addUser(username, password) + + try: + while True: + print _("Select action") + print _("1 - Create/Edit user") + print _("2 - List users") + print _("3 - Remove user") + action = raw_input("[1]/2/3 ") + if not action in ("1", "2", "3"): + continue + elif action == "1": + print "" + username = self.ask(_("Username"), "User") + password = self.ask("", "", password=True) + db.addUser(username, password) + elif action == "2": + print "" + print _("Users") + print "-----" + users = db.listUsers() + for user in users: + print user + print "-----" + print "" + elif action == "3": + print "" + username = self.ask(_("Username"), "") + if username: + db.removeUser(username) + except KeyboardInterrupt: + print "" #clean + pass db.shutdown() def conf_path(self, trans=False): |