aboutsummaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2022-01-08 23:19:36 +0800
committerGitHub <noreply@github.com>2022-01-08 15:19:36 +0000
commit23f5a34c8904bccd23f4009549ac327672443d99 (patch)
treed523206f74a3375409b4830ef15b8ebdde82fa88 /models
parent70d7475356921b2c9f1f7ceb2c3010ce449bcc2c (diff)
downloadgitea-23f5a34c8904bccd23f4009549ac327672443d99.tar.gz
gitea-23f5a34c8904bccd23f4009549ac327672443d99.zip
Fix new team (#18212)
fix regression from #17811
Diffstat (limited to 'models')
-rw-r--r--models/unit/unit.go8
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{