-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix enforce-password issue for public link ocis#issue-6476
- Loading branch information
Showing
14 changed files
with
537 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Bugfix: fix enforce-password issue | ||
|
||
Fix updating public share without password when enforce-password is enabled | ||
|
||
https://github.com/cs3org/reva/pull/3970 | ||
https://github.com/owncloud/ocis/issues/6476 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
Bugfix: fix panic | ||
|
||
https://github.com/cs3org/reva/pull/3955 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
103 changes: 103 additions & 0 deletions
103
internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/public_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
package shares | ||
|
||
import ( | ||
"testing" | ||
) | ||
|
||
func TestHandler_enforcePassword(t *testing.T) { | ||
tests := []struct { | ||
name string | ||
h *Handler | ||
permKey int | ||
exp bool | ||
}{ | ||
{ | ||
name: "enforce permission 1", | ||
h: &Handler{ | ||
publicPasswordEnforced: passwordEnforced{ | ||
EnforcedForReadOnly: true, | ||
}, | ||
}, | ||
permKey: 1, | ||
exp: true, | ||
}, | ||
{ | ||
name: "enforce permission 3", | ||
h: &Handler{ | ||
publicPasswordEnforced: passwordEnforced{ | ||
EnforcedForReadWrite: true, | ||
}, | ||
}, | ||
permKey: 3, | ||
exp: true, | ||
}, | ||
{ | ||
name: "enforce permission 4", | ||
h: &Handler{ | ||
publicPasswordEnforced: passwordEnforced{ | ||
EnforcedForUploadOnly: true, | ||
}, | ||
}, | ||
permKey: 4, | ||
exp: true, | ||
}, | ||
{ | ||
name: "enforce permission 5", | ||
h: &Handler{ | ||
publicPasswordEnforced: passwordEnforced{ | ||
EnforcedForReadWrite: true, | ||
}, | ||
}, | ||
permKey: 5, | ||
exp: true, | ||
}, | ||
{ | ||
name: "enforce permission 15", | ||
h: &Handler{ | ||
publicPasswordEnforced: passwordEnforced{ | ||
EnforcedForReadWriteDelete: true, | ||
}, | ||
}, | ||
permKey: 15, | ||
exp: true, | ||
}, | ||
{ | ||
name: "enforce permission 3 failed", | ||
h: &Handler{ | ||
publicPasswordEnforced: passwordEnforced{ | ||
EnforcedForReadOnly: true, | ||
}, | ||
}, | ||
permKey: 3, | ||
exp: false, | ||
}, | ||
{ | ||
name: "enforce permission 8 failed", | ||
h: &Handler{ | ||
publicPasswordEnforced: passwordEnforced{ | ||
EnforcedForReadWriteDelete: true, | ||
EnforcedForUploadOnly: true, | ||
}, | ||
}, | ||
permKey: 8, | ||
exp: false, | ||
}, | ||
{ | ||
name: "enforce permission 11 failed", | ||
h: &Handler{ | ||
publicPasswordEnforced: passwordEnforced{ | ||
EnforcedForReadWriteDelete: true, | ||
}, | ||
}, | ||
permKey: 11, | ||
exp: false, | ||
}, | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
if tt.h.enforcePassword(&tt.permKey) != tt.exp { | ||
t.Errorf("enforcePassword(\"%v\") returned %v instead of expected %v", tt.permKey, tt.h.enforcePassword(&tt.permKey), tt.exp) | ||
} | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.