From c06866a712bb6873bfa102d6720743c8f127b2d1 Mon Sep 17 00:00:00 2001 From: Ewan Harris Date: Fri, 14 Jun 2024 11:17:54 +0100 Subject: [PATCH] chore: remove excluded users from ListUsers response Co-authored-by: Will Vedder --- .openapi-generator/FILES | 2 -- README.md | 2 -- docs/ListUsersResponse.md | 1 - docs/OpenFgaApi.md | 2 +- src/OpenFga.Sdk.Test/Api/OpenFgaApiTests.cs | 1 - .../Client/OpenFgaClientTests.cs | 1 - src/OpenFga.Sdk/Api/OpenFgaApi.cs | 2 +- src/OpenFga.Sdk/Model/ListUsersResponse.cs | 25 +------------------ 8 files changed, 3 insertions(+), 33 deletions(-) diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 2992f98..d08e11c 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -52,7 +52,6 @@ docs/Node.md docs/Nodes.md docs/NotFoundErrorCode.md docs/NullValue.md -docs/ObjectOrUserset.md docs/ObjectRelation.md docs/OpenFgaApi.md docs/PathUnknownErrorMessageResponse.md @@ -201,7 +200,6 @@ src/OpenFga.Sdk/Model/Node.cs src/OpenFga.Sdk/Model/Nodes.cs src/OpenFga.Sdk/Model/NotFoundErrorCode.cs src/OpenFga.Sdk/Model/NullValue.cs -src/OpenFga.Sdk/Model/ObjectOrUserset.cs src/OpenFga.Sdk/Model/ObjectRelation.cs src/OpenFga.Sdk/Model/PathUnknownErrorMessageResponse.cs src/OpenFga.Sdk/Model/ReadAssertionsResponse.cs diff --git a/README.md b/README.md index dd1714e..16ff8ca 100644 --- a/README.md +++ b/README.md @@ -746,7 +746,6 @@ const response = await fgaClient.listUsers({ }, options); // response.users = [{object: {type: "user", id: "81684243-9356-4421-8fbf-a4f8d36aa31b"}}, {userset: { type: "user" }}, ...] -// response.excluded_users = [ {object: {type: "user", id: "4a455e27-d15a-4434-82e0-136f9c2aa4cf"}}, ... ] ``` #### Assertions @@ -882,7 +881,6 @@ namespace Example { - [Model.Nodes](docs/Nodes.md) - [Model.NotFoundErrorCode](docs/NotFoundErrorCode.md) - [Model.NullValue](docs/NullValue.md) - - [Model.ObjectOrUserset](docs/ObjectOrUserset.md) - [Model.ObjectRelation](docs/ObjectRelation.md) - [Model.PathUnknownErrorMessageResponse](docs/PathUnknownErrorMessageResponse.md) - [Model.ReadAssertionsResponse](docs/ReadAssertionsResponse.md) diff --git a/docs/ListUsersResponse.md b/docs/ListUsersResponse.md index cf1e6f1..9dc9baf 100644 --- a/docs/ListUsersResponse.md +++ b/docs/ListUsersResponse.md @@ -5,7 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Users** | [**List<User>**](User.md) | | -**ExcludedUsers** | [**List<ObjectOrUserset>**](ObjectOrUserset.md) | | [[Back to Model list]](../README.md#models) [[Back to API list]](../README.md#api-endpoints) [[Back to README]](../README.md) diff --git a/docs/OpenFgaApi.md b/docs/OpenFgaApi.md index e53fa89..f8ddd75 100644 --- a/docs/OpenFgaApi.md +++ b/docs/OpenFgaApi.md @@ -581,7 +581,7 @@ Name | Type | Description | Notes [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 `- -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. +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. ### Example ```csharp diff --git a/src/OpenFga.Sdk.Test/Api/OpenFgaApiTests.cs b/src/OpenFga.Sdk.Test/Api/OpenFgaApiTests.cs index 3b52c37..a1ca9ff 100644 --- a/src/OpenFga.Sdk.Test/Api/OpenFgaApiTests.cs +++ b/src/OpenFga.Sdk.Test/Api/OpenFgaApiTests.cs @@ -1514,7 +1514,6 @@ public async Task ListUsersTest() { } }, - ExcludedUsers = new List() }; mockHandler.Protected() .Setup>( diff --git a/src/OpenFga.Sdk.Test/Client/OpenFgaClientTests.cs b/src/OpenFga.Sdk.Test/Client/OpenFgaClientTests.cs index 6a8eae1..58be0d7 100644 --- a/src/OpenFga.Sdk.Test/Client/OpenFgaClientTests.cs +++ b/src/OpenFga.Sdk.Test/Client/OpenFgaClientTests.cs @@ -1464,7 +1464,6 @@ public async Task ListUsersTest() { } }, - ExcludedUsers = new List() }; mockHandler.Protected() .Setup>( diff --git a/src/OpenFga.Sdk/Api/OpenFgaApi.cs b/src/OpenFga.Sdk/Api/OpenFgaApi.cs index db98fe3..999759d 100644 --- a/src/OpenFga.Sdk/Api/OpenFgaApi.cs +++ b/src/OpenFga.Sdk/Api/OpenFgaApi.cs @@ -248,7 +248,7 @@ public async Task ListObjects(string storeId, ListObjectsRe } /// - /// [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 `- -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. + /// [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 `- -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. /// /// Thrown when fails to make API call /// diff --git a/src/OpenFga.Sdk/Model/ListUsersResponse.cs b/src/OpenFga.Sdk/Model/ListUsersResponse.cs index e3a75e7..c92d3a8 100644 --- a/src/OpenFga.Sdk/Model/ListUsersResponse.cs +++ b/src/OpenFga.Sdk/Model/ListUsersResponse.cs @@ -34,18 +34,12 @@ public ListUsersResponse() { /// Initializes a new instance of the class. /// /// users (required). - /// excludedUsers (required). - public ListUsersResponse(List users = default(List), List excludedUsers = default(List)) { + public ListUsersResponse(List users = default(List)) { // to ensure "users" is required (not null) if (users == null) { throw new ArgumentNullException("users is a required property for ListUsersResponse and cannot be null"); } this.Users = users; - // to ensure "excludedUsers" is required (not null) - if (excludedUsers == null) { - throw new ArgumentNullException("excludedUsers is a required property for ListUsersResponse and cannot be null"); - } - this.ExcludedUsers = excludedUsers; this.AdditionalProperties = new Dictionary(); } @@ -57,14 +51,6 @@ public ListUsersResponse() { [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public List Users { get; set; } - /// - /// Gets or Sets ExcludedUsers - /// - [DataMember(Name = "excluded_users", IsRequired = true, EmitDefaultValue = false)] - [JsonPropertyName("excluded_users")] - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] - public List ExcludedUsers { get; set; } - /// /// Gets or Sets additional properties /// @@ -112,12 +98,6 @@ public bool Equals(ListUsersResponse input) { this.Users != null && input.Users != null && this.Users.SequenceEqual(input.Users) - ) && - ( - this.ExcludedUsers == input.ExcludedUsers || - this.ExcludedUsers != null && - input.ExcludedUsers != null && - this.ExcludedUsers.SequenceEqual(input.ExcludedUsers) ) && (this.AdditionalProperties.Count == input.AdditionalProperties.Count && !this.AdditionalProperties.Except(input.AdditionalProperties).Any()); } @@ -133,9 +113,6 @@ public override int GetHashCode() { if (this.Users != null) { hashCode = (hashCode * 9923) + this.Users.GetHashCode(); } - if (this.ExcludedUsers != null) { - hashCode = (hashCode * 9923) + this.ExcludedUsers.GetHashCode(); - } if (this.AdditionalProperties != null) { hashCode = (hashCode * 9923) + this.AdditionalProperties.GetHashCode(); }