@ -310,14 +310,16 @@ func testIdentityForToken(token string) (bool, structs.ACLIdentity, error) {
func testPolicyForID ( policyID string ) ( bool , * structs . ACLPolicy , error ) {
func testPolicyForID ( policyID string ) ( bool , * structs . ACLPolicy , error ) {
switch policyID {
switch policyID {
case "acl-ro" :
case "acl-ro" :
return true , & structs . ACLPolicy {
p := & structs . ACLPolicy {
ID : "acl-ro" ,
ID : "acl-ro" ,
Name : "acl-ro" ,
Name : "acl-ro" ,
Description : "acl-ro" ,
Description : "acl-ro" ,
Rules : ` acl = "read" ` ,
Rules : ` acl = "read" ` ,
Syntax : acl . SyntaxCurrent ,
Syntax : acl . SyntaxCurrent ,
RaftIndex : structs . RaftIndex { CreateIndex : 1 , ModifyIndex : 2 } ,
RaftIndex : structs . RaftIndex { CreateIndex : 1 , ModifyIndex : 2 } ,
} , nil
}
p . SetHash ( false )
return true , p , nil
case "acl-wr" :
case "acl-wr" :
p := & structs . ACLPolicy {
p := & structs . ACLPolicy {
ID : "acl-wr" ,
ID : "acl-wr" ,
@ -330,23 +332,27 @@ func testPolicyForID(policyID string) (bool, *structs.ACLPolicy, error) {
p . SetHash ( false )
p . SetHash ( false )
return true , p , nil
return true , p , nil
case "service-ro" :
case "service-ro" :
return true , & structs . ACLPolicy {
p := & structs . ACLPolicy {
ID : "service-ro" ,
ID : "service-ro" ,
Name : "service-ro" ,
Name : "service-ro" ,
Description : "service-ro" ,
Description : "service-ro" ,
Rules : ` service_prefix "" { policy = "read" } ` ,
Rules : ` service_prefix "" { policy = "read" } ` ,
Syntax : acl . SyntaxCurrent ,
Syntax : acl . SyntaxCurrent ,
RaftIndex : structs . RaftIndex { CreateIndex : 1 , ModifyIndex : 2 } ,
RaftIndex : structs . RaftIndex { CreateIndex : 1 , ModifyIndex : 2 } ,
} , nil
}
p . SetHash ( false )
return true , p , nil
case "service-wr" :
case "service-wr" :
return true , & structs . ACLPolicy {
p := & structs . ACLPolicy {
ID : "service-wr" ,
ID : "service-wr" ,
Name : "service-wr" ,
Name : "service-wr" ,
Description : "service-wr" ,
Description : "service-wr" ,
Rules : ` service_prefix "" { policy = "write" } ` ,
Rules : ` service_prefix "" { policy = "write" } ` ,
Syntax : acl . SyntaxCurrent ,
Syntax : acl . SyntaxCurrent ,
RaftIndex : structs . RaftIndex { CreateIndex : 1 , ModifyIndex : 2 } ,
RaftIndex : structs . RaftIndex { CreateIndex : 1 , ModifyIndex : 2 } ,
} , nil
}
p . SetHash ( false )
return true , p , nil
case "node-wr" :
case "node-wr" :
p := & structs . ACLPolicy {
p := & structs . ACLPolicy {
ID : "node-wr" ,
ID : "node-wr" ,
@ -360,7 +366,7 @@ func testPolicyForID(policyID string) (bool, *structs.ACLPolicy, error) {
p . SetHash ( false )
p . SetHash ( false )
return true , p , nil
return true , p , nil
case "dc2-key-wr" :
case "dc2-key-wr" :
return true , & structs . ACLPolicy {
p := & structs . ACLPolicy {
ID : "dc2-key-wr" ,
ID : "dc2-key-wr" ,
Name : "dc2-key-wr" ,
Name : "dc2-key-wr" ,
Description : "dc2-key-wr" ,
Description : "dc2-key-wr" ,
@ -368,7 +374,9 @@ func testPolicyForID(policyID string) (bool, *structs.ACLPolicy, error) {
Syntax : acl . SyntaxCurrent ,
Syntax : acl . SyntaxCurrent ,
Datacenters : [ ] string { "dc2" } ,
Datacenters : [ ] string { "dc2" } ,
RaftIndex : structs . RaftIndex { CreateIndex : 1 , ModifyIndex : 2 } ,
RaftIndex : structs . RaftIndex { CreateIndex : 1 , ModifyIndex : 2 } ,
} , nil
}
p . SetHash ( false )
return true , p , nil
default :
default :
return testPolicyForIDEnterprise ( policyID )
return testPolicyForIDEnterprise ( policyID )
}
}