Mercurial > p > roundup > code
diff roundup/admin.py @ 5979:33a7b10618a6
Add support for -u to roundup-admin
Reimplement -u <login>[:<password>]. This opens the database as the
login and applies expected permissions. It also creates history
entries for the user. Note that the password is unused. The CLI has
full access to the files so a password check is not useful. Left an
edge case is when the login has a : in it. In this case it may not
work as expected. So don't do that.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Thu, 14 Nov 2019 21:37:13 -0500 |
| parents | d0aebd4aec72 |
| children | 3719b01cbe9e |
line wrap: on
line diff
--- a/roundup/admin.py Sat Nov 09 16:53:42 2019 -0500 +++ b/roundup/admin.py Thu Nov 14 21:37:13 2019 -0500 @@ -121,7 +121,7 @@ Options: -i instance home -- specify the issue tracker "home directory" to administer - -u -- the user[:password] to use for commands + -u -- the user[:password] to use for commands (default admin) -d -- print full designators not just class id numbers -c -- when outputting lists of data, comma-separate them. Same as '-S ","'. @@ -1560,7 +1560,7 @@ # only open the database once! if not self.db: - self.db = tracker.open('admin') + self.db = tracker.open(self.name) self.db.tx_Source = 'cli' @@ -1620,13 +1620,13 @@ # handle command-line args self.tracker_home = os.environ.get('TRACKER_HOME', '') - # TODO: reinstate the user/password stuff (-u arg too) - name = password = '' + self.name = 'admin' + self.password = '' # unused if 'ROUNDUP_LOGIN' in os.environ: l = os.environ['ROUNDUP_LOGIN'].split(':') - name = l[0] + self.name = l[0] if len(l) > 1: - password = l[1] + self.password = l[1] self.separator = None self.print_designator = 0 self.verbose = 0 @@ -1658,6 +1658,11 @@ self.separator = ' ' elif opt == '-d': self.print_designator = 1 + elif opt == '-u': + l = arg.split(':') + self.name = l[0] + if len(l) > 1: + self.password = l[1] # if no command - go interactive # wrap in a try/finally so we always close off the db
