Merge pull request #1122 from imachug/siteclone
Allow siteClone for non-admin sites
This commit is contained in:
commit
27a9ea78b8
1 changed files with 20 additions and 2 deletions
|
@ -33,7 +33,7 @@ class UiWebsocket(object):
|
||||||
self.sending = False # Currently sending to client
|
self.sending = False # Currently sending to client
|
||||||
self.send_queue = [] # Messages to send to client
|
self.send_queue = [] # Messages to send to client
|
||||||
self.admin_commands = (
|
self.admin_commands = (
|
||||||
"sitePause", "siteResume", "siteDelete", "siteList", "siteSetLimit", "siteClone",
|
"sitePause", "siteResume", "siteDelete", "siteList", "siteSetLimit",
|
||||||
"channelJoinAllsite", "serverUpdate", "serverPortcheck", "serverShutdown", "serverShowdirectory",
|
"channelJoinAllsite", "serverUpdate", "serverPortcheck", "serverShutdown", "serverShowdirectory",
|
||||||
"certSet", "configSet", "permissionAdd", "permissionRemove"
|
"certSet", "configSet", "permissionAdd", "permissionRemove"
|
||||||
)
|
)
|
||||||
|
@ -809,7 +809,7 @@ class UiWebsocket(object):
|
||||||
else:
|
else:
|
||||||
self.response(to, {"error": "Unknown site: %s" % address})
|
self.response(to, {"error": "Unknown site: %s" % address})
|
||||||
|
|
||||||
def actionSiteClone(self, to, address, root_inner_path="", target_address=None):
|
def cbSiteClone(self, to, address, root_inner_path="", target_address=None):
|
||||||
self.cmd("notification", ["info", _["Cloning site..."]])
|
self.cmd("notification", ["info", _["Cloning site..."]])
|
||||||
site = self.server.sites.get(address)
|
site = self.server.sites.get(address)
|
||||||
if target_address:
|
if target_address:
|
||||||
|
@ -827,6 +827,24 @@ class UiWebsocket(object):
|
||||||
self.cmd("notification", ["done", _["Site cloned"] + "<script>window.top.location = '/%s'</script>" % new_address])
|
self.cmd("notification", ["done", _["Site cloned"] + "<script>window.top.location = '/%s'</script>" % new_address])
|
||||||
gevent.spawn(new_site.announce)
|
gevent.spawn(new_site.announce)
|
||||||
|
|
||||||
|
def actionSiteClone(self, to, address, root_inner_path="", target_address=None):
|
||||||
|
if not SiteManager.site_manager.isAddress(address):
|
||||||
|
self.response(to, {"error": "Not a site: %s" % address})
|
||||||
|
return
|
||||||
|
|
||||||
|
if not self.server.sites.get(address):
|
||||||
|
# Don't expose site existense
|
||||||
|
return
|
||||||
|
|
||||||
|
if "ADMIN" in self.getPermissions(to):
|
||||||
|
self.cbSiteClone(to, address, root_inner_path, target_address)
|
||||||
|
else:
|
||||||
|
self.cmd(
|
||||||
|
"confirm",
|
||||||
|
[_["Clone site <b>%s</b>?"] % address, _["Clone"]],
|
||||||
|
lambda (res): self.cbSiteClone(to, address, root_inner_path, target_address)
|
||||||
|
)
|
||||||
|
|
||||||
def actionSiteSetLimit(self, to, size_limit):
|
def actionSiteSetLimit(self, to, size_limit):
|
||||||
self.site.settings["size_limit"] = int(size_limit)
|
self.site.settings["size_limit"] = int(size_limit)
|
||||||
self.site.saveSettings()
|
self.site.saveSettings()
|
||||||
|
|
Loading…
Reference in a new issue