Re: error: Role "'provisional user'" does not exist
"John P. Rouillard" <[email protected]>
| Newsgroups | gmane.comp.bug-tracking.roundup.user |
|---|---|
| Message-ID | <[email protected]> |
Hi Dan: In message <[email protected]>, Dan Tenenbaum writes: >Sorry for all the replying to myself, but it does seem this is a genuine bug. > >I "fixed" it as follows, but this is not a real fix, I'd appreciate >it if anyone has a better idea what is going on and how to fix it. Yeah your fix patching the roundup code itself including "Provisional User" is (as you suspect) not right. The way to do this (and it should not be needed at all) is to use an auditor on the user class that runs before the userauditor.py. I think I got your prior emails in the correct order for me to respond to it. >> > Dan Tenenbaum writes: >> > > I created a "Provisional User" role as described here: >> > > >> > > http://roundup.sourceforge.net/docs/customizing.html#users-may-only-edit-their-issues >> > > >> > > But when I register as a new user and click the link I get in my >> > > email, I see the error >> > > >> > > Role "'provisional user'" does not exist >> > > >> > > This seems to be coming from detectors/userauditor.py. Yup that makes sense. Continue reading for what I think is happening. >> > > I have defined the role in schema.py tbough. One thing I notice >> > > is that the error message spells "provisional user" in >> > > lowercase, but the role is defined in schema.py as "Provisional >> > > User" (initial caps). Could it be getting changed to lowercase >> > > somewhere and the auditor does not realize that it is the same? >> The problem is that after adding this code, new users are added to >> the database (_user table) with their _role column set to: >> >> 'Provisional User' >> >> _including_ the quotes! So of course that does not match what it >> should be (Provisional User without quotes). Hence the error >> message: >> >> Role "'provisional user'" does not exist >> >> Note the extra quotes in that error message. >> >> The problem is, I can't find where the quotes are occurring. >> >> I tried changing security.py and adding the following replace() calls >> to the first line in the Role constructor: >> >> self.name = name.lower().replace("'", "").replace('"', "") >> >> It didn't help.... My guess is this is an issue in the config file parser. I wonder if: [main] ... new_web_user_roles = 'Provisional User' new_email_user_roles = 'Provisional User' in the exampke should be: [main] ... new_web_user_roles = Provisional User new_email_user_roles = Provisional User Give that a try and see if it changes the error message or makes things work. I claim it should work. If so please stop reading here and submit a bug report. We need to fix the doc 8-/. If that doesn't solve the issue, we still have the question of why it's being smashed to lower case. I just applied the http://roundup.sourceforge.net/docs/customizing.html#users-may-only-edit-their-issues example to my test tracker and it worked fine with a little tinkering (changed a couple of function names so they didn't clash with existing own_record and own_issue). Let's try this in stages and see if the basic functionality works. Roll back your roundup code change, reinstall the userauditor.py and restart the roundup server. Change config.ini back to: new_web_user_roles = User new_email_user_roles = User and not 'Provisional User'. Log into your tracker as an admin. Create a new user "provisional". Change the user's role to: Provisional User no quotes or anything and save the user. Log out as the admin and log in as the user provisional. If you list all the issues, do you see any issues (you shouldn't since that new user hasn't created any issues yet)? Create an issue. (As an aside, note that the classes list in the example in customizing.html is correct for the classic tracker, so you may need to add/change: # Assign the Permissions for issue-related classes for cl in 'file', 'msg', 'query', 'keyword': to add some classes since you aare using the devel template. If you don't get all the classes, some select (drop down) elements in your issue screen may not be populated.) Can you save the issue? If so list all issues, does the new issue show up? If this works, then the basic functionality is working. So I think there is an issue with the config.ini parsing. What I suspect is happening is that: new_web_user_roles = 'Provisional User' new_email_user_roles = 'Provisional User' is case smashing to lower case and preserving the quotes. So rather and setting role to: Provisional User it ends up as: 'provisional user' You can test this by replacing the role: Provisional User by: provisional in schema.py and setting config.ini to: new_web_user_roles = provisional new_email_user_roles = provisional and see if that works. This gets rid of the quotes (which I think may have been there to preserve the space, but I don't think are needed) and makes it all lower case. Does this get you closer to what you want? -- -- rouilj John Rouillard =========================================================================== My employers don't acknowledge my existence much less my opinions. ------------------------------------------------------------------------------ Comprehensive Server Monitoring with Site24x7. Monitor 10 servers for $9/Month. Get alerted through email, SMS, voice calls or mobile push notifications. Take corrective actions from your mobile device. http://p.sf.net/sfu/Zoho