The User.project_role method creates roles, which may not be what you want (and may cause a large number of roles to be added to mongo). Rename it to something that makes its "upsert" functionality clear.
Also move it to the ProjectRole class, as that is more closely related to its functionality.
allura:cj/6714allura:cj/6714forge-classic:cj/6714Note:
ProjectRole.by_userwas already in use in one place:Allura/allura/lib/security.py:all_allowedYeah, I guess I should have mentioned that, but that was a new addition specifically to avoid the upsert behavior of
User.project_role()so I figured it was practically part of this ticket. :-)Couple test failures: https://sourceforge.net/p/allura/pastebin/5272858d0594ca58130c809e
(after rebasing to master)
Rebase and test fixes force-pushed to:
allura:cj/6714This is gtg but would like to hold for a separate push.