diff options
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/serv.go | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/cmd/serv.go b/cmd/serv.go index ca042e2b2b..51b0b4984b 100644 --- a/cmd/serv.go +++ b/cmd/serv.go @@ -193,7 +193,7 @@ func runServ(c *cli.Context) error { keyID int64 user *models.User ) - if requestedMode == models.AccessModeWrite || repo.IsPrivate { + if requestedMode == models.AccessModeWrite || repo.IsPrivate || setting.Service.RequireSignInView { keys := strings.Split(c.Args()[0], "-") if len(keys) != 2 { fail("Key ID format error", "Invalid key argument: %s", c.Args()[0]) @@ -236,7 +236,7 @@ func runServ(c *cli.Context) error { user.Name, repoPath) } - mode, err := private.AccessLevel(user.ID, repo.ID) + mode, err := private.CheckUnitUser(user.ID, repo.ID, user.IsAdmin, unitType) if err != nil { fail("Internal error", "Failed to check access: %v", err) } else if *mode < requestedMode { @@ -249,16 +249,6 @@ func runServ(c *cli.Context) error { user.Name, requestedMode, repoPath) } - check, err := private.CheckUnitUser(user.ID, repo.ID, user.IsAdmin, unitType) - if err != nil { - fail("You do not have allowed for this action", "Failed to access internal api: [user.Name: %s, repoPath: %s]", user.Name, repoPath) - } - if !check { - fail("You do not have allowed for this action", - "User %s does not have allowed access to repository %s 's code", - user.Name, repoPath) - } - os.Setenv(models.EnvPusherName, user.Name) os.Setenv(models.EnvPusherID, fmt.Sprintf("%d", user.ID)) } |