Creating an auditor to prevent some users from deleting issues/messages/files

Dan Tenenbaum <[email protected]>
Newsgroups gmane.comp.bug-tracking.roundup.user
Message-ID <[email protected]>
Hi,

The default type of user in my Roundup installation is a "Provisional User" who can only modify their own issues. I set this up according to:

http://roundup.sourceforge.net/docs/customizing.html#users-may-only-edit-their-issues

Now I want to add the additional functionality that these users cannot remove or retire any issue or message or file.

I tried with the following auditor:

#!/usr/bin/env python
from roundup.exceptions import Reject

def auditme(db, cl, nodeid, newvalues):
    roles = db.getnode("user", db.getuid())['roles'].split(",")
    roles = [x.strip() for x in roles]
    if not ("Admin" in roles or "User" in roles):
        raise Reject("You cannot delete this item.")

def init(db):
    db.issue.audit('retire', auditme)
    db.msg.audit('retire', auditme)
    db.file.audit('retire', auditme)

The "auditme" function is never called. I tried changing 'retire' to 'remove' but got an error. What are the various verbs that can be passed to audit() and where are they defined? 

Any other tips for accomplishing this?

Thanks,
Dan

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.