Re: Creating an auditor to prevent some users from deleting issues/messages/files
Ralf Schlatterbeck <[email protected]>
| Newsgroups | gmane.comp.bug-tracking.roundup.user |
|---|---|
| Message-ID | <[email protected]> |
On Thu, Mar 05, 2015 at 02:15:25PM -0500, John P. Rouillard wrote:
> >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'.
No it's "set".
You would call
db.issue.audit ('set', yourauditfunction)
In the function you would need to check if messages are removed from the
issue, e.g. something like
def check_unlinking (db, cl, nodeid, new_values):
for prop in ('messages', 'files'):
if prop not in new_values:
continue
ids = dict.fromkeys (new_values [prop])
for id in cl.get (nodeid, prop):
if id not in ids:
<your check if unlinking is allowed goes here>
Ralf
--
Dr. Ralf Schlatterbeck Tel: +43/2243/26465-16
Open Source Consulting www: http://www.runtux.com
Reichergasse 131, A-3411 Weidling email: [email protected]
allmenda.com member email: [email protected]
------------------------------------------------------------------------------
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/