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{ diff --git a/templates/org/team/new.tmpl b/templates/org/team/new.tmpl index 1cf2dd0236..9877e9a941 100644 --- a/templates/org/team/new.tmpl +++ b/templates/org/team/new.tmpl @@ -89,10 +89,10 @@
{{range $t, $unit := $.Units}} - {{if ge $unit.MaxPerms 2}} + {{if ge $unit.MaxPerm 2}}