Skip to content

Commit da666dd

Browse files
authored
Merge pull request #21613 from opf/bug/70356-there-is-a-recent-change-in-capabilities-api-without-backward-compatibility-
[#70356] add character p for capabilities filter
2 parents 63afc1c + e3925d8 commit da666dd

File tree

6 files changed

+33
-14
lines changed

6 files changed

+33
-14
lines changed

app/models/queries/capabilities/filters/context_filter.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ class Queries::Capabilities::Filters::ContextFilter < Queries::Capabilities::Fil
3535

3636
def split_values
3737
values.map do |value|
38-
if (matches = value.match(/\A([gw])(\d*)\z/))
38+
# @deprecated Remove the context `p` for projects for 17.2
39+
if (matches = value.match(/\A([gwp])(\d*)\z/))
3940
{
4041
context_key: matches[1],
4142
context_id: matches[2]

app/models/queries/capabilities/filters/id_filter.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ class Queries::Capabilities::Filters::IdFilter < Queries::Capabilities::Filters:
3535

3636
def split_values
3737
values.map do |value|
38-
if (matches = value.match(/\A(\w+\/\w+)\/([wg])(\d*)-(\d+)\z/))
38+
# @deprecated Remove the context `p` for projects for 17.2
39+
if (matches = value.match(/\A(\w+\/\w+)\/([gwp])(\d*)-(\d+)\z/))
3940
{
4041
action: matches[1],
4142
context_key: matches[2],

docs/api/apiv3/paths/capabilities.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@ get:
1010
1111
+ principal: Get all capabilities of a principal
1212
13-
+ context: Get all capabilities within a context. Note that for a workspace context the client needs to provide `w{id}`, e.g. `w5` and for the global context a `g`
13+
+ context: Get all capabilities within a context. Note that for a workspace context the client needs to
14+
provide `w{id}`, e.g. `w5` and for the global context a `g`.
15+
16+
+ **Deprecation**: The now deprecated context `p` for project still works, but must eventually be replaced
17+
with the `w` for the workspace context.
1418
example: '[{ "principal": { "operator": "=", "values": ["1"] }" }]'
1519
in: query
1620
name: filters

docs/system-admin-guide/integrations/share-point/site-guide/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,4 @@ To the same URL above but as a POST request
4545

4646
```shell
4747
POST https://graph.microsoft.com/v1.0/sites/<SHAREPOINT HOSTNAME>:/sites/<SITE NAME>:/permissions
48-
49-
```
48+
```

spec/models/queries/capabilities/filters/context_filter_spec.rb

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@
5050
let(:values) { [] }
5151

5252
it "is invalid" do
53-
expect(instance)
54-
.to be_invalid
53+
expect(instance).not_to be_valid
5554
end
5655
end
5756

@@ -62,6 +61,15 @@
6261
end
6362
end
6463

64+
context "with deprecated but still supported values" do
65+
let(:values) { ["p3"] }
66+
67+
it "is valid" do
68+
expect(instance)
69+
.to be_valid
70+
end
71+
end
72+
6573
context "with multiple valid values" do
6674
let(:values) { %w[w3 g] }
6775

@@ -75,8 +83,7 @@
7583
let(:values) { ["a5"] }
7684

7785
it "is invalid" do
78-
expect(instance)
79-
.to be_invalid
86+
expect(instance).not_to be_valid
8087
end
8188
end
8289
end

spec/models/queries/capabilities/filters/id_filter_spec.rb

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@
5050
let(:values) { [] }
5151

5252
it "is invalid" do
53-
expect(instance)
54-
.to be_invalid
53+
expect(instance).not_to be_valid
5554
end
5655
end
5756

@@ -63,7 +62,16 @@
6362
end
6463

6564
context "with multiple valid values" do
66-
let(:values) { ["memberships/create/w3-5", "users/create/g-5"] }
65+
let(:values) { %w[memberships/create/w3-5 users/create/g-5] }
66+
67+
it "is valid" do
68+
expect(instance)
69+
.to be_valid
70+
end
71+
end
72+
73+
context "with deprecated but still supported values" do
74+
let(:values) { ["memberships/create/p3-5"] }
6775

6876
it "is valid" do
6977
expect(instance)
@@ -75,8 +83,7 @@
7583
let(:values) { ["foo/bar/baz-5"] }
7684

7785
it "is invalid" do
78-
expect(instance)
79-
.to be_invalid
86+
expect(instance).not_to be_valid
8087
end
8188
end
8289
end

0 commit comments

Comments
 (0)