Re: 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]> |
----- Original Message ----- > From: "John P. Rouillard" <[email protected]> > To: "Dan Tenenbaum" <[email protected]> > Cc: "Ralf Schlatterbeck" <[email protected]>, [email protected] > Sent: Thursday, March 5, 2015 11:15:25 AM > Subject: Re: [Roundup-users] Creating an auditor to prevent some users from deleting issues/messages/files > > > Hi Dan: > > In message > <[email protected]>, > Dan Tenenbaum writes: > >> From: "Ralf Schlatterbeck" <[email protected]> > >> On Wed, Mar 04, 2015 at 05:34:36PM -0800, Dan Tenenbaum wrote: > >> > > >> > #!/usr/bin/env python > >> > from roundup.exceptions import Reject > >> > > >> > def auditme(db, cl, nodeid, newvalues): > > > > [...] > >> > 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? > >> > >> The actions you can pass to the audit registration method (as well > >> as > >> the 'react' registration method) are 'set', 'create', 'retire', > >> 'restore'. > >> > >> Note that removing a message or a file from an issue does *not* > >> automagically retire it, that's probably the reason why your > >> auditor > >> isn't called (but you don't tell us how you're trying to retire > >> the > >> issue). > > > > >Maybe "retire" is the wrong word. I just want to catch it when the > >user clicks the "remove" button to the right of a message or file. > > As Ralf mentioned, the remove button changes the multilinks > properties > messages or files, so you want 'change'. > > See the cli documentation to see the actual retire (and restore) > commands which actually mark the item as inaccessible. If you remove > a > message from an issue, it is still available in the web interface at > it's url. If you retire it, going to the URL results in a 404 IIRC. > > >OK, but what do I put in init()? I need to call > >db.something.audit('something else', auditme) but I'm not sure what > >the somethings should be. You can see above what I already tried and > >I know that's not working because I set a breakpoint in auditme() > >which is never encountered. > > 'somethingelse' is 'change'. > Thanks, I will read the docs. When I set audit()'s first argument to 'change' I get an error when I start the roundup server and hit it with the browser. Which seems consistent with Ralf saying that create/set/retire/restore are the only valid options. My breakpoint gets hit when I set that argument to 'set', so I guess that's what I'm looking for. Many thanks for the help. Dan > -- > -- rouilj > John Rouillard > =========================================================================== > My employers don't acknowledge my existence much less my opinions. > ------------------------------------------------------------------------------ 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/