publish: disable js functionalities if not owner

Change-Id: I5a20b208704abc9ef214c7ecb2e9fe7a814ac121
This commit is contained in:
mpl 2013-06-30 22:45:16 +02:00
parent 59f5b41900
commit 49b08f9be2
1 changed files with 2 additions and 4 deletions

View File

@ -517,12 +517,10 @@ func (pr *publishRequest) serveSubject() {
camliPage = camliClosurePage(pr.ph.JSFiles[0])
}
if camliPage != "" {
if camliPage != "" && pr.ViewerIsOwner() {
pr.pf(" <script src='%s'></script>\n", pr.staticPath("closure/goog/base.js"))
pr.pf(" <script src='%s'></script>\n", pr.staticPath("deps.js"))
if pr.ViewerIsOwner() {
pr.pf(" <script src='%s'></script>\n", pr.base+"?camli.mode=config&var=CAMLISTORE_CONFIG")
}
pr.pf(" <script src='%s'></script>\n", pr.staticPath("base64.js"))
pr.pf(" <script src='%s'></script>\n", pr.staticPath("Crypto.js"))
pr.pf(" <script src='%s'></script>\n", pr.staticPath("SHA1.js"))
@ -594,7 +592,7 @@ func (pr *publishRequest) serveSubject() {
pr.pf("</ul>\n")
}
if camliPage != "" {
if camliPage != "" && pr.ViewerIsOwner() {
pr.pf("<script>\n")
pr.pf("var page = new camlistore.%s(CAMLISTORE_CONFIG);\n", camliPage)
pr.pf("page.decorate(document.body);\n")