Skip to content

Commit c573595

Browse files
authored
fix(core): deprecate policy WithValue selector not utilized by RPC (#2794)
### Proposed Changes * This proto field has not been utilized by the service RPC in some time, so we can deprecate it in consumer code. ### Checklist - [ ] I have added or updated unit tests - [ ] I have added or updated integration tests (if appropriate) - [ ] I have added or updated documentation ### Testing Instructions
1 parent 7147c4b commit c573595

File tree

6 files changed

+1
-77
lines changed

6 files changed

+1
-77
lines changed

sdk/granter.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -436,9 +436,6 @@ func newGranterFromService(ctx context.Context, logger *slog.Logger, keyCache *k
436436

437437
av, err := as.GetAttributeValuesByFqns(ctx, &attributes.GetAttributeValuesByFqnsRequest{
438438
Fqns: fqnsStr,
439-
WithValue: &policy.AttributeValueSelector{
440-
WithKeyAccessGrants: true,
441-
},
442439
})
443440
if err != nil {
444441
return granter{}, err

service/authorization/authorization.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -730,9 +730,6 @@ func retrieveAttributeDefinitions(ctx context.Context, attrFqns []string, sdk *o
730730
}
731731

732732
resp, err := sdk.Attributes.GetAttributeValuesByFqns(ctx, &attr.GetAttributeValuesByFqnsRequest{
733-
WithValue: &policy.AttributeValueSelector{
734-
WithSubjectMaps: false,
735-
},
736733
Fqns: attrFqns,
737734
})
738735
if err != nil {

service/integration/attribute_fqns_test.go

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -981,9 +981,6 @@ func (s *AttributeFqnSuite) TestGetAttributesByValueFqns() {
981981
fqns := []string{fqn1}
982982
attributeAndValue, err := s.db.PolicyClient.GetAttributesByValueFqns(s.ctx, &attributes.GetAttributeValuesByFqnsRequest{
983983
Fqns: fqns,
984-
WithValue: &policy.AttributeValueSelector{
985-
WithSubjectMaps: true,
986-
},
987984
})
988985
s.Require().NoError(err)
989986

@@ -1009,9 +1006,6 @@ func (s *AttributeFqnSuite) TestGetAttributesByValueFqns() {
10091006
fqns = []string{fqn1, fqn2}
10101007
attributeAndValue, err = s.db.PolicyClient.GetAttributesByValueFqns(s.ctx, &attributes.GetAttributeValuesByFqnsRequest{
10111008
Fqns: fqns,
1012-
WithValue: &policy.AttributeValueSelector{
1013-
WithSubjectMaps: true,
1014-
},
10151009
})
10161010
s.Require().NoError(err)
10171011
s.Len(attributeAndValue, 2)
@@ -1066,9 +1060,6 @@ func (s *AttributeFqnSuite) TestGetAttributesByValueFqns_NormalizesLowerCase() {
10661060
fqns := []string{upperNsFqn1}
10671061
attributeAndValue, err := s.db.PolicyClient.GetAttributesByValueFqns(s.ctx, &attributes.GetAttributeValuesByFqnsRequest{
10681062
Fqns: fqns,
1069-
WithValue: &policy.AttributeValueSelector{
1070-
WithSubjectMaps: true,
1071-
},
10721063
})
10731064
s.Require().NoError(err)
10741065

@@ -1100,9 +1091,6 @@ func (s *AttributeFqnSuite) TestGetAttributesByValueFqns_NormalizesLowerCase() {
11001091
fqns = []string{upperNsFqn1, upperNsFqn2}
11011092
attributeAndValue, err = s.db.PolicyClient.GetAttributesByValueFqns(s.ctx, &attributes.GetAttributeValuesByFqnsRequest{
11021093
Fqns: fqns,
1103-
WithValue: &policy.AttributeValueSelector{
1104-
WithSubjectMaps: true,
1105-
},
11061094
})
11071095
s.Require().NoError(err)
11081096
s.Len(attributeAndValue, 2)
@@ -1164,9 +1152,6 @@ func (s *AttributeFqnSuite) TestGetAttributesByValueFqns_AllValuesHaveProperFqns
11641152
fqns := []string{fqn1}
11651153
attributeAndValues, err := s.db.PolicyClient.GetAttributesByValueFqns(s.ctx, &attributes.GetAttributeValuesByFqnsRequest{
11661154
Fqns: fqns,
1167-
WithValue: &policy.AttributeValueSelector{
1168-
WithSubjectMaps: true,
1169-
},
11701155
})
11711156
s.Require().NoError(err)
11721157

@@ -1199,9 +1184,6 @@ func (s *AttributeFqnSuite) TestGetAttributesByValueFqns_AllValuesHaveProperFqns
11991184
fqns = []string{fqn1, fqn2, fqn3}
12001185
attributeAndValues, err = s.db.PolicyClient.GetAttributesByValueFqns(s.ctx, &attributes.GetAttributeValuesByFqnsRequest{
12011186
Fqns: fqns,
1202-
WithValue: &policy.AttributeValueSelector{
1203-
WithSubjectMaps: true,
1204-
},
12051187
})
12061188
s.Require().NoError(err)
12071189
s.Len(attributeAndValues, 3)
@@ -1269,9 +1251,6 @@ func (s *AttributeFqnSuite) TestGetAttributesByValueFqns_Fails_WithDeactivatedNa
12691251
// get the attribute by the value fqn for v1
12701252
v, err := s.db.PolicyClient.GetAttributesByValueFqns(s.ctx, &attributes.GetAttributeValuesByFqnsRequest{
12711253
Fqns: []string{fqnBuilder(ns.GetName(), attr.GetName(), v1.GetValue())},
1272-
WithValue: &policy.AttributeValueSelector{
1273-
WithSubjectMaps: true,
1274-
},
12751254
})
12761255
s.Require().Error(err)
12771256
s.Nil(v)
@@ -1280,9 +1259,6 @@ func (s *AttributeFqnSuite) TestGetAttributesByValueFqns_Fails_WithDeactivatedNa
12801259
// get the attribute by the value fqn for v2
12811260
v, err = s.db.PolicyClient.GetAttributesByValueFqns(s.ctx, &attributes.GetAttributeValuesByFqnsRequest{
12821261
Fqns: []string{fqnBuilder(ns.GetName(), attr.GetName(), v2.GetValue())},
1283-
WithValue: &policy.AttributeValueSelector{
1284-
WithSubjectMaps: true,
1285-
},
12861262
})
12871263
s.Require().Error(err)
12881264
s.Nil(v)
@@ -1321,9 +1297,6 @@ func (s *AttributeFqnSuite) TestGetAttributesByValueFqns_Fails_WithDeactivatedAt
13211297
// get the attribute by the value fqn for v1
13221298
v, err := s.db.PolicyClient.GetAttributesByValueFqns(s.ctx, &attributes.GetAttributeValuesByFqnsRequest{
13231299
Fqns: []string{fqnBuilder(ns.GetName(), attr.GetName(), v1.GetValue())},
1324-
WithValue: &policy.AttributeValueSelector{
1325-
WithSubjectMaps: true,
1326-
},
13271300
})
13281301
s.Require().Error(err)
13291302
s.Nil(v)
@@ -1332,9 +1305,6 @@ func (s *AttributeFqnSuite) TestGetAttributesByValueFqns_Fails_WithDeactivatedAt
13321305
// get the attribute by the value fqn for v2
13331306
v, err = s.db.PolicyClient.GetAttributesByValueFqns(s.ctx, &attributes.GetAttributeValuesByFqnsRequest{
13341307
Fqns: []string{fqnBuilder(ns.GetName(), attr.GetName(), v2.GetValue())},
1335-
WithValue: &policy.AttributeValueSelector{
1336-
WithSubjectMaps: true,
1337-
},
13381308
})
13391309
s.Require().Error(err)
13401310
s.Nil(v)
@@ -1370,9 +1340,6 @@ func (s *AttributeFqnSuite) TestGetAttributesByValueFqns_Fails_WithDeactivatedAt
13701340
// get the attribute by the value fqn for v1
13711341
v, err := s.db.PolicyClient.GetAttributesByValueFqns(s.ctx, &attributes.GetAttributeValuesByFqnsRequest{
13721342
Fqns: []string{fqnBuilder(ns.GetName(), attr.GetName(), v1.GetValue())},
1373-
WithValue: &policy.AttributeValueSelector{
1374-
WithSubjectMaps: true,
1375-
},
13761343
})
13771344
s.Require().Error(err)
13781345
s.Nil(v)
@@ -1381,9 +1348,6 @@ func (s *AttributeFqnSuite) TestGetAttributesByValueFqns_Fails_WithDeactivatedAt
13811348
// get the attribute by the value fqn for v2
13821349
v, err = s.db.PolicyClient.GetAttributesByValueFqns(s.ctx, &attributes.GetAttributeValuesByFqnsRequest{
13831350
Fqns: []string{fqnBuilder(ns.GetName(), attr.GetName(), v2.GetValue())},
1384-
WithValue: &policy.AttributeValueSelector{
1385-
WithSubjectMaps: true,
1386-
},
13871351
})
13881352
s.Require().NoError(err)
13891353
s.NotNil(v)
@@ -1423,9 +1387,6 @@ func (s *AttributeFqnSuite) TestGetAttributesByValueFqns_Fails_InactiveDef_Activ
14231387
// get the attribute by the value fqn for v1
14241388
retrieved, err := s.db.PolicyClient.GetAttributesByValueFqns(s.ctx, &attributes.GetAttributeValuesByFqnsRequest{
14251389
Fqns: []string{fqnBuilder(ns.GetName(), attr.GetName(), v1.GetValue())},
1426-
WithValue: &policy.AttributeValueSelector{
1427-
WithSubjectMaps: true,
1428-
},
14291390
})
14301391
s.Require().Error(err)
14311392
s.Nil(retrieved)
@@ -1466,9 +1427,6 @@ func (s *AttributeFqnSuite) TestGetAttributesByValueFqns_Fails_InactiveNsAndDef_
14661427
// get the attribute by the value fqn for v1
14671428
retrieved, err := s.db.PolicyClient.GetAttributesByValueFqns(s.ctx, &attributes.GetAttributeValuesByFqnsRequest{
14681429
Fqns: []string{fqnBuilder(ns.GetName(), attr.GetName(), v1.GetValue())},
1469-
WithValue: &policy.AttributeValueSelector{
1470-
WithSubjectMaps: true,
1471-
},
14721430
})
14731431
s.Require().Error(err)
14741432
s.Nil(retrieved)
@@ -1516,9 +1474,6 @@ func (s *AttributeFqnSuite) TestGetAttributesByValueFqns_Fails_ActiveDef_Inactiv
15161474
// get the attribute by the value fqn for v1
15171475
retrieved, err := s.db.PolicyClient.GetAttributesByValueFqns(s.ctx, &attributes.GetAttributeValuesByFqnsRequest{
15181476
Fqns: []string{fqnBuilder(gotNs.GetName(), attr.GetName(), v1.GetValue())},
1519-
WithValue: &policy.AttributeValueSelector{
1520-
WithSubjectMaps: true,
1521-
},
15221477
})
15231478
s.Require().Error(err)
15241479
s.Nil(retrieved)
@@ -1530,19 +1485,13 @@ func (s *AttributeFqnSuite) TestGetAttributesByValueFqns_Fails_WithNonValueFqns(
15301485
attrFqn := fqnBuilder("example.com", "attr1", "")
15311486
v, err := s.db.PolicyClient.GetAttributesByValueFqns(s.ctx, &attributes.GetAttributeValuesByFqnsRequest{
15321487
Fqns: []string{nsFqn},
1533-
WithValue: &policy.AttributeValueSelector{
1534-
WithSubjectMaps: true,
1535-
},
15361488
})
15371489
s.Require().Error(err)
15381490
s.Nil(v)
15391491
s.Require().ErrorIs(err, db.ErrNotFound)
15401492

15411493
v, err = s.db.PolicyClient.GetAttributesByValueFqns(s.ctx, &attributes.GetAttributeValuesByFqnsRequest{
15421494
Fqns: []string{attrFqn},
1543-
WithValue: &policy.AttributeValueSelector{
1544-
WithSubjectMaps: true,
1545-
},
15461495
})
15471496
s.Require().Error(err)
15481497
s.Nil(v)

service/integration/attribute_values_test.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -472,9 +472,6 @@ func (s *AttributeValuesSuite) Test_UnsafeUpdateAttributeValue() {
472472
original := "https://example.net/attr/attr1/value/created_value"
473473
retrieved, err := s.db.PolicyClient.GetAttributesByValueFqns(s.ctx, &attributes.GetAttributeValuesByFqnsRequest{
474474
Fqns: []string{original},
475-
WithValue: &policy.AttributeValueSelector{
476-
WithSubjectMaps: true,
477-
},
478475
})
479476
s.Require().Error(err)
480477
s.Require().ErrorIs(err, db.ErrNotFound)
@@ -483,9 +480,6 @@ func (s *AttributeValuesSuite) Test_UnsafeUpdateAttributeValue() {
483480
updated := "https://example.net/attr/attr1/value/new_value"
484481
retrieved, err = s.db.PolicyClient.GetAttributesByValueFqns(s.ctx, &attributes.GetAttributeValuesByFqnsRequest{
485482
Fqns: []string{updated},
486-
WithValue: &policy.AttributeValueSelector{
487-
WithSubjectMaps: true,
488-
},
489483
})
490484
s.Require().NoError(err)
491485
s.NotNil(retrieved)

service/integration/attributes_test.go

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -259,9 +259,6 @@ func (s *AttributesSuite) Test_GetAttribute_OrderOfValuesIsPreserved() {
259259
fqns := []string{fmt.Sprintf("https://%s/attr/%s/value/%s", gotAttr.GetNamespace().GetName(), createdAttr.GetName(), gotAttr.GetValues()[0].GetValue())}
260260
req := &attributes.GetAttributeValuesByFqnsRequest{
261261
Fqns: fqns,
262-
WithValue: &policy.AttributeValueSelector{
263-
WithSubjectMaps: true,
264-
},
265262
}
266263
resp, err := s.db.PolicyClient.GetAttributesByValueFqns(s.ctx, req)
267264
s.Require().NoError(err)
@@ -695,9 +692,6 @@ func (s *AttributesSuite) Test_UnsafeUpdateAttribute_WithRuleAndNameAndReorderin
695692

696693
val, err := s.db.PolicyClient.GetAttributesByValueFqns(s.ctx, &attributes.GetAttributeValuesByFqnsRequest{
697694
Fqns: []string{fqn},
698-
WithValue: &policy.AttributeValueSelector{
699-
WithSubjectMaps: true,
700-
},
701695
})
702696
s.Require().NoError(err)
703697
s.NotNil(val)
@@ -787,9 +781,6 @@ func (s *AttributesSuite) Test_UnsafeUpdateAttribute_WithNewName() {
787781
}
788782
req := &attributes.GetAttributeValuesByFqnsRequest{
789783
Fqns: fqns,
790-
WithValue: &policy.AttributeValueSelector{
791-
WithSubjectMaps: true,
792-
},
793784
}
794785
retrieved, err := s.db.PolicyClient.GetAttributesByValueFqns(s.ctx, req)
795786
s.Require().NoError(err)
@@ -934,9 +925,6 @@ func (s *AttributesSuite) Test_UnsafeDeleteAttribute() {
934925
fqns := []string{fmt.Sprintf("https://%s/attr/%s/value/%s", ns.GetName(), name, v.GetValue())}
935926
req := &attributes.GetAttributeValuesByFqnsRequest{
936927
Fqns: fqns,
937-
WithValue: &policy.AttributeValueSelector{
938-
WithSubjectMaps: true,
939-
},
940928
}
941929
retrieved, err := s.db.PolicyClient.GetAttributesByValueFqns(s.ctx, req)
942930
s.Require().Error(err)

service/rttests/rt_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,8 +280,7 @@ func (s *RoundtripSuite) CreateTestData() error {
280280
// get the attribute ids for the values were mapping to the client
281281
var attributeValueIDs []string
282282
fqnResp, err := client.Attributes.GetAttributeValuesByFqns(context.Background(), &attributes.GetAttributeValuesByFqnsRequest{
283-
Fqns: attributesToMap,
284-
WithValue: &policy.AttributeValueSelector{},
283+
Fqns: attributesToMap,
285284
})
286285
if err != nil {
287286
slog.Error("get attribute values by fqn ", slog.String("error", err.Error()))

0 commit comments

Comments
 (0)