aboutsummaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
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{