|
|
@ -103,16 +103,19 @@ func TestPolicyACL(t *testing.T) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
type tcase struct {
|
|
|
|
type tcase struct {
|
|
|
|
inp string
|
|
|
|
inp string
|
|
|
|
read bool
|
|
|
|
read bool
|
|
|
|
write bool
|
|
|
|
write bool
|
|
|
|
|
|
|
|
writePrefix bool
|
|
|
|
}
|
|
|
|
}
|
|
|
|
cases := []tcase{
|
|
|
|
cases := []tcase{
|
|
|
|
{"other", true, true},
|
|
|
|
{"other", true, true, true},
|
|
|
|
{"foo/test", true, true},
|
|
|
|
{"foo/test", true, true, true},
|
|
|
|
{"foo/priv/test", false, false},
|
|
|
|
{"foo/priv/test", false, false, false},
|
|
|
|
{"bar/any", false, false},
|
|
|
|
{"bar/any", false, false, false},
|
|
|
|
{"zip/test", true, false},
|
|
|
|
{"zip/test", true, false, false},
|
|
|
|
|
|
|
|
{"foo/", true, true, false},
|
|
|
|
|
|
|
|
{"", true, true, false},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for _, c := range cases {
|
|
|
|
for _, c := range cases {
|
|
|
|
if c.read != acl.KeyRead(c.inp) {
|
|
|
|
if c.read != acl.KeyRead(c.inp) {
|
|
|
@ -121,6 +124,9 @@ func TestPolicyACL(t *testing.T) {
|
|
|
|
if c.write != acl.KeyWrite(c.inp) {
|
|
|
|
if c.write != acl.KeyWrite(c.inp) {
|
|
|
|
t.Fatalf("Write fail: %#v", c)
|
|
|
|
t.Fatalf("Write fail: %#v", c)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if c.writePrefix != acl.KeyWritePrefix(c.inp) {
|
|
|
|
|
|
|
|
t.Fatalf("Write prefix fail: %#v", c)
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -165,16 +171,17 @@ func TestPolicyACL_Parent(t *testing.T) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
type tcase struct {
|
|
|
|
type tcase struct {
|
|
|
|
inp string
|
|
|
|
inp string
|
|
|
|
read bool
|
|
|
|
read bool
|
|
|
|
write bool
|
|
|
|
write bool
|
|
|
|
|
|
|
|
writePrefix bool
|
|
|
|
}
|
|
|
|
}
|
|
|
|
cases := []tcase{
|
|
|
|
cases := []tcase{
|
|
|
|
{"other", false, false},
|
|
|
|
{"other", false, false, false},
|
|
|
|
{"foo/test", true, true},
|
|
|
|
{"foo/test", true, true, true},
|
|
|
|
{"foo/priv/test", true, false},
|
|
|
|
{"foo/priv/test", true, false, false},
|
|
|
|
{"bar/any", false, false},
|
|
|
|
{"bar/any", false, false, false},
|
|
|
|
{"zip/test", true, false},
|
|
|
|
{"zip/test", true, false, false},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for _, c := range cases {
|
|
|
|
for _, c := range cases {
|
|
|
|
if c.read != acl.KeyRead(c.inp) {
|
|
|
|
if c.read != acl.KeyRead(c.inp) {
|
|
|
@ -183,5 +190,8 @@ func TestPolicyACL_Parent(t *testing.T) {
|
|
|
|
if c.write != acl.KeyWrite(c.inp) {
|
|
|
|
if c.write != acl.KeyWrite(c.inp) {
|
|
|
|
t.Fatalf("Write fail: %#v", c)
|
|
|
|
t.Fatalf("Write fail: %#v", c)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if c.writePrefix != acl.KeyWritePrefix(c.inp) {
|
|
|
|
|
|
|
|
t.Fatalf("Write prefix fail: %#v", c)
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|