Modify ↓
#933 closed enhancement (fixed)
Allow "permission list user" to show permissions for a given user
Reported by: | Juanma Barranquero | Owned by: | Christopher Lenz |
---|---|---|---|
Priority: | low | Milestone: | 0.9 |
Component: | admin/console | Version: | devel |
Severity: | normal | Keywords: | |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
trac-admin's "permission list" could allow a parameter "user" (an SQL regexp, like "a%") to show permissions just for a user (or a group of them, if passed a regexp). The following patch is a proof-of-concept, but it lacks tests because I'm at present unable to run them.
-
scripts/trac-admin
374 374 ## Permission 375 _help_permission = [('permission list ', 'List permission rules'),375 _help_permission = [('permission list [user]', 'List permission rules'), 376 376 ('permission add <user> <action> [action] [...]', 'Add a new permission rule'), … … 381 381 try: 382 if arg[0] == 'list': 383 self._do_permission_list() 382 if arg[0] == 'list': 383 if len(arg) > 1: 384 user = arg[1] 385 else: 386 user = None 387 self._do_permission_list(user) 384 388 elif arg[0] == 'add' and len(arg) >= 3: … … 396 400 397 def _do_permission_list(self): 398 data = self.db_execsql('SELECT username, action FROM permission') 401 def _do_permission_list(self, user): 402 select = 'SELECT username, action FROM permission' 403 if user: 404 select += (" WHERE username LIKE '%s'" % user) 405 data = self.db_execsql(select) 399 406 self.print_listing(['User', 'Action'], data)
Attachments (0)
Change History (2)
comment:1 by , 20 years ago
Milestone: | → 0.9 |
---|---|
Owner: | changed from | to
Status: | new → assigned |
comment:2 by , 20 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Note:
See TracTickets
for help on using tickets.
Implemented in [1438]. Thanks!