From 579cdd4a691adbbe89f85ce679502cf5d1f045d0 Mon Sep 17 00:00:00 2001 From: James Moger <james.moger@gitblit.com> Date: Wed, 28 Nov 2012 17:09:45 -0500 Subject: [PATCH] Fixed missing format call for certificate authentication logging --- groovy/blockpush.groovy | 22 ++++++++++++++-------- 1 files changed, 14 insertions(+), 8 deletions(-) diff --git a/groovy/blockpush.groovy b/groovy/blockpush.groovy index eac7d3f..caef330 100644 --- a/groovy/blockpush.groovy +++ b/groovy/blockpush.groovy @@ -21,6 +21,7 @@ import org.eclipse.jgit.transport.ReceiveCommand import org.eclipse.jgit.transport.ReceiveCommand.Result import org.slf4j.Logger +import com.gitblit.utils.ClientLogger /** * Sample Gitblit Pre-Receive Hook: blockpush @@ -50,12 +51,17 @@ * chain, "return false" at the appropriate failure points. * * Bound Variables: - * gitblit Gitblit Server com.gitblit.GitBlit - * repository Gitblit Repository com.gitblit.models.RepositoryModel - * user Gitblit User com.gitblit.models.UserModel - * commands JGit commands Collection<org.eclipse.jgit.transport.ReceiveCommand> - * url Base url for Gitblit String - * log Logger instance org.slf4j.Logger + * gitblit Gitblit Server com.gitblit.GitBlit + * repository Gitblit Repository com.gitblit.models.RepositoryModel + * receivePack JGit Receive Pack org.eclipse.jgit.transport.ReceivePack + * user Gitblit User com.gitblit.models.UserModel + * commands JGit commands Collection<org.eclipse.jgit.transport.ReceiveCommand> + * url Base url for Gitblit String + * logger Logs messages to Gitblit org.slf4j.Logger + * clientLogger Logs messages to Git client com.gitblit.utils.ClientLogger + * + * Accessing Gitblit Custom Fields: + * def myCustomField = repository.customFields.myCustomField * */ @@ -67,10 +73,10 @@ */ def blocked = false switch (repository.name) { - case "ex@mple.git": + case 'ex@mple.git': for (ReceiveCommand command : commands) { def updatedRef = command.refName - if (updatedRef.equals("refs/heads/master")) { + if (updatedRef.equals('refs/heads/master')) { // to reject a command set it's result to anything other than Result.NOT_ATTEMPTED command.setResult(Result.REJECTED_OTHER_REASON, "You are not permitted to write to ${repository.name}:${updatedRef}") blocked = true -- Gitblit v1.9.1