diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2022-01-08 23:19:36 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-08 15:19:36 +0000 |
commit | 23f5a34c8904bccd23f4009549ac327672443d99 (patch) | |
tree | d523206f74a3375409b4830ef15b8ebdde82fa88 /models | |
parent | 70d7475356921b2c9f1f7ceb2c3010ce449bcc2c (diff) | |
download | gitea-23f5a34c8904bccd23f4009549ac327672443d99.tar.gz gitea-23f5a34c8904bccd23f4009549ac327672443d99.zip |
Fix new team (#18212)
fix regression from #17811
Diffstat (limited to 'models')
-rw-r--r-- | models/unit/unit.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/models/unit/unit.go b/models/unit/unit.go index b05f34b64c..eb71276786 100644 --- a/models/unit/unit.go +++ b/models/unit/unit.go @@ -193,6 +193,14 @@ func (u Unit) IsLessThan(unit Unit) bool { return u.Idx < unit.Idx } +// MaxPerm returns the max perms of this unit +func (u Unit) MaxPerm() perm.AccessMode { + if u.Type == TypeExternalTracker || u.Type == TypeExternalWiki { + return perm.AccessModeRead + } + return perm.AccessModeAdmin +} + // Enumerate all the units var ( UnitCode = Unit{ |