|
|
@ -26,9 +26,10 @@ import ( |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
const ( |
|
|
|
const ( |
|
|
|
_ACCESS_DENIED_MESSAGE = "Repository does not exist or you do not have access" |
|
|
|
accessDenied = "Repository does not exist or you do not have access" |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// CmdServ represents the available serv sub-command.
|
|
|
|
var CmdServ = cli.Command{ |
|
|
|
var CmdServ = cli.Command{ |
|
|
|
Name: "serv", |
|
|
|
Name: "serv", |
|
|
|
Usage: "This command should only be called by SSH shell", |
|
|
|
Usage: "This command should only be called by SSH shell", |
|
|
@ -179,7 +180,7 @@ func runServ(c *cli.Context) error { |
|
|
|
repo, err := models.GetRepositoryByName(repoUser.ID, reponame) |
|
|
|
repo, err := models.GetRepositoryByName(repoUser.ID, reponame) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
if models.IsErrRepoNotExist(err) { |
|
|
|
if models.IsErrRepoNotExist(err) { |
|
|
|
fail(_ACCESS_DENIED_MESSAGE, "Repository does not exist: %s/%s", repoUser.Name, reponame) |
|
|
|
fail(accessDenied, "Repository does not exist: %s/%s", repoUser.Name, reponame) |
|
|
|
} |
|
|
|
} |
|
|
|
fail("Internal error", "Failed to get repository: %v", err) |
|
|
|
fail("Internal error", "Failed to get repository: %v", err) |
|
|
|
} |
|
|
|
} |
|
|
@ -241,7 +242,7 @@ func runServ(c *cli.Context) error { |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
fail("Internal error", "Fail to check access: %v", err) |
|
|
|
fail("Internal error", "Fail to check access: %v", err) |
|
|
|
} else if mode < requestedMode { |
|
|
|
} else if mode < requestedMode { |
|
|
|
clientMessage := _ACCESS_DENIED_MESSAGE |
|
|
|
clientMessage := accessDenied |
|
|
|
if mode >= models.ACCESS_MODE_READ { |
|
|
|
if mode >= models.ACCESS_MODE_READ { |
|
|
|
clientMessage = "You do not have sufficient authorization for this action" |
|
|
|
clientMessage = "You do not have sufficient authorization for this action" |
|
|
|
} |
|
|
|
} |
|
|
|