Skip to content

Commit e676761

Browse files
authored
Merge pull request #2763 from port-labs/PORTN-3612-contextual-search-open-beta
contextual-search close beta -> GA
2 parents 8d2be81 + 0c099a0 commit e676761

File tree

2 files changed

+23
-16
lines changed

2 files changed

+23
-16
lines changed

docs/build-your-software-catalog/set-catalog-rbac/set-catalog-rbac.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,6 @@ To give `read` permissions to members of the owning team of an entity, change th
141141

142142
<TabItem value="policy" label="Policy">
143143

144-
:::info Closed beta feature
145-
This capability is currently in closed beta, and is not yet generally available.
146-
If you would like to join the beta, please reach out to us.
147-
:::
148-
149144
The `policy` key allows you to give **dynamic** `read` permissions to users, by using [search queries](/search-and-query/#rules).
150145

151146
You can also use [contextual query rules](/search-and-query/#contextual-query-rules) to get the context of the user executing the query.

docs/search-and-query/search-and-query.md

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -567,11 +567,7 @@ Since we don't have context of the logged-in user when using the API, these func
567567

568568
### Contextual query rules
569569

570-
:::info Closed beta feature
571-
This capability is currently in closed beta, and is not yet generally available.
572-
If you would like to join the beta, please reach out to us.
573-
:::
574-
To implement specific and/or complex queries, you can add the context of the triggering user to a query rule, allowing you to access that user's entity and/or owning teams.
570+
To implement specific and/or complex queries, you can add the context of the triggering user to a query rule, allowing you to access that user's properties and/or owning teams.
575571
You can mix contextual query rules freely with other rules as part of your queries.
576572
This can be used in either the `property` or `value` key in a query rule:
577573

@@ -610,37 +606,53 @@ This can be used in either the `property` or `value` key in a query rule:
610606
| `userTeams` | The entities of the owning teams of the user triggering the query |
611607

612608
#### Usage examples
613-
609+
The following rule will result in the entities owned by any one of the user's teams:
614610
```json showLineNumbers
615611
[
616612
...other rules
617-
{ // filter entities with the same department as the user
618-
"property": "department",
613+
{
614+
"property": "$team",
619615
"operator": "containsAny",
616+
"value": {
617+
"context": "userTeams",
618+
"property": "$identifier"
619+
}
620+
}
621+
]
622+
```
623+
The following rule will result in entities with the same department as the user's:
624+
```json showLineNumbers
625+
[
626+
...other rules
627+
{
628+
"property": "department",
629+
"operator": "=",
620630
"value": {
621631
"context": "user",
622632
"property": "department"
623633
}
624634
}
625635
]
626636
```
637+
The following rule asserts that only users with `manager` role will get the resulting entities:
627638
```json showLineNumbers
628639
[
629640
...other rules
630-
{ // only users with `manager` role will get the entities
641+
{
631642
"property": {
632643
"context": "user",
633-
"property": "role"
644+
"property": "port_role"
634645
},
635646
"operator": "=",
636647
"value": "manager"
637648
}
638649
]
639650
```
651+
The following rule asserts that only users in the user's team/s will get the resulting entities:
640652
```json showLineNumbers
641653
[
642654
...other rules
643-
{ // only users in these team will get the entities
655+
{
644656
"property": {
645657
"context": "userTeams",
646658
"property": "$identifier"

0 commit comments

Comments
 (0)