From cf336699e491089cda8d436a0043765064fbc520 Mon Sep 17 00:00:00 2001 From: Oscar Cortez Date: Thu, 9 Jan 2020 11:50:57 -0600 Subject: [PATCH] Add support for user organization manager --- src/wiki/views/article.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/wiki/views/article.py b/src/wiki/views/article.py index 73f44e9c..f3a43fbe 100644 --- a/src/wiki/views/article.py +++ b/src/wiki/views/article.py @@ -967,10 +967,14 @@ class CreateRootView(FormView): template_name = 'wiki/create_root.html' def dispatch(self, request, *args, **kwargs): - if not request.user.is_superuser: + org = request.organization + if ( + not request.user.is_org_manager + or not org.wiki_admins.filter(id=request.user.id).exists() + or not request.user.is_superuser + ): return redirect("wiki:root_missing") - org = request.organization try: root = models.URLPath.root(org) if request.method == "GET" and root.article.organization != org: -- 2.45.2