aboutsummaryrefslogtreecommitdiff
path: root/internal/db/repo_branch.go
diff options
context:
space:
mode:
authorᴜɴᴋɴᴡᴏɴ <u@gogs.io>2020-04-04 21:14:15 +0800
committerGitHub <noreply@github.com>2020-04-04 21:14:15 +0800
commit34145c990d4fd9f278f29cdf9c61378a75e9b934 (patch)
tree7b151bbd5aef9e487759953e3a775a82244d268d /internal/db/repo_branch.go
parent2bd9d0b9c8238ded727cd98a3ace20b53c10a44f (diff)
lfs: implement HTTP routes (#6035)
* Bootstrap with GORM * Fix lint error * Set conn max lifetime to one minute * Fallback to use gorm v1 * Define HTTP routes * Finish authentication * Save token updated * Add docstring * Finish authorization * serveBatch rundown * Define types in lfsutil * Finish Batch * authutil * Finish basic * Formalize response error * Fix lint errors * authutil: add tests * dbutil: add tests * lfsutil: add tests * strutil: add tests * Formalize 401 response
Diffstat (limited to 'internal/db/repo_branch.go')
-rw-r--r--internal/db/repo_branch.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/internal/db/repo_branch.go b/internal/db/repo_branch.go
index 8da99945..ceb99231 100644
--- a/internal/db/repo_branch.go
+++ b/internal/db/repo_branch.go
@@ -175,7 +175,7 @@ func UpdateOrgProtectBranch(repo *Repository, protectBranch *ProtectBranch, whit
userIDs := tool.StringsToInt64s(strings.Split(whitelistUserIDs, ","))
validUserIDs = make([]int64, 0, len(userIDs))
for _, userID := range userIDs {
- has, err := HasAccess(userID, repo, ACCESS_MODE_WRITE)
+ has, err := HasAccess(userID, repo, AccessModeWrite)
if err != nil {
return fmt.Errorf("HasAccess [user_id: %d, repo_id: %d]: %v", userID, protectBranch.RepoID, err)
} else if !has {
@@ -193,7 +193,7 @@ func UpdateOrgProtectBranch(repo *Repository, protectBranch *ProtectBranch, whit
if protectBranch.WhitelistTeamIDs != whitelistTeamIDs {
hasTeamsChanged = true
teamIDs := tool.StringsToInt64s(strings.Split(whitelistTeamIDs, ","))
- teams, err := GetTeamsHaveAccessToRepo(repo.OwnerID, repo.ID, ACCESS_MODE_WRITE)
+ teams, err := GetTeamsHaveAccessToRepo(repo.OwnerID, repo.ID, AccessModeWrite)
if err != nil {
return fmt.Errorf("GetTeamsHaveAccessToRepo [org_id: %d, repo_id: %d]: %v", repo.OwnerID, repo.ID, err)
}