Swap id field in grants to ids since that's now standardized (#4250)

* Swap id field in grants to ids since that's now standardized

* Fix some tests I missed

* Update generated resource table
This commit is contained in:
Jeff Mitchell authored and GitHub committed 2024-01-17 23:54:49 -08:00
1 parent 962f9bd638
commit 253d79116c
43 files changed
+392 -392

No files matched your search

+18 -18
View File
@@ -151,13 +151,13 @@ func Test_ACLOutputFields(t *testing.T) {
name: "default",
resource: Resource{ScopeId: "o_myorg", Id: "u_bar", Type: resource.Role},
action: action.Read,
grants: []string{"id=u_bar;actions=read,update"},
grants: []string{"ids=u_bar;actions=read,update"},
authorized: true,
},
{
name: "single value",
resource: Resource{ScopeId: "o_myorg", Id: "u_bar", Type: resource.Role},
grants: []string{"id=u_bar;actions=read,update;output_fields=id"},
grants: []string{"ids=u_bar;actions=read,update;output_fields=id"},
action: action.Read,
fields: []string{"id"},
authorized: true,
@@ -166,8 +166,8 @@ func Test_ACLOutputFields(t *testing.T) {
name: "compound no overlap",
resource: Resource{ScopeId: "o_myorg", Id: "u_bar", Type: resource.Role},
grants: []string{
"id=u_bar;actions=read,update;output_fields=id",
"id=*;type=host-catalog;actions=read,update;output_fields=version",
"ids=u_bar;actions=read,update;output_fields=id",
"ids=*;type=host-catalog;actions=read,update;output_fields=version",
},
action: action.Read,
fields: []string{"id"},
@@ -177,8 +177,8 @@ func Test_ACLOutputFields(t *testing.T) {
name: "compound",
resource: Resource{ScopeId: "o_myorg", Id: "u_bar", Type: resource.Role},
grants: []string{
"id=u_bar;actions=read,update;output_fields=id",
"id=*;type=role;output_fields=version",
"ids=u_bar;actions=read,update;output_fields=id",
"ids=*;type=role;output_fields=version",
},
action: action.Read,
fields: []string{"id", "version"},
@@ -188,8 +188,8 @@ func Test_ACLOutputFields(t *testing.T) {
name: "wildcard with type",
resource: Resource{ScopeId: "o_myorg", Id: "u_bar", Type: resource.Role},
grants: []string{
"id=u_bar;actions=read,update;output_fields=read",
"id=*;type=role;output_fields=*",
"ids=u_bar;actions=read,update;output_fields=read",
"ids=*;type=role;output_fields=*",
},
action: action.Read,
fields: []string{"*"},
@@ -199,8 +199,8 @@ func Test_ACLOutputFields(t *testing.T) {
name: "wildcard with wildcard type",
resource: Resource{ScopeId: "o_myorg", Id: "u_bar", Type: resource.Role},
grants: []string{
"id=u_bar;actions=read,update;output_fields=read",
"id=*;type=*;output_fields=*",
"ids=u_bar;actions=read,update;output_fields=read",
"ids=*;type=*;output_fields=*",
},
action: action.Read,
fields: []string{"*"},
@@ -210,7 +210,7 @@ func Test_ACLOutputFields(t *testing.T) {
name: "subaction exact",
resource: Resource{ScopeId: "o_myorg", Id: "u_bar", Type: resource.Role},
grants: []string{
"id=u_bar;actions=read:self,update;output_fields=version",
"ids=u_bar;actions=read:self,update;output_fields=version",
},
action: action.ReadSelf,
fields: []string{"version"},
@@ -222,8 +222,8 @@ func Test_ACLOutputFields(t *testing.T) {
name: "subaction parent action",
resource: Resource{ScopeId: "o_myorg", Id: "u_bar", Type: resource.Role},
grants: []string{
"id=u_bar;actions=read,update;output_fields=version",
"id=u_bar;actions=read:self;output_fields=id",
"ids=u_bar;actions=read,update;output_fields=version",
"ids=u_bar;actions=read:self;output_fields=id",
},
action: action.ReadSelf,
fields: []string{"id", "version"},
@@ -237,8 +237,8 @@ func Test_ACLOutputFields(t *testing.T) {
name: "subaction child action",
resource: Resource{ScopeId: "o_myorg", Id: "u_bar", Type: resource.Role},
grants: []string{
"id=u_bar;actions=read:self,update;output_fields=version",
"id=u_bar;actions=read;output_fields=id",
"ids=u_bar;actions=read:self,update;output_fields=version",
"ids=u_bar;actions=read;output_fields=id",
},
action: action.Read,
fields: []string{"id"},
@@ -248,8 +248,8 @@ func Test_ACLOutputFields(t *testing.T) {
name: "initial grant unauthorized with star",
resource: Resource{ScopeId: "o_myorg", Id: "u_bar", Type: resource.Role},
grants: []string{
"id=u_bar;output_fields=*",
"id=u_bar;actions=delete;output_fields=id",
"ids=u_bar;output_fields=*",
"ids=u_bar;actions=delete;output_fields=id",
},
action: action.Delete,
fields: []string{"*"},
@@ -259,7 +259,7 @@ func Test_ACLOutputFields(t *testing.T) {
name: "unauthorized id only",
resource: Resource{ScopeId: "o_myorg", Id: "u_bar", Type: resource.Role},
grants: []string{
"id=u_bar;output_fields=name",
"ids=u_bar;output_fields=name",
},
action: action.Delete,
fields: []string{"name"},