[PATCH 2/2] New Project method to check whether the given user has edit rights on it.
Jeremy Kerr
jk at ozlabs.org
Thu Apr 14 17:13:10 EST 2011
Hi Guilherme,
> This is to replace the couple places where we duplicate this same check.
Thanks, applied with one change:
> --- a/apps/patchwork/views/__init__.py
> +++ b/apps/patchwork/views/__init__.py
> @@ -44,8 +44,7 @@ def generic_list(request, project, view,
> data = request.POST
> user = request.user
> properties_form = None
> - if (user.is_authenticated()
> - and project in user.get_profile().maintainer_projects.all()):
> + if user.is_authenticated() and project.is_editable(user):
> properties_form = MultiplePatchForm(project, data = data)
>
> if request.method == 'POST' and data.get('form') == 'patchlistform':
project.is_editable already checks for user.is_authenticated(), so I
dropped that check from here.
Cheers,
Jeremy
More information about the Patchwork
mailing list