summaryrefslogtreecommitdiffstats
path: root/models/access.go
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2016-07-24 01:08:22 +0800
committerUnknwon <u@gogs.io>2016-07-24 01:08:22 +0800
commit1f2e173a745da8e4b57f96b5561a3c10054d3b76 (patch)
tree367f0f07e4fe1269ac0772e0561a4bf912b5153c /models/access.go
parent46e96c008cf966428c9dad71c7871de88186e3fe (diff)
downloadgitea-1f2e173a745da8e4b57f96b5561a3c10054d3b76.tar.gz
gitea-1f2e173a745da8e4b57f96b5561a3c10054d3b76.zip
Refactor User.Id to User.ID
Diffstat (limited to 'models/access.go')
-rw-r--r--models/access.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/models/access.go b/models/access.go
index b4c1349b65..32e9b6ea8b 100644
--- a/models/access.go
+++ b/models/access.go
@@ -67,11 +67,11 @@ func accessLevel(e Engine, u *User, repo *Repository) (AccessMode, error) {
return mode, nil
}
- if u.Id == repo.OwnerID {
+ if u.ID == repo.OwnerID {
return ACCESS_MODE_OWNER, nil
}
- a := &Access{UserID: u.Id, RepoID: repo.ID}
+ a := &Access{UserID: u.ID, RepoID: repo.ID}
if has, err := e.Get(a); !has || err != nil {
return mode, err
}
@@ -97,7 +97,7 @@ func HasAccess(u *User, repo *Repository, testMode AccessMode) (bool, error) {
// GetRepositoryAccesses finds all repositories with their access mode where a user has access but does not own.
func (u *User) GetRepositoryAccesses() (map[*Repository]AccessMode, error) {
accesses := make([]*Access, 0, 10)
- if err := x.Find(&accesses, &Access{UserID: u.Id}); err != nil {
+ if err := x.Find(&accesses, &Access{UserID: u.ID}); err != nil {
return nil, err
}
@@ -113,7 +113,7 @@ func (u *User) GetRepositoryAccesses() (map[*Repository]AccessMode, error) {
}
if err = repo.GetOwner(); err != nil {
return nil, err
- } else if repo.OwnerID == u.Id {
+ } else if repo.OwnerID == u.ID {
continue
}
repos[repo] = access.Mode
@@ -124,7 +124,7 @@ func (u *User) GetRepositoryAccesses() (map[*Repository]AccessMode, error) {
// GetAccessibleRepositories finds all repositories where a user has access but does not own.
func (u *User) GetAccessibleRepositories() ([]*Repository, error) {
accesses := make([]*Access, 0, 10)
- if err := x.Find(&accesses, &Access{UserID: u.Id}); err != nil {
+ if err := x.Find(&accesses, &Access{UserID: u.ID}); err != nil {
return nil, err
}
@@ -137,7 +137,7 @@ func (u *User) GetAccessibleRepositories() ([]*Repository, error) {
repoIDs = append(repoIDs, access.RepoID)
}
repos := make([]*Repository, 0, len(repoIDs))
- return repos, x.Where("owner_id != ?", u.Id).In("id", repoIDs).Desc("updated_unix").Find(&repos)
+ return repos, x.Where("owner_id != ?", u.ID).In("id", repoIDs).Desc("updated_unix").Find(&repos)
}
func maxAccessMode(modes ...AccessMode) AccessMode {
@@ -227,7 +227,7 @@ func (repo *Repository) recalculateTeamAccesses(e Engine, ignTeamID int64) (err
return fmt.Errorf("getMembers '%d': %v", t.ID, err)
}
for _, m := range t.Members {
- accessMap[m.Id] = maxAccessMode(accessMap[m.Id], t.Authorize)
+ accessMap[m.ID] = maxAccessMode(accessMap[m.ID], t.Authorize)
}
}