Edgewall Software
Modify

Opened 20 years ago

Closed 20 years ago

Last modified 18 years ago

#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

     
    374374    ## Permission
    375     _help_permission = [('permission list', 'List permission rules'),
     375    _help_permission = [('permission list [user]', 'List permission rules'),
    376376                       ('permission add <user> <action> [action] [...]', 'Add a new permission rule'),
     
    381381        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)
    384388            elif arg[0] == 'add' and len(arg) >= 3:
     
    396400
    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)
    399406        self.print_listing(['User', 'Action'], data)

Attachments (0)

Change History (2)

comment:1 by Christopher Lenz, 20 years ago

Milestone: 0.9
Owner: changed from daniel to Christopher Lenz
Status: newassigned

comment:2 by Christopher Lenz, 20 years ago

Resolution: fixed
Status: assignedclosed

Implemented in [1438]. Thanks!

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Christopher Lenz.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Christopher Lenz to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.