Browse Source

Add auth principals for some topic tools

Allows (manually) granting permissions to allow users to re-tag topics,
move them between groups, and edit their titles.

This should probably be generalized in the near future, but this will do
the trick for now.
merge-requests/29/head
Deimos 6 years ago
parent
commit
1d8b74ca3c
  1. 9
      tildes/tildes/models/topic/topic.py

9
tildes/tildes/models/topic/topic.py

@ -264,14 +264,19 @@ class Topic(DatabaseModel):
acl.append((Allow, self.user_id, "delete")) acl.append((Allow, self.user_id, "delete"))
# tag: # tag:
# - only the author and admins can tag topics
# - allow tagging by the author, admins, and people with "topic.tag" principal
acl.append((Allow, self.user_id, "tag")) acl.append((Allow, self.user_id, "tag"))
acl.append((Allow, "admin", "tag")) acl.append((Allow, "admin", "tag"))
acl.append((Allow, "topic.tag", "tag"))
# admin tools
# tools that require specifically granted permissions
acl.append((Allow, "admin", "lock")) acl.append((Allow, "admin", "lock"))
acl.append((Allow, "admin", "move")) acl.append((Allow, "admin", "move"))
acl.append((Allow, "topic.move", "move"))
acl.append((Allow, "admin", "edit_title")) acl.append((Allow, "admin", "edit_title"))
acl.append((Allow, "topic.edit_title", "edit_title"))
acl.append(DENY_ALL) acl.append(DENY_ALL)

Loading…
Cancel
Save