diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2021-11-24 17:49:20 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-24 17:49:20 +0800 |
commit | a666829a37be6f9fd98f9e7dd1767c420f7f3b32 (patch) | |
tree | 9ab1434b759a8a2cb275a83149903a823851e309 /models/access.go | |
parent | 4e7ca946da2a2642a62f114825129bf5d7ed9196 (diff) | |
download | gitea-a666829a37be6f9fd98f9e7dd1767c420f7f3b32.tar.gz gitea-a666829a37be6f9fd98f9e7dd1767c420f7f3b32.zip |
Move user related model into models/user (#17781)
* Move user related model into models/user
* Fix lint for windows
* Fix windows lint
* Fix windows lint
* Move some tests in models
* Merge
Diffstat (limited to 'models/access.go')
-rw-r--r-- | models/access.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/models/access.go b/models/access.go index 7af88e1b4a..01b37dd7ae 100644 --- a/models/access.go +++ b/models/access.go @@ -9,6 +9,7 @@ import ( "fmt" "code.gitea.io/gitea/models/db" + user_model "code.gitea.io/gitea/models/user" "code.gitea.io/gitea/modules/log" ) @@ -76,7 +77,7 @@ func init() { db.RegisterModel(new(Access)) } -func accessLevel(e db.Engine, user *User, repo *Repository) (AccessMode, error) { +func accessLevel(e db.Engine, user *user_model.User, repo *Repository) (AccessMode, error) { mode := AccessModeNone var userID int64 restricted := false @@ -116,12 +117,12 @@ func maxAccessMode(modes ...AccessMode) AccessMode { } type userAccess struct { - User *User + User *user_model.User Mode AccessMode } // updateUserAccess updates an access map so that user has at least mode -func updateUserAccess(accessMap map[int64]*userAccess, user *User, mode AccessMode) { +func updateUserAccess(accessMap map[int64]*userAccess, user *user_model.User, mode AccessMode) { if ua, ok := accessMap[user.ID]; ok { ua.Mode = maxAccessMode(ua.Mode, mode) } else { |