Edgewall Software
Modify

Opened 16 years ago

Closed 16 years ago

Last modified 16 years ago

#7754 closed defect (duplicate)

trac-admin dies when trying to assign already assigned permission

Reported by: mrenzmann@… Owned by:
Priority: normal Milestone:
Component: admin/console Version: 0.11.1
Severity: normal Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

Using trac-admin, trying to add a permission to a user that this user already has, trac-admin dies with a traceback.

Example:

server:/# trac-admin /var/trac/test
Welcome to trac-admin 0.11.1
Interactive Trac administration console.
Copyright (c) 2003-2008 Edgewall Software

Type:  '?' or 'help' for help on commands.

Trac [/var/trac/test]> permission list _role_test

User             Action
-------------------------------
_role_test       BROWSER_VIEW


Available actions:
 BROWSER_VIEW, ...

Trac [/var/trac/test]> permission add _role_test BROWSER_VIEW
Traceback (most recent call last):
  File "/usr/bin/trac-admin", line 8, in <module>
    load_entry_point('Trac==0.11.1', 'console_scripts', 'trac-admin')()
  File "/usr/lib/python2.5/site-packages/Trac-0.11.1-py2.5.egg/trac/admin/console.py", line 1299, in run
    admin.run()
  File "/usr/lib/python2.5/site-packages/Trac-0.11.1-py2.5.egg/trac/admin/console.py", line 140, in run
    self.cmdloop()
  File "/usr/lib/python2.5/cmd.py", line 142, in cmdloop
    stop = self.onecmd(line)
  File "/usr/lib/python2.5/site-packages/Trac-0.11.1-py2.5.egg/trac/admin/console.py", line 123, in onecmd
    rv = cmd.Cmd.onecmd(self, line) or 0
  File "/usr/lib/python2.5/cmd.py", line 219, in onecmd
    return func(arg)
  File "/usr/lib/python2.5/site-packages/Trac-0.11.1-py2.5.egg/trac/admin/console.py", line 416, in do_permission
    self._do_permission_add(user, action)
  File "/usr/lib/python2.5/site-packages/Trac-0.11.1-py2.5.egg/trac/admin/console.py", line 453, in _do_permission_add
    self._permsys.grant_permission(user, action)
  File "/usr/lib/python2.5/site-packages/Trac-0.11.1-py2.5.egg/trac/perm.py", line 320, in grant_permission
    self.store.grant_permission(username, action)
  File "/usr/lib/python2.5/site-packages/Trac-0.11.1-py2.5.egg/trac/perm.py", line 226, in grant_permission
    (username, action))
  File "/usr/lib/python2.5/site-packages/Trac-0.11.1-py2.5.egg/trac/db/util.py", line 50, in execute
    return self.cursor.execute(sql_escape_percent(sql), args)
  File "/usr/lib/python2.5/site-packages/Trac-0.11.1-py2.5.egg/trac/db/sqlite_backend.py", line 58, in execute
    args or [])
  File "/usr/lib/python2.5/site-packages/Trac-0.11.1-py2.5.egg/trac/db/sqlite_backend.py", line 50, in _rollback_on_error
    return function(self, *args, **kwargs)
pysqlite2.dbapi2.IntegrityError: columns username, action are not unique
server:/#

While I understand the nature of the problem, I feel that the situation is not properly handled. Instead of bailing out, trac-admin should handle the situation more gracefully.

Attachments (0)

Change History (3)

comment:1 by Christian Boos, 16 years ago

Resolution: duplicate
Status: newclosed

Uh, lots of duplicates for this one, see #6841.

comment:2 by Christian Boos, 16 years ago

Sorry, the "canonical" ticket for this should be #6348,

comment:3 by mrenzmann@…, 16 years ago

Doh! Sorry, I searched the tickets, but it seems that I messed up the search phrase.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The ticket will remain with no owner.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from (none) 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.