Skip to content

Commit f362333

Browse files
Open tag creation and editing to curators (#11296)
* Open tag creation and editing to curators --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 934464d commit f362333

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

openlibrary/core/models.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -955,6 +955,9 @@ def is_beta_tester(self) -> bool:
955955
def is_read_only(self) -> bool:
956956
return self.is_usergroup_member('/usergroup/read-only')
957957

958+
def is_curator(self) -> bool:
959+
return self.is_usergroup_member('/usergroup/curators')
960+
958961
def get_lists(self, seed=None, limit=100, offset=0, sort=True):
959962
"""Returns all the lists of this user.
960963

openlibrary/plugins/upstream/addtag.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def has_permission(self, user) -> bool:
9595
"""
9696
Returns True if the given user can create a new Tag
9797
"""
98-
return user and user.is_admin()
98+
return user and (user.is_admin() or user.is_curator())
9999

100100
def POST(self):
101101
i = web.input(
@@ -212,7 +212,7 @@ def has_permission(self, tag):
212212
if not (patron := get_current_user()):
213213
return False
214214

215-
is_in_permitted_group = patron.is_admin()
215+
is_in_permitted_group = patron.is_admin() or patron.is_curator()
216216
is_deputy = patron.key == tag.get("deputy", None)
217217

218218
if is_in_permitted_group:

openlibrary/templates/subjects.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
$var title: $page.name
44

5-
$ can_add_tag = ctx.user and (ctx.user.is_admin())
5+
$ can_add_tag = ctx.user and (ctx.user.is_admin() or ctx.user.is_curator())
66
$ has_tag = 'tag' in page
77
$ q = query_param('q')
88

0 commit comments

Comments
 (0)