Skip to content

Commit 218b8cc

Browse files
author
Gusted
committed
Let return correct perm (go-gitea#18675)
Backport of go-gitea#18675
1 parent 38fc6c7 commit 218b8cc

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

models/unit/unit.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,12 @@ func AllUnitKeyNames() []string {
328328
// MinUnitAccessMode returns the minial permission of the permission map
329329
func MinUnitAccessMode(unitsMap map[Type]perm.AccessMode) perm.AccessMode {
330330
res := perm.AccessModeNone
331-
for _, mode := range unitsMap {
331+
for t, mode := range unitsMap {
332+
// Don't allow `TypeExternal{Tracker,Wiki}` to influence this as they can only be set to READ perms.
333+
if t == TypeExternalTracker || t == TypeExternalWiki {
334+
continue
335+
}
336+
332337
// get the minial permission great than AccessModeNone except all are AccessModeNone
333338
if mode > perm.AccessModeNone && (res == perm.AccessModeNone || mode < res) {
334339
res = mode

0 commit comments

Comments
 (0)