From daafbc9119ddbe57277f55388cc68ed00f281f63 Mon Sep 17 00:00:00 2001 From: Ralf Haferkamp Date: Tue, 3 Jun 2025 14:53:40 +0200 Subject: [PATCH] Bump libre-graph-api for $count support on the permissions endpoints --- go.mod | 2 +- go.sum | 4 +- .../api_drives_get_drives.go | 10 +++++ .../api_drives_permissions.go | 20 ++++++++++ .../libre-graph-api-go/api_drives_root.go | 20 ++++++++++ .../libre-graph-api-go/api_me_drives.go | 10 +++++ ...tion_of_permissions_with_allowed_values.go | 37 +++++++++++++++++++ vendor/modules.txt | 2 +- 8 files changed, 101 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index 9643dd4f22..e0b88c8766 100644 --- a/go.mod +++ b/go.mod @@ -63,7 +63,7 @@ require ( github.com/onsi/ginkgo/v2 v2.23.4 github.com/onsi/gomega v1.37.0 github.com/open-policy-agent/opa v1.5.0 - github.com/opencloud-eu/libre-graph-api-go v1.0.7 + github.com/opencloud-eu/libre-graph-api-go v1.0.8-0.20250603072916-fa601fb14450 github.com/opencloud-eu/reva/v2 v2.33.1-0.20250520152851-d33c49bb52b9 github.com/orcaman/concurrent-map v1.0.0 github.com/pkg/errors v0.9.1 diff --git a/go.sum b/go.sum index 58f3f47c91..5741de7f36 100644 --- a/go.sum +++ b/go.sum @@ -867,8 +867,8 @@ github.com/open-policy-agent/opa v1.5.0 h1:npsQMUZvafCLYHofoNrZ0cSWbvoDpasvWtrHX github.com/open-policy-agent/opa v1.5.0/go.mod h1:bYbS7u+uhTI+cxHQIpzvr5hxX0hV7urWtY+38ZtjMgk= github.com/opencloud-eu/go-micro-plugins/v4/store/nats-js-kv v0.0.0-20250512152754-23325793059a h1:Sakl76blJAaM6NxylVkgSzktjo2dS504iDotEFJsh3M= github.com/opencloud-eu/go-micro-plugins/v4/store/nats-js-kv v0.0.0-20250512152754-23325793059a/go.mod h1:pjcozWijkNPbEtX5SIQaxEW/h8VAVZYTLx+70bmB3LY= -github.com/opencloud-eu/libre-graph-api-go v1.0.7 h1:xP8xlRc6z+gROmQYWohIXn1GtaORQKh8PN7grF3Z790= -github.com/opencloud-eu/libre-graph-api-go v1.0.7/go.mod h1:pzatilMEHZFT3qV7C/X3MqOa3NlRQuYhlRhZTL+hN6Q= +github.com/opencloud-eu/libre-graph-api-go v1.0.8-0.20250603072916-fa601fb14450 h1:QWn9G2f1R/EbyZSbkjtd9jqNq9X0NIphmmD4KYLNZtA= +github.com/opencloud-eu/libre-graph-api-go v1.0.8-0.20250603072916-fa601fb14450/go.mod h1:pzatilMEHZFT3qV7C/X3MqOa3NlRQuYhlRhZTL+hN6Q= github.com/opencloud-eu/reva/v2 v2.33.1-0.20250520152851-d33c49bb52b9 h1:7y8gTqVQSXLyAqeUFesbI58OkgGcS5fmfq2f3e95XOI= github.com/opencloud-eu/reva/v2 v2.33.1-0.20250520152851-d33c49bb52b9/go.mod h1:8S3B+GPFdGMcNL/pkSHI4K2/E0ICvR7qxllE7Ooydm8= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= diff --git a/vendor/github.com/opencloud-eu/libre-graph-api-go/api_drives_get_drives.go b/vendor/github.com/opencloud-eu/libre-graph-api-go/api_drives_get_drives.go index 4375d28d75..156bb36746 100644 --- a/vendor/github.com/opencloud-eu/libre-graph-api-go/api_drives_get_drives.go +++ b/vendor/github.com/opencloud-eu/libre-graph-api-go/api_drives_get_drives.go @@ -152,6 +152,7 @@ type ApiListAllDrivesBetaRequest struct { ApiService *DrivesGetDrivesApiService orderby *string filter *string + expand *string } // The $orderby system query option allows clients to request resources in either ascending order using asc or descending order using desc. @@ -166,6 +167,12 @@ func (r ApiListAllDrivesBetaRequest) Filter(filter string) ApiListAllDrivesBetaR return r } +// Expand related entities +func (r ApiListAllDrivesBetaRequest) Expand(expand string) ApiListAllDrivesBetaRequest { + r.expand = &expand + return r +} + func (r ApiListAllDrivesBetaRequest) Execute() (*CollectionOfDrives1, *http.Response, error) { return r.ApiService.ListAllDrivesBetaExecute(r) } @@ -210,6 +217,9 @@ func (a *DrivesGetDrivesApiService) ListAllDrivesBetaExecute(r ApiListAllDrivesB if r.filter != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "$filter", r.filter, "form", "") } + if r.expand != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "$expand", r.expand, "form", "") + } // to determine the Content-Type header localVarHTTPContentTypes := []string{} diff --git a/vendor/github.com/opencloud-eu/libre-graph-api-go/api_drives_permissions.go b/vendor/github.com/opencloud-eu/libre-graph-api-go/api_drives_permissions.go index 45365986c0..aa17b8e30d 100644 --- a/vendor/github.com/opencloud-eu/libre-graph-api-go/api_drives_permissions.go +++ b/vendor/github.com/opencloud-eu/libre-graph-api-go/api_drives_permissions.go @@ -542,6 +542,8 @@ type ApiListPermissionsRequest struct { itemId string filter *string select_ *[]string + count *bool + top *int32 } // Filter items by property values. By default all permissions are returned and the avalable sharing roles are limited to normal users. To get a list of sharing roles applicable to federated users use the example $select query and combine it with $filter to omit the list of permissions. @@ -556,6 +558,18 @@ func (r ApiListPermissionsRequest) Select_(select_ []string) ApiListPermissionsR return r } +// Include count of items +func (r ApiListPermissionsRequest) Count(count bool) ApiListPermissionsRequest { + r.count = &count + return r +} + +// Show only the first n items +func (r ApiListPermissionsRequest) Top(top int32) ApiListPermissionsRequest { + r.top = &top + return r +} + func (r ApiListPermissionsRequest) Execute() (*CollectionOfPermissionsWithAllowedValues, *http.Response, error) { return r.ApiService.ListPermissionsExecute(r) } @@ -617,6 +631,12 @@ func (a *DrivesPermissionsApiService) ListPermissionsExecute(r ApiListPermission if r.select_ != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "$select", r.select_, "form", "csv") } + if r.count != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "$count", r.count, "form", "") + } + if r.top != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "$top", r.top, "form", "") + } // to determine the Content-Type header localVarHTTPContentTypes := []string{} diff --git a/vendor/github.com/opencloud-eu/libre-graph-api-go/api_drives_root.go b/vendor/github.com/opencloud-eu/libre-graph-api-go/api_drives_root.go index 4eaa3a1b91..9c3ec31beb 100644 --- a/vendor/github.com/opencloud-eu/libre-graph-api-go/api_drives_root.go +++ b/vendor/github.com/opencloud-eu/libre-graph-api-go/api_drives_root.go @@ -755,6 +755,8 @@ type ApiListPermissionsSpaceRootRequest struct { driveId string filter *string select_ *[]string + count *bool + top *int32 } // Filter items by property values. By default all permissions are returned and the avalable sharing roles are limited to normal users. To get a list of sharing roles applicable to federated users use the example $select query and combine it with $filter to omit the list of permissions. @@ -769,6 +771,18 @@ func (r ApiListPermissionsSpaceRootRequest) Select_(select_ []string) ApiListPer return r } +// Include count of items +func (r ApiListPermissionsSpaceRootRequest) Count(count bool) ApiListPermissionsSpaceRootRequest { + r.count = &count + return r +} + +// Show only the first n items +func (r ApiListPermissionsSpaceRootRequest) Top(top int32) ApiListPermissionsSpaceRootRequest { + r.top = &top + return r +} + func (r ApiListPermissionsSpaceRootRequest) Execute() (*CollectionOfPermissionsWithAllowedValues, *http.Response, error) { return r.ApiService.ListPermissionsSpaceRootExecute(r) } @@ -827,6 +841,12 @@ func (a *DrivesRootApiService) ListPermissionsSpaceRootExecute(r ApiListPermissi if r.select_ != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "$select", r.select_, "form", "csv") } + if r.count != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "$count", r.count, "form", "") + } + if r.top != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "$top", r.top, "form", "") + } // to determine the Content-Type header localVarHTTPContentTypes := []string{} diff --git a/vendor/github.com/opencloud-eu/libre-graph-api-go/api_me_drives.go b/vendor/github.com/opencloud-eu/libre-graph-api-go/api_me_drives.go index 4c05152689..5f34db7c8e 100644 --- a/vendor/github.com/opencloud-eu/libre-graph-api-go/api_me_drives.go +++ b/vendor/github.com/opencloud-eu/libre-graph-api-go/api_me_drives.go @@ -152,6 +152,7 @@ type ApiListMyDrivesBetaRequest struct { ApiService *MeDrivesApiService orderby *string filter *string + expand *string } // The $orderby system query option allows clients to request resources in either ascending order using asc or descending order using desc. @@ -166,6 +167,12 @@ func (r ApiListMyDrivesBetaRequest) Filter(filter string) ApiListMyDrivesBetaReq return r } +// Expand related entities +func (r ApiListMyDrivesBetaRequest) Expand(expand string) ApiListMyDrivesBetaRequest { + r.expand = &expand + return r +} + func (r ApiListMyDrivesBetaRequest) Execute() (*CollectionOfDrives, *http.Response, error) { return r.ApiService.ListMyDrivesBetaExecute(r) } @@ -210,6 +217,9 @@ func (a *MeDrivesApiService) ListMyDrivesBetaExecute(r ApiListMyDrivesBetaReques if r.filter != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "$filter", r.filter, "form", "") } + if r.expand != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "$expand", r.expand, "form", "") + } // to determine the Content-Type header localVarHTTPContentTypes := []string{} diff --git a/vendor/github.com/opencloud-eu/libre-graph-api-go/model_collection_of_permissions_with_allowed_values.go b/vendor/github.com/opencloud-eu/libre-graph-api-go/model_collection_of_permissions_with_allowed_values.go index 339c79da1c..2293e7699b 100644 --- a/vendor/github.com/opencloud-eu/libre-graph-api-go/model_collection_of_permissions_with_allowed_values.go +++ b/vendor/github.com/opencloud-eu/libre-graph-api-go/model_collection_of_permissions_with_allowed_values.go @@ -24,6 +24,8 @@ type CollectionOfPermissionsWithAllowedValues struct { // A list of actions that can be chosen for a custom role. Following the CS3 API we can represent the CS3 permissions by mapping them to driveItem properties or relations like this: | [CS3 ResourcePermission](https://cs3org.github.io/cs3apis/#cs3.storage.provider.v1beta1.ResourcePermissions) | action | comment | | ------------------------------------------------------------------------------------------------------------ | ------ | ------- | | `stat` | `libre.graph/driveItem/basic/read` | `basic` because it does not include versions or trashed items | | `get_quota` | `libre.graph/driveItem/quota/read` | read only the `quota` property | | `get_path` | `libre.graph/driveItem/path/read` | read only the `path` property | | `move` | `libre.graph/driveItem/path/update` | allows updating the `path` property of a CS3 resource | | `delete` | `libre.graph/driveItem/standard/delete` | `standard` because deleting is a common update operation | | `list_container` | `libre.graph/driveItem/children/read` | | | `create_container` | `libre.graph/driveItem/children/create` | | | `initiate_file_download` | `libre.graph/driveItem/content/read` | `content` is the property read when initiating a download | | `initiate_file_upload` | `libre.graph/driveItem/upload/create` | `uploads` are a separate property. postprocessing creates the `content` | | `add_grant` | `libre.graph/driveItem/permissions/create` | | | `list_grant` | `libre.graph/driveItem/permissions/read` | | | `update_grant` | `libre.graph/driveItem/permissions/update` | | | `remove_grant` | `libre.graph/driveItem/permissions/delete` | | | `deny_grant` | `libre.graph/driveItem/permissions/deny` | uses a non CRUD action `deny` | | `list_file_versions` | `libre.graph/driveItem/versions/read` | `versions` is a `driveItemVersion` collection | | `restore_file_version` | `libre.graph/driveItem/versions/update` | the only `update` action is restore | | `list_recycle` | `libre.graph/driveItem/deleted/read` | reading a driveItem `deleted` property implies listing | | `restore_recycle_item` | `libre.graph/driveItem/deleted/update` | the only `update` action is restore | | `purge_recycle` | `libre.graph/driveItem/deleted/delete` | allows purging deleted `driveItems` | LibreGraphPermissionsActionsAllowedValues []string `json:"@libre.graph.permissions.actions.allowedValues,omitempty"` Value []Permission `json:"value,omitempty"` + // The total number of permissions available, only present if the `count` query parameter is set to true. + OdataCount *int32 `json:"@odata.count,omitempty"` } // NewCollectionOfPermissionsWithAllowedValues instantiates a new CollectionOfPermissionsWithAllowedValues object @@ -139,6 +141,38 @@ func (o *CollectionOfPermissionsWithAllowedValues) SetValue(v []Permission) { o.Value = v } +// GetOdataCount returns the OdataCount field value if set, zero value otherwise. +func (o *CollectionOfPermissionsWithAllowedValues) GetOdataCount() int32 { + if o == nil || IsNil(o.OdataCount) { + var ret int32 + return ret + } + return *o.OdataCount +} + +// GetOdataCountOk returns a tuple with the OdataCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CollectionOfPermissionsWithAllowedValues) GetOdataCountOk() (*int32, bool) { + if o == nil || IsNil(o.OdataCount) { + return nil, false + } + return o.OdataCount, true +} + +// HasOdataCount returns a boolean if a field has been set. +func (o *CollectionOfPermissionsWithAllowedValues) HasOdataCount() bool { + if o != nil && !IsNil(o.OdataCount) { + return true + } + + return false +} + +// SetOdataCount gets a reference to the given int32 and assigns it to the OdataCount field. +func (o *CollectionOfPermissionsWithAllowedValues) SetOdataCount(v int32) { + o.OdataCount = &v +} + func (o CollectionOfPermissionsWithAllowedValues) MarshalJSON() ([]byte, error) { toSerialize,err := o.ToMap() if err != nil { @@ -158,6 +192,9 @@ func (o CollectionOfPermissionsWithAllowedValues) ToMap() (map[string]interface{ if !IsNil(o.Value) { toSerialize["value"] = o.Value } + if !IsNil(o.OdataCount) { + toSerialize["@odata.count"] = o.OdataCount + } return toSerialize, nil } diff --git a/vendor/modules.txt b/vendor/modules.txt index 405e5039d2..cd1c66f348 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1203,7 +1203,7 @@ github.com/open-policy-agent/opa/v1/types github.com/open-policy-agent/opa/v1/util github.com/open-policy-agent/opa/v1/util/decoding github.com/open-policy-agent/opa/v1/version -# github.com/opencloud-eu/libre-graph-api-go v1.0.7 +# github.com/opencloud-eu/libre-graph-api-go v1.0.8-0.20250603072916-fa601fb14450 ## explicit; go 1.18 github.com/opencloud-eu/libre-graph-api-go # github.com/opencloud-eu/reva/v2 v2.33.1-0.20250520152851-d33c49bb52b9