Add per-cmd site permission query

This commit is contained in:
shortcutme 2018-01-28 16:41:42 +01:00
parent 4a823c57d5
commit 56e80f7c0c
No known key found for this signature in database
GPG key ID: 5B63BAE6CB9613AE

View file

@ -159,7 +159,7 @@ class UiWebsocket(object):
return True
# Has permission to access a site
def hasSitePermission(self, address):
def hasSitePermission(self, address, cmd=None):
if address != self.site.address and "ADMIN" not in self.site.settings["permissions"]:
return False
else:
@ -323,7 +323,7 @@ class UiWebsocket(object):
# - Actions -
def actionAs(self, to, address, cmd, params=[]):
if not self.hasSitePermission(address):
if not self.hasSitePermission(address, cmd=cmd):
return self.response(to, "No permission for site %s" % address)
req_self = copy.copy(self)
req_self.site = self.server.sites.get(address)