Skip to content

Commit 8ffebc0

Browse files
authored
chore!: remove excluded users from ListUsers response (#64)
## Description Removes `excluded_users` from the response of all SDKs as it was removed from OpenFGA with openfga/api#171. This feature was originally a well-intentioned way to communicate any negations that may exist on public-typed wildcard (e.g. `user:*`) as a means of being abundantly clear about what a `user:*` result entails. However, as we discover more possible situations where excluded users could arise, we realize that we were making a premature decision about the API. We fully intend to re-add excluded_users at some point in the future but may or may not be a flattened list as previously implemented. **Please note:** - This is technically a breaking but is acceptable provided that the ListUsers API is still experimental ## References - Related PR in openfga/sdk-generator: openfga/sdk-generator#377 - Related PR in openfga/api: openfga/api#171 ## Review Checklist - [x] I have clicked on ["allow edits by maintainers"](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork). - [ ] I have added documentation for new/changed functionality in this PR or in a PR to [openfga.dev](https://github.com/openfga/openfga.dev) [Provide a link to any relevant PRs in the references section above] - [x] The correct base branch is being used, if not `main` - [ ] I have added tests to validate that the change in functionality is working as expected
2 parents c77aa9d + 8da4653 commit 8ffebc0

File tree

10 files changed

+3
-191
lines changed

10 files changed

+3
-191
lines changed

.openapi-generator/FILES

-2
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ docs/Node.md
5252
docs/Nodes.md
5353
docs/NotFoundErrorCode.md
5454
docs/NullValue.md
55-
docs/ObjectOrUserset.md
5655
docs/ObjectRelation.md
5756
docs/OpenFgaApi.md
5857
docs/PathUnknownErrorMessageResponse.md
@@ -201,7 +200,6 @@ src/OpenFga.Sdk/Model/Node.cs
201200
src/OpenFga.Sdk/Model/Nodes.cs
202201
src/OpenFga.Sdk/Model/NotFoundErrorCode.cs
203202
src/OpenFga.Sdk/Model/NullValue.cs
204-
src/OpenFga.Sdk/Model/ObjectOrUserset.cs
205203
src/OpenFga.Sdk/Model/ObjectRelation.cs
206204
src/OpenFga.Sdk/Model/PathUnknownErrorMessageResponse.cs
207205
src/OpenFga.Sdk/Model/ReadAssertionsResponse.cs

README.md

-2
Original file line numberDiff line numberDiff line change
@@ -746,7 +746,6 @@ const response = await fgaClient.listUsers({
746746
}, options);
747747

748748
// response.users = [{object: {type: "user", id: "81684243-9356-4421-8fbf-a4f8d36aa31b"}}, {userset: { type: "user" }}, ...]
749-
// response.excluded_users = [ {object: {type: "user", id: "4a455e27-d15a-4434-82e0-136f9c2aa4cf"}}, ... ]
750749
```
751750

752751
#### Assertions
@@ -882,7 +881,6 @@ namespace Example {
882881
- [Model.Nodes](docs/Nodes.md)
883882
- [Model.NotFoundErrorCode](docs/NotFoundErrorCode.md)
884883
- [Model.NullValue](docs/NullValue.md)
885-
- [Model.ObjectOrUserset](docs/ObjectOrUserset.md)
886884
- [Model.ObjectRelation](docs/ObjectRelation.md)
887885
- [Model.PathUnknownErrorMessageResponse](docs/PathUnknownErrorMessageResponse.md)
888886
- [Model.ReadAssertionsResponse](docs/ReadAssertionsResponse.md)

docs/ListUsersResponse.md

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
Name | Type | Description | Notes
66
------------ | ------------- | ------------- | -------------
77
**Users** | [**List<User>**](User.md) | |
8-
**ExcludedUsers** | [**List<ObjectOrUserset>**](ObjectOrUserset.md) | |
98

109
[[Back to Model list]](../README.md#models) [[Back to API list]](../README.md#api-endpoints) [[Back to README]](../README.md)
1110

docs/ObjectOrUserset.md

-11
This file was deleted.

docs/OpenFgaApi.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ Name | Type | Description | Notes
581581
582582
[EXPERIMENTAL] List the users matching the provided filter who have a certain relation to a particular type.
583583

584-
The ListUsers API returns a list of all the users of a specific type that have a relation to a given object. This API is available in an experimental capacity and can be enabled with the `- -experimentals enable-list-users` flag. To arrive at a result, the API uses: an authorization model, explicit tuples written through the Write API, contextual tuples present in the request, and implicit tuples that exist by virtue of applying set theory (such as `document:2021-budget#viewer@document:2021-budget#viewer`; the set of users who are viewers of `document:2021-budget` are the set of users who are the viewers of `document:2021-budget`). An `authorization_model_id` may be specified in the body. If it is not specified, the latest authorization model ID will be used. It is strongly recommended to specify authorization model id for better performance. You may also specify `contextual_tuples` that will be treated as regular tuples. Each of these tuples may have an associated `condition`. You may also provide a `context` object that will be used to evaluate the conditioned tuples in the system. It is strongly recommended to provide a value for all the input parameters of all the conditions, to ensure that all tuples be evaluated correctly. The response will contain the related users in an array in the \"users\" field of the response. These results may include specific objects, usersets or type-bound public access. Each of these types of results is encoded in its own type and not represented as a string.In certain cases of negation via the `but not` operator, some results are marked as excluded from the main set of results. These exclusions are returned in the `excluded_users` property and should be handled appropriately at the point of implementation.The number of users in the response array will be limited by the execution timeout specified in the flag OPENFGA_LIST_USERS_DEADLINE and by the upper bound specified in the flag OPENFGA_LIST_USERS_MAX_RESULTS, whichever is hit first. The returned users will not be sorted, and therefore two identical calls may yield different sets of users.
584+
The ListUsers API returns a list of all the users of a specific type that have a relation to a given object. This API is available in an experimental capacity and can be enabled with the `- -experimentals enable-list-users` flag. To arrive at a result, the API uses: an authorization model, explicit tuples written through the Write API, contextual tuples present in the request, and implicit tuples that exist by virtue of applying set theory (such as `document:2021-budget#viewer@document:2021-budget#viewer`; the set of users who are viewers of `document:2021-budget` are the set of users who are the viewers of `document:2021-budget`). An `authorization_model_id` may be specified in the body. If it is not specified, the latest authorization model ID will be used. It is strongly recommended to specify authorization model id for better performance. You may also specify `contextual_tuples` that will be treated as regular tuples. Each of these tuples may have an associated `condition`. You may also provide a `context` object that will be used to evaluate the conditioned tuples in the system. It is strongly recommended to provide a value for all the input parameters of all the conditions, to ensure that all tuples be evaluated correctly. The response will contain the related users in an array in the \"users\" field of the response. These results may include specific objects, usersets or type-bound public access. Each of these types of results is encoded in its own type and not represented as a string.In cases where a type-bound public acces result is returned (e.g. `user:*`), it cannot be inferred that all subjects of that type have a relation to the object; it is possible that negations exist and checks should still be queried on individual subjects to ensure access to that document.The number of users in the response array will be limited by the execution timeout specified in the flag OPENFGA_LIST_USERS_DEADLINE and by the upper bound specified in the flag OPENFGA_LIST_USERS_MAX_RESULTS, whichever is hit first. The returned users will not be sorted, and therefore two identical calls may yield different sets of users.
585585

586586
### Example
587587
```csharp

src/OpenFga.Sdk.Test/Api/OpenFgaApiTests.cs

-1
Original file line numberDiff line numberDiff line change
@@ -1514,7 +1514,6 @@ public async Task ListUsersTest() {
15141514
}
15151515

15161516
},
1517-
ExcludedUsers = new List<ObjectOrUserset>()
15181517
};
15191518
mockHandler.Protected()
15201519
.Setup<Task<HttpResponseMessage>>(

src/OpenFga.Sdk.Test/Client/OpenFgaClientTests.cs

-1
Original file line numberDiff line numberDiff line change
@@ -1464,7 +1464,6 @@ public async Task ListUsersTest() {
14641464
}
14651465

14661466
},
1467-
ExcludedUsers = new List<ObjectOrUserset>()
14681467
};
14691468
mockHandler.Protected()
14701469
.Setup<Task<HttpResponseMessage>>(

src/OpenFga.Sdk/Api/OpenFgaApi.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ public async Task<ListObjectsResponse> ListObjects(string storeId, ListObjectsRe
248248
}
249249

250250
/// <summary>
251-
/// [EXPERIMENTAL] List the users matching the provided filter who have a certain relation to a particular type. The ListUsers API returns a list of all the users of a specific type that have a relation to a given object. This API is available in an experimental capacity and can be enabled with the &#x60;- -experimentals enable-list-users&#x60; flag. To arrive at a result, the API uses: an authorization model, explicit tuples written through the Write API, contextual tuples present in the request, and implicit tuples that exist by virtue of applying set theory (such as &#x60;document:2021-budget#viewer@document:2021-budget#viewer&#x60;; the set of users who are viewers of &#x60;document:2021-budget&#x60; are the set of users who are the viewers of &#x60;document:2021-budget&#x60;). An &#x60;authorization_model_id&#x60; may be specified in the body. If it is not specified, the latest authorization model ID will be used. It is strongly recommended to specify authorization model id for better performance. You may also specify &#x60;contextual_tuples&#x60; that will be treated as regular tuples. Each of these tuples may have an associated &#x60;condition&#x60;. You may also provide a &#x60;context&#x60; object that will be used to evaluate the conditioned tuples in the system. It is strongly recommended to provide a value for all the input parameters of all the conditions, to ensure that all tuples be evaluated correctly. The response will contain the related users in an array in the \&quot;users\&quot; field of the response. These results may include specific objects, usersets or type-bound public access. Each of these types of results is encoded in its own type and not represented as a string.In certain cases of negation via the &#x60;but not&#x60; operator, some results are marked as excluded from the main set of results. These exclusions are returned in the &#x60;excluded_users&#x60; property and should be handled appropriately at the point of implementation.The number of users in the response array will be limited by the execution timeout specified in the flag OPENFGA_LIST_USERS_DEADLINE and by the upper bound specified in the flag OPENFGA_LIST_USERS_MAX_RESULTS, whichever is hit first. The returned users will not be sorted, and therefore two identical calls may yield different sets of users.
251+
/// [EXPERIMENTAL] List the users matching the provided filter who have a certain relation to a particular type. The ListUsers API returns a list of all the users of a specific type that have a relation to a given object. This API is available in an experimental capacity and can be enabled with the &#x60;- -experimentals enable-list-users&#x60; flag. To arrive at a result, the API uses: an authorization model, explicit tuples written through the Write API, contextual tuples present in the request, and implicit tuples that exist by virtue of applying set theory (such as &#x60;document:2021-budget#viewer@document:2021-budget#viewer&#x60;; the set of users who are viewers of &#x60;document:2021-budget&#x60; are the set of users who are the viewers of &#x60;document:2021-budget&#x60;). An &#x60;authorization_model_id&#x60; may be specified in the body. If it is not specified, the latest authorization model ID will be used. It is strongly recommended to specify authorization model id for better performance. You may also specify &#x60;contextual_tuples&#x60; that will be treated as regular tuples. Each of these tuples may have an associated &#x60;condition&#x60;. You may also provide a &#x60;context&#x60; object that will be used to evaluate the conditioned tuples in the system. It is strongly recommended to provide a value for all the input parameters of all the conditions, to ensure that all tuples be evaluated correctly. The response will contain the related users in an array in the \&quot;users\&quot; field of the response. These results may include specific objects, usersets or type-bound public access. Each of these types of results is encoded in its own type and not represented as a string.In cases where a type-bound public acces result is returned (e.g. &#x60;user:*&#x60;), it cannot be inferred that all subjects of that type have a relation to the object; it is possible that negations exist and checks should still be queried on individual subjects to ensure access to that document.The number of users in the response array will be limited by the execution timeout specified in the flag OPENFGA_LIST_USERS_DEADLINE and by the upper bound specified in the flag OPENFGA_LIST_USERS_MAX_RESULTS, whichever is hit first. The returned users will not be sorted, and therefore two identical calls may yield different sets of users.
252252
/// </summary>
253253
/// <exception cref="ApiException">Thrown when fails to make API call</exception>
254254
/// <param name="storeId"></param>

src/OpenFga.Sdk/Model/ListUsersResponse.cs

+1-24
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,12 @@ public ListUsersResponse() {
3434
/// Initializes a new instance of the <see cref="ListUsersResponse" /> class.
3535
/// </summary>
3636
/// <param name="users">users (required).</param>
37-
/// <param name="excludedUsers">excludedUsers (required).</param>
38-
public ListUsersResponse(List<User> users = default(List<User>), List<ObjectOrUserset> excludedUsers = default(List<ObjectOrUserset>)) {
37+
public ListUsersResponse(List<User> users = default(List<User>)) {
3938
// to ensure "users" is required (not null)
4039
if (users == null) {
4140
throw new ArgumentNullException("users is a required property for ListUsersResponse and cannot be null");
4241
}
4342
this.Users = users;
44-
// to ensure "excludedUsers" is required (not null)
45-
if (excludedUsers == null) {
46-
throw new ArgumentNullException("excludedUsers is a required property for ListUsersResponse and cannot be null");
47-
}
48-
this.ExcludedUsers = excludedUsers;
4943
this.AdditionalProperties = new Dictionary<string, object>();
5044
}
5145

@@ -57,14 +51,6 @@ public ListUsersResponse() {
5751
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
5852
public List<User> Users { get; set; }
5953

60-
/// <summary>
61-
/// Gets or Sets ExcludedUsers
62-
/// </summary>
63-
[DataMember(Name = "excluded_users", IsRequired = true, EmitDefaultValue = false)]
64-
[JsonPropertyName("excluded_users")]
65-
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
66-
public List<ObjectOrUserset> ExcludedUsers { get; set; }
67-
6854
/// <summary>
6955
/// Gets or Sets additional properties
7056
/// </summary>
@@ -112,12 +98,6 @@ public bool Equals(ListUsersResponse input) {
11298
this.Users != null &&
11399
input.Users != null &&
114100
this.Users.SequenceEqual(input.Users)
115-
) &&
116-
(
117-
this.ExcludedUsers == input.ExcludedUsers ||
118-
this.ExcludedUsers != null &&
119-
input.ExcludedUsers != null &&
120-
this.ExcludedUsers.SequenceEqual(input.ExcludedUsers)
121101
)
122102
&& (this.AdditionalProperties.Count == input.AdditionalProperties.Count && !this.AdditionalProperties.Except(input.AdditionalProperties).Any());
123103
}
@@ -133,9 +113,6 @@ public override int GetHashCode() {
133113
if (this.Users != null) {
134114
hashCode = (hashCode * 9923) + this.Users.GetHashCode();
135115
}
136-
if (this.ExcludedUsers != null) {
137-
hashCode = (hashCode * 9923) + this.ExcludedUsers.GetHashCode();
138-
}
139116
if (this.AdditionalProperties != null) {
140117
hashCode = (hashCode * 9923) + this.AdditionalProperties.GetHashCode();
141118
}

0 commit comments

Comments
 (0)