Skip to content

Commit 59afba7

Browse files
committed
protect access to backup UI for admin only, closes #6
1 parent ce9bc5b commit 59afba7

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/main/scala/fr/brouillard/gitbucket/h2/controller/H2BackupController.scala

+4-3
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@ import java.io.File
44

55
import gitbucket.core.controller.ControllerBase
66
import gitbucket.core.servlet.Database
7+
import gitbucket.core.util.AdminAuthenticator
78
import gitbucket.core.util.Directory._
89
import fr.brouillard.gitbucket.h2._
910
import org.scalatra.Ok
1011
import org.slf4j.LoggerFactory
1112
import jp.sf.amateras.scalatra.forms._
1213

13-
class H2BackupController extends ControllerBase {
14+
class H2BackupController extends ControllerBase with AdminAuthenticator {
1415
private val logger = LoggerFactory.getLogger(classOf[H2BackupController])
1516

1617
case class BackupForm(destFile: String)
@@ -35,9 +36,9 @@ class H2BackupController extends ControllerBase {
3536
exportDatabase(exportFile);
3637
}
3738

38-
get("/admin/h2backup") {
39+
get("/admin/h2backup") (adminOnly {
3940
html.export(flash.get("info"), flash.get("dest").orElse(Some(defaultBackupFile)));
40-
}
41+
})
4142

4243
get("/database/backup") {
4344
val filePath:String = params.getOrElse("dest", defaultBackupFile)

0 commit comments

Comments
 (0)