From 5324bce082c3f0a64fbdefd6d12b91e173572b7b Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Thu, 28 Jul 2022 12:56:08 +0545 Subject: [PATCH 01/16] Bump commit id for core API tests --- .drone.env | 2 +- .../expected-failures-API-on-OCIS-storage.md | 12 ++++-------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/.drone.env b/.drone.env index f9810cd6c77..ec3d6f948d1 100644 --- a/.drone.env +++ b/.drone.env @@ -1,5 +1,5 @@ # The test runner source for API tests -CORE_COMMITID=751c7d92b189cdc30b2a39bc08f31336a0ec2c41 +CORE_COMMITID=8b15ef46e68cf73ea861d4f180ed1f6bff5096a8 CORE_BRANCH=master # The test runner source for UI tests diff --git a/tests/acceptance/expected-failures-API-on-OCIS-storage.md b/tests/acceptance/expected-failures-API-on-OCIS-storage.md index 3f2b56207b8..eef202227cd 100644 --- a/tests/acceptance/expected-failures-API-on-OCIS-storage.md +++ b/tests/acceptance/expected-failures-API-on-OCIS-storage.md @@ -536,16 +536,12 @@ cannot share a folder with create permission - [apiSharePublicLink2/reShareAsPublicLinkToSharesNewDav.feature:181](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiSharePublicLink2/reShareAsPublicLinkToSharesNewDav.feature#L181) - [apiSharePublicLink2/reShareAsPublicLinkToSharesNewDav.feature:182](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiSharePublicLink2/reShareAsPublicLinkToSharesNewDav.feature#L182) -#### [Removing the public link password is broken](https://github.com/owncloud/ocis/issues/4262) - -- [apiSharePublicLink3/updatePublicLinkShare.feature:165](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiSharePublicLink3/updatePublicLinkShare.feature#L165) - #### [Adding public upload to a read only shared folder as a recipient is allowed ](https://github.com/owncloud/ocis/issues/2164) -- [apiSharePublicLink3/updatePublicLinkShare.feature:356](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiSharePublicLink3/updatePublicLinkShare.feature#L356) -- [apiSharePublicLink3/updatePublicLinkShare.feature:357](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiSharePublicLink3/updatePublicLinkShare.feature#L357) -- [apiSharePublicLink3/updatePublicLinkShare.feature:416](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiSharePublicLink3/updatePublicLinkShare.feature#L416) -- [apiSharePublicLink3/updatePublicLinkShare.feature:417](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiSharePublicLink3/updatePublicLinkShare.feature#L417) +- [apiSharePublicLink3/updatePublicLinkShare.feature:364](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiSharePublicLink3/updatePublicLinkShare.feature#L364) +- [apiSharePublicLink3/updatePublicLinkShare.feature:365](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiSharePublicLink3/updatePublicLinkShare.feature#L365) +- [apiSharePublicLink3/updatePublicLinkShare.feature:424](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiSharePublicLink3/updatePublicLinkShare.feature#L424) +- [apiSharePublicLink3/updatePublicLinkShare.feature:425](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiSharePublicLink3/updatePublicLinkShare.feature#L425) #### [Upload-only shares must not overwrite but create a separate file](https://github.com/owncloud/ocis-reva/issues/286) From f8e5b599810284e9c7a6ff74999fd1e5e0811d92 Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Thu, 28 Jul 2022 13:49:00 +0545 Subject: [PATCH 02/16] skip parallel deployment tests --- .drone.star | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.drone.star b/.drone.star index abd62be4380..4ce8ab9d135 100644 --- a/.drone.star +++ b/.drone.star @@ -112,7 +112,7 @@ config = { "suites": [ "apiShareManagement", ], - "skip": False, + "skip": True, "earlyFail": True, "cron": "nightly", }, @@ -120,7 +120,7 @@ config = { "suites": [ "apiWebdavOperations", ], - "skip": False, + "skip": True, "earlyFail": True, "cron": "nightly", }, From 1da7c12ee789faf46ccd7ff33d03576e2d2c2334 Mon Sep 17 00:00:00 2001 From: ownClouders Date: Fri, 29 Jul 2022 00:06:21 +0000 Subject: [PATCH 03/16] [tx] updated from transifex --- services/settings/l10n/translations.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/settings/l10n/translations.json b/services/settings/l10n/translations.json index d50639cab82..c5d9b3c7ade 100644 --- a/services/settings/l10n/translations.json +++ b/services/settings/l10n/translations.json @@ -1 +1 @@ -{"de":{"{{ bundle.displayName }}":"{{ bundle.displayName }}","Account":"Konto","Cancel":"Abbrechen","Hello":"Hallo","Language":"Sprache","Loading personal settings":"Lade persönliche Einstellungen","Loading personal settings...":"Lade persönliche Einstellungen...","msg":"msg","No settings available":"Keine Einstellungen verfügbar","Save":"Speichern","Settings":"Einstellungen","Settings type not implemented: %{type}":"Einstellungs-Typ nicht verfügbar: %{type}"},"de_DE":{"{{ bundle.displayName }}":"{{ bundle.displayName }}","Account":"Benutzerkonto","Cancel":"Abbrechen","Hello":"Hallo","Language":"Sprache","Loading personal settings":"Lade persönliche Einstellungen","Loading personal settings...":"Lade persönliche Einstellungen...","msg":"msg","No settings available":"Keine Einstellungen verfügbar","Save":"Speichern","Settings":"Einstellungen","Settings type not implemented: %{type}":"Einstellungs-Typ nicht verfügbar: %{type}"},"el":{"{{ bundle.displayName }}":"{{ bundle.displayName }}","Account":"Λογαριασμός","Cancel":"Aκύρωση","Hello":"Γεια σας","Language":"Γλώσσα","Loading personal settings":"Γίνεται φόρτωση προσωπικών ρυθμίσεων","Loading personal settings...":"Γίνεται φόρτωση προσωπικών ρυθμίσεων...","msg":"μνμ","No settings available":"Δεν υπάρχουν διαθέσιμες ρυθμίσεις","Save":"Αποθήκευση","Settings":"Ρυθμίσεις","Settings type not implemented: %{type}":"Ο τύπος ρυθμίσεων δεν εφαρμόστηκε: %{type}"},"es":{"{{ bundle.displayName }}":"{{bundle.displayName}}","Account":"Cuenta","Cancel":"Cancelar","Hello":"Hola","Language":"Idioma","Loading personal settings":"Cargando configuraciones personales","Loading personal settings...":"Cargando configuración personal ...","msg":"msg","No settings available":"No hay configuraciones disponibles","Save":"Guardar","Settings":"Configuración","Settings type not implemented: %{type}":"Tipo de configuración no implementado: %{type}"},"pl":{"{{ bundle.displayName }}":"{{ bundle.displayName }}","Account":"Konto","Cancel":"Anuluj","Hello":"Witaj","Language":"Język","Loading personal settings":"Ładowanie ustawień osobistych","Loading personal settings...":"Ładowanie ustawień osobistych...","msg":"wiad","No settings available":"Brak dostępnych ustawień","Save":"Zapisz","Settings":"Ustawienia","Settings type not implemented: %{type}":"Typ ustawień nie jest wdrożony: %{type}"},"pt_BR":{"{{ bundle.displayName }}":"{{ bundle.displayName }}","Account":"Conta","Cancel":"Cancelar","Hello":"Olá","Language":"Idioma","Loading personal settings":"Carregando configurações pessoais ","Loading personal settings...":"Carregando configurações pessoais... ","msg":"msg","No settings available":"Nenhuma configuração disponível ","Save":"Salvar","Settings":"Configurações","Settings type not implemented: %{type}":"Tipo de configuração não implementado: %{type}"},"ru":{"{{ bundle.displayName }}":"{{ bundle.displayName }}","Account":"Уч.запись","Cancel":"Отмена","Hello":"Здравствуйте","Language":"Язык","Loading personal settings":"Загрузка личных настроек","Loading personal settings...":"Загрузка личных настроек…","msg":"сообщ","No settings available":"Нет доступных настроек","Save":"Сохранить","Settings":"Настройки","Settings type not implemented: %{type}":"Тип настроек не реализован: %{type}"},"sq":{"{{ bundle.displayName }}":"{{ bundle.displayName }}","Account":"Llogari","Cancel":"Anuloje","Hello":"Tungjatjeta","Language":"Gjuhë","Loading personal settings":"Ngarkim rregullimesh personale","Loading personal settings...":"Po ngarkohen rregullime personale…","msg":"msz","No settings available":"S’ka rregullime","Save":"Ruaje","Settings":"Rregullime","Settings type not implemented: %{type}":"Lloj rregullimi i pasendërtuar: %{type}"},"th_TH":{"{{ bundle.displayName }}":"{{ bundle.displayName }}","Account":"บัญชี","Cancel":"ยกเลิก","Hello":"สวัสดี","Language":"ภาษา","Loading personal settings":"กำลังโหลดการตั้งค่าส่วนบุคคล","Loading personal settings...":"กำลังโหลดการตั้งค่าส่วนบุคคล...","msg":"msg","No settings available":"ไม่มีการตั้งค่า","Save":"บันทึก","Settings":"ตั้งค่า","Settings type not implemented: %{type}":"ประเภทการตั้งค่าที่ยังไม่ถูกดำเนินการ: %{type}"},"zh_CN":{"{{ bundle.displayName }}":"{{ bundle.displayName }}","Account":"账户","Cancel":"取消","Hello":"你好","Language":"语言","Loading personal settings":"加载个人设置","Loading personal settings...":"加载个人设置...","msg":"msg","No settings available":"没有可用的设置","Save":"保存","Settings":"设置","Settings type not implemented: %{type}":"设置类型未实现:%{type}"}} \ No newline at end of file +{"de":{"{{ bundle.displayName }}":"{{ bundle.displayName }}","Account":"Konto","Cancel":"Abbrechen","Hello":"Hallo","Language":"Sprache","Loading personal settings":"Lade persönliche Einstellungen","Loading personal settings...":"Lade persönliche Einstellungen...","msg":"msg","No settings available":"Keine Einstellungen verfügbar","Save":"Speichern","Settings":"Einstellungen","Settings type not implemented: %{type}":"Einstellungs-Typ nicht verfügbar: %{type}"},"de_DE":{"{{ bundle.displayName }}":"{{ bundle.displayName }}","Account":"Benutzerkonto","Cancel":"Abbrechen","Hello":"Hallo","Language":"Sprache","Loading personal settings":"Lade persönliche Einstellungen","Loading personal settings...":"Lade persönliche Einstellungen...","msg":"msg","No settings available":"Keine Einstellungen verfügbar","Save":"Speichern","Settings":"Einstellungen","Settings type not implemented: %{type}":"Einstellungs-Typ nicht verfügbar: %{type}"},"el":{"{{ bundle.displayName }}":"{{ bundle.displayName }}","Account":"Λογαριασμός","Cancel":"Aκύρωση","Hello":"Γεια σας","Language":"Γλώσσα","Loading personal settings":"Γίνεται φόρτωση προσωπικών ρυθμίσεων","Loading personal settings...":"Γίνεται φόρτωση προσωπικών ρυθμίσεων...","msg":"μνμ","No settings available":"Δεν υπάρχουν διαθέσιμες ρυθμίσεις","Save":"Αποθήκευση","Settings":"Ρυθμίσεις","Settings type not implemented: %{type}":"Ο τύπος ρυθμίσεων δεν εφαρμόστηκε: %{type}"},"es":{"{{ bundle.displayName }}":"{{bundle.displayName}}","Account":"Cuenta","Cancel":"Cancelar","Hello":"Hola","Language":"Idioma","Loading personal settings":"Cargando configuraciones personales","Loading personal settings...":"Cargando configuración personal ...","msg":"msg","No settings available":"No hay configuraciones disponibles","Save":"Guardar","Settings":"Configuración","Settings type not implemented: %{type}":"Tipo de configuración no implementado: %{type}"},"pl":{"{{ bundle.displayName }}":"{{ bundle.displayName }}","Account":"Konto","Cancel":"Anuluj","Hello":"Witaj","Language":"Język","Loading personal settings":"Ładowanie ustawień osobistych","Loading personal settings...":"Ładowanie ustawień osobistych...","msg":"wiad","No settings available":"Brak dostępnych ustawień","Save":"Zapisz","Settings":"Ustawienia","Settings type not implemented: %{type}":"Typ ustawień nie jest wdrożony: %{type}"},"pt_BR":{"{{ bundle.displayName }}":"{{ bundle.displayName }}","Account":"Conta","Cancel":"Cancelar","Hello":"Olá","Language":"Idioma","Loading personal settings":"Carregando configurações pessoais ","Loading personal settings...":"Carregando configurações pessoais... ","msg":"msg","No settings available":"Nenhuma configuração disponível ","Save":"Salvar","Settings":"Configurações","Settings type not implemented: %{type}":"Tipo de configuração não implementado: %{type}"},"ru":{"{{ bundle.displayName }}":"{{ bundle.displayName }}","Account":"Уч.запись","Cancel":"Отмена","Hello":"Здравствуйте","Language":"Язык","Loading personal settings":"Загрузка личных настроек","Loading personal settings...":"Загрузка личных настроек…","msg":"сообщ","No settings available":"Нет доступных настроек","Save":"Сохранить","Settings":"Настройки","Settings type not implemented: %{type}":"Тип настроек не реализован: %{type}"},"sq":{"{{ bundle.displayName }}":"{{ bundle.displayName }}","Account":"Llogari","Cancel":"Anuloje","Hello":"Tungjatjeta","Language":"Gjuhë","Loading personal settings":"Ngarkim rregullimesh personale","Loading personal settings...":"Po ngarkohen rregullime personale…","msg":"msz","No settings available":"S’ka rregullime","Save":"Ruaje","Settings":"Rregullime","Settings type not implemented: %{type}":"Lloj rregullimi i pasendërtuar: %{type}"},"th_TH":{"{{ bundle.displayName }}":"{{ bundle.displayName }}","Account":"บัญชี","Cancel":"ยกเลิก","Hello":"สวัสดี","Language":"ภาษา","Loading personal settings":"กำลังโหลดการตั้งค่าส่วนบุคคล","Loading personal settings...":"กำลังโหลดการตั้งค่าส่วนบุคคล...","msg":"msg","No settings available":"ไม่มีการตั้งค่า","Save":"บันทึก","Settings":"ตั้งค่า","Settings type not implemented: %{type}":"ประเภทการตั้งค่าที่ยังไม่ถูกดำเนินการ: %{type}"},"tr":{"{{ bundle.displayName }}":"{{ bundle.displayName }}","Account":"Hesap","Cancel":"İptal","Hello":"Merhaba","Language":"Dil","Loading personal settings":"Kişisel ayarlar yükleniyor","Loading personal settings...":"Kişisel ayarlar yükleniyor...","msg":"msj","No settings available":"Kullanılabilir ayar yok.","Save":"Kaydet","Settings":"Ayarlar","Settings type not implemented: %{type}":"Ayar türü uygulanmadı: %{type}"},"zh_CN":{"{{ bundle.displayName }}":"{{ bundle.displayName }}","Account":"账户","Cancel":"取消","Hello":"你好","Language":"语言","Loading personal settings":"加载个人设置","Loading personal settings...":"加载个人设置...","msg":"msg","No settings available":"没有可用的设置","Save":"保存","Settings":"设置","Settings type not implemented: %{type}":"设置类型未实现:%{type}"}} \ No newline at end of file From 04909d63dac4c668f572e854cb73742abacfc8fb Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Fri, 29 Jul 2022 10:28:37 +0545 Subject: [PATCH 04/16] Enhance getSpaceByNameManager test code --- tests/acceptance/features/bootstrap/SpacesContext.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/acceptance/features/bootstrap/SpacesContext.php b/tests/acceptance/features/bootstrap/SpacesContext.php index 1dd8cb2e1fc..be50ff8677d 100644 --- a/tests/acceptance/features/bootstrap/SpacesContext.php +++ b/tests/acceptance/features/bootstrap/SpacesContext.php @@ -267,8 +267,9 @@ class SpacesContext implements Context { $this->theUserListsAllAvailableSpacesUsingTheGraphApi($user); $spaces = $this->getAvailableSpaces(); - Assert::assertIsArray($spaces[$spaceName], "Space with name $spaceName for user $user not found"); - Assert::assertNotEmpty($spaces[$spaceName]["root"]["webDavUrl"], "WebDavUrl for space with name $spaceName for user $user not found"); + Assert::assertArrayHasKey($spaceName, $spaces, "Space with name '$spaceName' for user '$user' not found"); + Assert::assertIsArray($spaces[$spaceName], "Data for space with name '$spaceName' for user '$user' not found"); + Assert::assertNotEmpty($spaces[$spaceName]["root"]["webDavUrl"], "WebDavUrl for space with name '$spaceName' for user '$user' not found"); return $spaces[$spaceName]; } From 04ecce9e39c95927ab4cf4bd6059c24565d35d69 Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Fri, 29 Jul 2022 14:15:43 +0545 Subject: [PATCH 05/16] Fix clean-files target in tests/acceptance/docker/Makefile --- tests/acceptance/docker/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/acceptance/docker/Makefile b/tests/acceptance/docker/Makefile index e6b9ae25d17..7d23d9913e0 100644 --- a/tests/acceptance/docker/Makefile +++ b/tests/acceptance/docker/Makefile @@ -219,6 +219,7 @@ clean-docker-volumes: ## clean docker volumes created during acceptance tests docker-compose down --remove-orphans -v .PHONY: clean-files +clean-files: @$(MAKE) --no-print-directory -C ../. clean-tests .PHONY: clean From 1e21e230566d31d01ba7740b7057761ae0108cd9 Mon Sep 17 00:00:00 2001 From: Christian Richter Date: Wed, 29 Jun 2022 16:00:00 +0200 Subject: [PATCH 06/16] add drives output Signed-off-by: Christian Richter --- services/graph/pkg/identity/cs3.go | 1 - services/graph/pkg/service/v0/drives.go | 11 +++++++++ services/graph/pkg/service/v0/users.go | 31 +++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 1 deletion(-) diff --git a/services/graph/pkg/identity/cs3.go b/services/graph/pkg/identity/cs3.go index 039edbfb869..a42bbdbc43c 100644 --- a/services/graph/pkg/identity/cs3.go +++ b/services/graph/pkg/identity/cs3.go @@ -203,7 +203,6 @@ func createGroupModelFromCS3(g *cs3group.Group) *libregraph.Group { OnPremisesDomainName: &g.Id.Idp, OnPremisesSamAccountName: &g.GroupName, DisplayName: &g.DisplayName, - Mail: &g.Mail, // TODO when to fetch and expand memberof, usernames or ids? } } diff --git a/services/graph/pkg/service/v0/drives.go b/services/graph/pkg/service/v0/drives.go index 9ec9984dbf8..fd8c2570934 100644 --- a/services/graph/pkg/service/v0/drives.go +++ b/services/graph/pkg/service/v0/drives.go @@ -733,6 +733,17 @@ func listStorageSpacesIDFilter(id string) *storageprovider.ListStorageSpacesRequ } } +func listStorageSpacesUserFilter(id string) *storageprovider.ListStorageSpacesRequest_Filter { + return &storageprovider.ListStorageSpacesRequest_Filter{ + Type: storageprovider.ListStorageSpacesRequest_Filter_TYPE_USER, + Term: &storageprovider.ListStorageSpacesRequest_Filter_User{ + User: &userv1beta1.UserId{ + OpaqueId: id, + }, + }, + } +} + func listStorageSpacesTypeFilter(spaceType string) *storageprovider.ListStorageSpacesRequest_Filter { return &storageprovider.ListStorageSpacesRequest_Filter{ Type: storageprovider.ListStorageSpacesRequest_Filter_TYPE_SPACE_TYPE, diff --git a/services/graph/pkg/service/v0/users.go b/services/graph/pkg/service/v0/users.go index 96f8e9cc752..d5b845bef80 100644 --- a/services/graph/pkg/service/v0/users.go +++ b/services/graph/pkg/service/v0/users.go @@ -11,6 +11,7 @@ import ( "strings" "github.com/CiscoM31/godata" + storageprovider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1" ctxpkg "github.com/cs3org/reva/v2/pkg/ctx" revactx "github.com/cs3org/reva/v2/pkg/ctx" "github.com/cs3org/reva/v2/pkg/events" @@ -21,6 +22,7 @@ import ( "github.com/owncloud/ocis/v2/services/graph/pkg/identity" "github.com/owncloud/ocis/v2/services/graph/pkg/service/v0/errorcode" settingssvc "github.com/owncloud/ocis/v2/services/settings/pkg/service/v0" + "golang.org/x/exp/slices" ) // GetMe implements the Service interface. @@ -171,6 +173,35 @@ func (g Graph) GetUser(w http.ResponseWriter, r *http.Request) { errorcode.GeneralException.Render(w, r, http.StatusInternalServerError, err.Error()) } } + sel := strings.Split(r.URL.Query().Get("$select"), ",") + exp := strings.Split(r.URL.Query().Get("$expand"), ",") + if slices.Contains(sel, "drive") || slices.Contains(sel, "drives") || slices.Contains(exp, "drive") || slices.Contains(exp, "drives") { + wdu, err := url.Parse(g.config.Spaces.WebDavBase + g.config.Spaces.WebDavPath) + // TODO: filter this request for the user + f := listStorageSpacesUserFilter(user.GetId()) + lspr, err := g.gatewayClient.ListStorageSpaces(r.Context(), &storageprovider.ListStorageSpacesRequest{ + Opaque: nil, + Filters: []*storageprovider.ListStorageSpacesRequest_Filter{f}, + }) + if err != nil { + g.logger.Err(err).Interface("query", r.URL.Query()).Msg("error getting storages") + } + drives := []libregraph.Drive{} + for _, sp := range lspr.GetStorageSpaces() { + d, err := g.cs3StorageSpaceToDrive(r.Context(), wdu, sp) + if err != nil { + g.logger.Err(err).Interface("query", r.URL.Query()).Msg("error converting space to drive") + } + if slices.Contains(sel, "drive") || slices.Contains(exp, "drive") { + if *d.DriveType == "personal" { + drives = append(drives, *d) + } + } else { + drives = append(drives, *d) + } + } + user.Drives = drives + } render.Status(r, http.StatusOK) render.JSON(w, r, user) From a030459c70fed8bf1ce28083e8d19dafef44c6db Mon Sep 17 00:00:00 2001 From: Christian Richter Date: Mon, 18 Jul 2022 13:26:10 +0200 Subject: [PATCH 07/16] incorporate requested changes Signed-off-by: Christian Richter --- services/graph/pkg/service/v0/users.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/services/graph/pkg/service/v0/users.go b/services/graph/pkg/service/v0/users.go index d5b845bef80..8fa16c17337 100644 --- a/services/graph/pkg/service/v0/users.go +++ b/services/graph/pkg/service/v0/users.go @@ -11,10 +11,12 @@ import ( "strings" "github.com/CiscoM31/godata" + cs3rpc "github.com/cs3org/go-cs3apis/cs3/rpc/v1beta1" storageprovider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1" ctxpkg "github.com/cs3org/reva/v2/pkg/ctx" revactx "github.com/cs3org/reva/v2/pkg/ctx" "github.com/cs3org/reva/v2/pkg/events" + "github.com/cs3org/reva/v2/pkg/rgrpc/status" "github.com/go-chi/chi/v5" "github.com/go-chi/render" libregraph "github.com/owncloud/libre-graph-api-go" @@ -177,7 +179,6 @@ func (g Graph) GetUser(w http.ResponseWriter, r *http.Request) { exp := strings.Split(r.URL.Query().Get("$expand"), ",") if slices.Contains(sel, "drive") || slices.Contains(sel, "drives") || slices.Contains(exp, "drive") || slices.Contains(exp, "drives") { wdu, err := url.Parse(g.config.Spaces.WebDavBase + g.config.Spaces.WebDavPath) - // TODO: filter this request for the user f := listStorageSpacesUserFilter(user.GetId()) lspr, err := g.gatewayClient.ListStorageSpaces(r.Context(), &storageprovider.ListStorageSpacesRequest{ Opaque: nil, @@ -185,6 +186,15 @@ func (g Graph) GetUser(w http.ResponseWriter, r *http.Request) { }) if err != nil { g.logger.Err(err).Interface("query", r.URL.Query()).Msg("error getting storages") + render.Status(r, http.StatusInternalServerError) + render.JSON(w, r, user) + return + } + if lspr.Status.Code != cs3rpc.Code_CODE_OK { + // in case of NOT_OK, we can just return the user object with empty drives + render.Status(r, status.HTTPStatusFromCode(http.StatusOK)) + render.JSON(w, r, user) + return } drives := []libregraph.Drive{} for _, sp := range lspr.GetStorageSpaces() { From 7d844960a14c3f69620f02822d51411eb42c929c Mon Sep 17 00:00:00 2001 From: Christian Richter Date: Tue, 19 Jul 2022 12:01:21 +0200 Subject: [PATCH 08/16] add changelog Signed-off-by: Christian Richter --- changelog/unreleased/add-drives-endpoint-and-userfilter.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 changelog/unreleased/add-drives-endpoint-and-userfilter.md diff --git a/changelog/unreleased/add-drives-endpoint-and-userfilter.md b/changelog/unreleased/add-drives-endpoint-and-userfilter.md new file mode 100644 index 00000000000..98035fd41f7 --- /dev/null +++ b/changelog/unreleased/add-drives-endpoint-and-userfilter.md @@ -0,0 +1,7 @@ +Enhancement: add drives field to users endpoint + +We have added `$expand=drives` to the `/users/{id}/` endpoint +using the user filter implemented in reva. + +https://github.com/owncloud/ocis/pull/4072 +https://github.com/cs3org/reva/pull/3046 \ No newline at end of file From 3da88ef6088e691146df705f96ccd8cd612e6e50 Mon Sep 17 00:00:00 2001 From: Christian Richter Date: Wed, 27 Jul 2022 15:22:03 +0200 Subject: [PATCH 09/16] use reva/v2@edge Signed-off-by: Christian Richter --- changelog/unreleased/update-reva-beta.6.md | 1 + go.mod | 2 +- go.sum | 6 ++++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/changelog/unreleased/update-reva-beta.6.md b/changelog/unreleased/update-reva-beta.6.md index 2bcd4071dd2..98b18edba57 100644 --- a/changelog/unreleased/update-reva-beta.6.md +++ b/changelog/unreleased/update-reva-beta.6.md @@ -4,3 +4,4 @@ Updated reva to version x.x.x. This update includes: * TODO: https://github.com/owncloud/ocis/pull/4272 +https://github.com/cs3org/reva/pull/3096 \ No newline at end of file diff --git a/go.mod b/go.mod index b2ca0c18fbe..d5282be1fca 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,7 @@ require ( github.com/blevesearch/bleve_index_api v1.0.2 github.com/coreos/go-oidc/v3 v3.2.0 github.com/cs3org/go-cs3apis v0.0.0-20220711084433-8f71d4e812a3 - github.com/cs3org/reva/v2 v2.7.3-0.20220725090601-c11d9547a9ed + github.com/cs3org/reva/v2 v2.7.3-0.20220729123357-51c6d5d0c041 github.com/disintegration/imaging v1.6.2 github.com/ggwhite/go-masker v1.0.9 github.com/go-chi/chi/v5 v5.0.7 diff --git a/go.sum b/go.sum index e09cf638cdf..92811f459ca 100644 --- a/go.sum +++ b/go.sum @@ -285,8 +285,10 @@ github.com/crewjam/saml v0.4.6 h1:XCUFPkQSJLvzyl4cW9OvpWUbRf0gE7VUpU8ZnilbeM4= github.com/crewjam/saml v0.4.6/go.mod h1:ZBOXnNPFzB3CgOkRm7Nd6IVdkG+l/wF+0ZXLqD96t1A= github.com/cs3org/go-cs3apis v0.0.0-20220711084433-8f71d4e812a3 h1:QSQ2DGKPMChB4vHSs1Os9TnOJl21BrzKX9D5EtQfDog= github.com/cs3org/go-cs3apis v0.0.0-20220711084433-8f71d4e812a3/go.mod h1:UXha4TguuB52H14EMoSsCqDj7k8a/t7g4gVP+bgY5LY= -github.com/cs3org/reva/v2 v2.7.3-0.20220725090601-c11d9547a9ed h1:ATWmYtf21gDXK1lcrxLHZPYLw5t3SzdRxf5DmOxpXkE= -github.com/cs3org/reva/v2 v2.7.3-0.20220725090601-c11d9547a9ed/go.mod h1:9FpnWdVFw7ld3iOiuzHHQeCyVH/Ct9h03PZV9ZRplPM= +github.com/cs3org/reva/v2 v2.7.3-0.20220727111802-29f9f53c2f19 h1:Pu08T+aUlr/MTxBlqdoJx/i8ujtg5zSxGkulBbp89J8= +github.com/cs3org/reva/v2 v2.7.3-0.20220727111802-29f9f53c2f19/go.mod h1:9FpnWdVFw7ld3iOiuzHHQeCyVH/Ct9h03PZV9ZRplPM= +github.com/cs3org/reva/v2 v2.7.3-0.20220729123357-51c6d5d0c041 h1:ObeKsyxTeYJoPyKqjz6qBjd9Q4kDjT1Fht3lGzOOfdc= +github.com/cs3org/reva/v2 v2.7.3-0.20220729123357-51c6d5d0c041/go.mod h1:9FpnWdVFw7ld3iOiuzHHQeCyVH/Ct9h03PZV9ZRplPM= github.com/cubewise-code/go-mime v0.0.0-20200519001935-8c5762b177d8 h1:Z9lwXumT5ACSmJ7WGnFl+OMLLjpz5uR2fyz7dC255FI= github.com/cubewise-code/go-mime v0.0.0-20200519001935-8c5762b177d8/go.mod h1:4abs/jPXcmJzYoYGF91JF9Uq9s/KL5n1jvFDix8KcqY= github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4= From 32123487277dcd0345552da861c90f6b9700d523 Mon Sep 17 00:00:00 2001 From: Christian Richter Date: Mon, 1 Aug 2022 10:12:30 +0200 Subject: [PATCH 10/16] add expected failures Signed-off-by: Christian Richter --- .../acceptance/expected-failures-localAPI-on-OCIS-storage.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md b/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md index 2fe0ae8d122..0e74c2fda27 100644 --- a/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md +++ b/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md @@ -45,3 +45,8 @@ The expected failures in this file are from features in the owncloud/ocis repo. ### [A space manager cannot see the public links of another manager](https://github.com/owncloud/ocis/issues/4260) - [apiSpaces/editPublicLinkOfSpace.feature:67](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/editPublicLinkOfSpace.feature#L67) + +### [User without space manager role cannot restore space](https://github.com/owncloud/ocis/issues/4027) + - [apiSpaces/restoreSpaces.feature:63](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/restoreSpaces.feature#L63) + - [apiSpaces/restoreSpaces.feature:64](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/restoreSpaces.feature#L64) + From 19c9125fdf7e55b3299924cb9b2c83d8e0ae04cd Mon Sep 17 00:00:00 2001 From: Christian Richter <1058116+dragonchaser@users.noreply.github.com> Date: Mon, 1 Aug 2022 10:10:00 +0000 Subject: [PATCH 11/16] Automated changelog update [skip ci] --- CHANGELOG.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 623214e1bf1..9776ad4ca83 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ The following sections list the changes for unreleased. ## Summary * Bugfix - Substring search for sharees: [#547](https://github.com/owncloud/ocis/issues/547) +* Enhancement - Add drives field to users endpoint: [#4072](https://github.com/owncloud/ocis/pull/4072) * Enhancement - Improve error log for "could not get user by claim" error: [#4227](https://github.com/owncloud/ocis/pull/4227) * Enhancement - Allow providing list of services NOT to start: [#4254](https://github.com/owncloud/ocis/pull/4254) * Enhancement - Introduce insecure flag for smtp email notifications: [#4279](https://github.com/owncloud/ocis/pull/4279) @@ -29,6 +30,14 @@ The following sections list the changes for unreleased. https://github.com/owncloud/ocis/issues/547 +* Enhancement - Add drives field to users endpoint: [#4072](https://github.com/owncloud/ocis/pull/4072) + + We have added `$expand=drives` to the `/users/{id}/` endpoint using the user filter + implemented in reva. + + https://github.com/owncloud/ocis/pull/4072 + https://github.com/cs3org/reva/pull/3046 + * Enhancement - Improve error log for "could not get user by claim" error: [#4227](https://github.com/owncloud/ocis/pull/4227) We've improved the error log for "could not get user by claim" error where previously only the @@ -56,6 +65,7 @@ The following sections list the changes for unreleased. Updated reva to version x.x.x. This update includes: https://github.com/owncloud/ocis/pull/4272 + https://github.com/cs3org/reva/pull/3096 * todo: # Changelog for [2.0.0-beta.5] (2022-07-19) From cce04f94ffa08adcf9cc269e36dec6e43d8971a3 Mon Sep 17 00:00:00 2001 From: Michael Barz Date: Wed, 20 Jul 2022 12:10:22 +0200 Subject: [PATCH 12/16] set virtual owner on non-personal spaces --- changelog/unreleased/space-owner.md | 5 ++++ go.sum | 2 -- services/graph/pkg/service/v0/drives.go | 5 +++- ...ected-failures-localAPI-on-OCIS-storage.md | 7 ------ .../apiSpaces/editPublicLinkOfSpace.feature | 25 ++++++++----------- .../apiSpaces/shareSpacesViaLink.feature | 22 +++++++--------- .../features/bootstrap/SpacesContext.php | 8 +----- 7 files changed, 30 insertions(+), 44 deletions(-) create mode 100644 changelog/unreleased/space-owner.md diff --git a/changelog/unreleased/space-owner.md b/changelog/unreleased/space-owner.md new file mode 100644 index 00000000000..ff41e37bacb --- /dev/null +++ b/changelog/unreleased/space-owner.md @@ -0,0 +1,5 @@ +Bugfix: Space Creators can hand over spaces + +Set no owner on non personal spaces to be able to pass the space manager role to a new user. + +https://github.com/owncloud/ocis/pull/4244 diff --git a/go.sum b/go.sum index 92811f459ca..a3d9fbc1d71 100644 --- a/go.sum +++ b/go.sum @@ -285,8 +285,6 @@ github.com/crewjam/saml v0.4.6 h1:XCUFPkQSJLvzyl4cW9OvpWUbRf0gE7VUpU8ZnilbeM4= github.com/crewjam/saml v0.4.6/go.mod h1:ZBOXnNPFzB3CgOkRm7Nd6IVdkG+l/wF+0ZXLqD96t1A= github.com/cs3org/go-cs3apis v0.0.0-20220711084433-8f71d4e812a3 h1:QSQ2DGKPMChB4vHSs1Os9TnOJl21BrzKX9D5EtQfDog= github.com/cs3org/go-cs3apis v0.0.0-20220711084433-8f71d4e812a3/go.mod h1:UXha4TguuB52H14EMoSsCqDj7k8a/t7g4gVP+bgY5LY= -github.com/cs3org/reva/v2 v2.7.3-0.20220727111802-29f9f53c2f19 h1:Pu08T+aUlr/MTxBlqdoJx/i8ujtg5zSxGkulBbp89J8= -github.com/cs3org/reva/v2 v2.7.3-0.20220727111802-29f9f53c2f19/go.mod h1:9FpnWdVFw7ld3iOiuzHHQeCyVH/Ct9h03PZV9ZRplPM= github.com/cs3org/reva/v2 v2.7.3-0.20220729123357-51c6d5d0c041 h1:ObeKsyxTeYJoPyKqjz6qBjd9Q4kDjT1Fht3lGzOOfdc= github.com/cs3org/reva/v2 v2.7.3-0.20220729123357-51c6d5d0c041/go.mod h1:9FpnWdVFw7ld3iOiuzHHQeCyVH/Ct9h03PZV9ZRplPM= github.com/cubewise-code/go-mime v0.0.0-20200519001935-8c5762b177d8 h1:Z9lwXumT5ACSmJ7WGnFl+OMLLjpz5uR2fyz7dC255FI= diff --git a/services/graph/pkg/service/v0/drives.go b/services/graph/pkg/service/v0/drives.go index fd8c2570934..dfe702240a7 100644 --- a/services/graph/pkg/service/v0/drives.go +++ b/services/graph/pkg/service/v0/drives.go @@ -223,7 +223,6 @@ func (g Graph) CreateDrive(w http.ResponseWriter, r *http.Request) { } csr := storageprovider.CreateStorageSpaceRequest{ - Owner: us, Type: driveType, Name: spaceName, Quota: getQuota(drive.Quota, g.config.Spaces.DefaultQuota), @@ -237,6 +236,10 @@ func (g Graph) CreateDrive(w http.ResponseWriter, r *http.Request) { csr.Opaque = utils.AppendPlainToOpaque(csr.Opaque, "spaceAlias", *drive.DriveAlias) } + if driveType == "personal" { + csr.Owner = us + } + resp, err := client.CreateStorageSpace(r.Context(), &csr) if err != nil { errorcode.GeneralException.Render(w, r, http.StatusInternalServerError, err.Error()) diff --git a/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md b/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md index 0e74c2fda27..53ea58b38fc 100644 --- a/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md +++ b/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md @@ -22,10 +22,6 @@ The expected failures in this file are from features in the owncloud/ocis repo. ### [Search by shares jail works incorrect](https://github.com/owncloud/ocis/issues/4014) - [apiSpaces/search.feature:43](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/search.feature#L43) -### [Space Admin still has access to the project despite being removed from it](https://github.com/owncloud/ocis/issues/4127) -- [apiSpaces/shareSpaces.feature:77](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/shareSpaces.feature#L77) -- [apiSpaces/shareSpaces.feature:78](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/shareSpaces.feature#L78) - ### [Depth infinity not supported for space Shares Jail](https://github.com/owncloud/ocis/issues/4188) - [apiSpaces/copySpaces.feature:112](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/copySpaces.feature#L112) - [apiSpaces/copySpaces.feature:113](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/copySpaces.feature#L113) @@ -43,9 +39,6 @@ The expected failures in this file are from features in the owncloud/ocis repo. - [apiSpaces/moveSpaces.feature:186](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/moveSpaces.feature#L186) - [apiSpaces/moveSpaces.feature:189](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/moveSpaces.feature#L189) -### [A space manager cannot see the public links of another manager](https://github.com/owncloud/ocis/issues/4260) -- [apiSpaces/editPublicLinkOfSpace.feature:67](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/editPublicLinkOfSpace.feature#L67) - ### [User without space manager role cannot restore space](https://github.com/owncloud/ocis/issues/4027) - [apiSpaces/restoreSpaces.feature:63](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/restoreSpaces.feature#L63) - [apiSpaces/restoreSpaces.feature:64](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/restoreSpaces.feature#L64) diff --git a/tests/acceptance/features/apiSpaces/editPublicLinkOfSpace.feature b/tests/acceptance/features/apiSpaces/editPublicLinkOfSpace.feature index e359dac65fa..764d0f63e5f 100644 --- a/tests/acceptance/features/apiSpaces/editPublicLinkOfSpace.feature +++ b/tests/acceptance/features/apiSpaces/editPublicLinkOfSpace.feature @@ -35,18 +35,15 @@ Feature: A manager of the space can edit public link And the OCS status code should be "200" And the OCS status message should be "OK" And the fields of the last response to user "Alice" should include - | item_type | folder | - | mimetype | httpd/unix-directory | - | file_target | / | - | path | / | - | permissions | | - | share_type | public_link | - | displayname_file_owner | %displayname% | - | displayname_owner | %displayname% | - | uid_file_owner | %username% | - | uid_owner | %username% | - | name | | - | expiration | | + | item_type | folder | + | mimetype | httpd/unix-directory | + | file_target | / | + | path | / | + | permissions | | + | share_type | public_link | + | displayname_owner | %displayname% | + | name | | + | expiration | | And the public should be able to download file "/test.txt" from inside the last public link shared folder using the new public WebDAV API with password "" And the downloaded content should be "some content" Examples: @@ -65,8 +62,8 @@ Feature: A manager of the space can edit public link Examples: | role | shouldOrNot | | manager | should | - | editor | should not | - | viewer | should not | + | editor | should | + | viewer | should | Scenario Outline: Members of the space try to edit a public link diff --git a/tests/acceptance/features/apiSpaces/shareSpacesViaLink.feature b/tests/acceptance/features/apiSpaces/shareSpacesViaLink.feature index 8260c4a52fb..643157df974 100644 --- a/tests/acceptance/features/apiSpaces/shareSpacesViaLink.feature +++ b/tests/acceptance/features/apiSpaces/shareSpacesViaLink.feature @@ -32,9 +32,7 @@ Feature: Share spaces via link | path | / | | permissions | | | share_type | public_link | - | displayname_file_owner | %displayname% | | displayname_owner | %displayname% | - | uid_file_owner | %username% | | uid_owner | %username% | | name | | And the public should be able to download file "/test.txt" from inside the last public link shared folder using the new public WebDAV API with password "" @@ -57,17 +55,15 @@ Feature: Share spaces via link And the OCS status code should be "200" And the OCS status message should be "OK" And the fields of the last response to user "Alice" should include - | item_type | folder | - | mimetype | httpd/unix-directory | - | file_target | / | - | path | / | - | permissions | create | - | share_type | public_link | - | displayname_file_owner | %displayname% | - | displayname_owner | %displayname% | - | uid_file_owner | %username% | - | uid_owner | %username% | - | name | forUpload | + | item_type | folder | + | mimetype | httpd/unix-directory | + | file_target | / | + | path | / | + | permissions | create | + | share_type | public_link | + | displayname_owner | %displayname% | + | uid_owner | %username% | + | name | forUpload | And the public should be able to upload file "lorem.txt" into the last public link shared folder using the new public WebDAV API with password "123" And for user "Alice" the space "share space" should contain these entries: | lorem.txt | diff --git a/tests/acceptance/features/bootstrap/SpacesContext.php b/tests/acceptance/features/bootstrap/SpacesContext.php index be50ff8677d..b95f252295d 100644 --- a/tests/acceptance/features/bootstrap/SpacesContext.php +++ b/tests/acceptance/features/bootstrap/SpacesContext.php @@ -2843,18 +2843,12 @@ class SpacesContext implements Context { string $shouldOrNot ): void { $space = $this->getSpaceByName($user, $spaceName); - $url = "/apps/files_sharing/api/v1/shares"; - - $bodyTable = new TableNode([ - ["space_ref", $space['id']], - ["reshares", true], - ]); + $url = "/apps/files_sharing/api/v1/shares?reshares=true&space_ref=" . $space['id']; $this->ocsContext->userSendsHTTPMethodToOcsApiEndpointWithBody( $user, 'GET', $url, - $bodyTable ); $should = ($shouldOrNot !== "not"); From 814342a101dbe9cac2e68b26aba8d04a330cca44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Duffeck?= Date: Mon, 1 Aug 2022 13:53:35 +0200 Subject: [PATCH 13/16] Fix search in received shares It apparently broke as a fallout of the shareid refactoring. --- .../search/pkg/search/provider/searchprovider.go | 15 +++++++++------ .../pkg/search/provider/searchprovider_test.go | 15 +++++++++++---- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/services/search/pkg/search/provider/searchprovider.go b/services/search/pkg/search/provider/searchprovider.go index a744699e6e2..719fa6a7b99 100644 --- a/services/search/pkg/search/provider/searchprovider.go +++ b/services/search/pkg/search/provider/searchprovider.go @@ -114,12 +114,19 @@ func (p *Provider) Search(ctx context.Context, req *searchsvc.SearchRequest) (*s matches := MatchArray{} total := int32(0) for _, space := range listSpacesRes.StorageSpaces { + searchRootId := &searchmsg.ResourceID{ + StorageId: space.Root.StorageId, + SpaceId: space.Root.SpaceId, + OpaqueId: space.Root.OpaqueId, + } var mountpointRootId *searchmsg.ResourceID mountpointPrefix := "" switch space.SpaceType { case "mountpoint": continue // mountpoint spaces are only "links" to the shared spaces. we have to search the shared "grant" space instead case "grant": + // In case of grant spaces we search the root of the outer space and translate the paths to the according mountpoint + searchRootId.OpaqueId = space.Root.SpaceId mountpointId, ok := mountpointMap[space.Id.OpaqueId] if !ok { p.logger.Warn().Interface("space", space).Msg("could not find mountpoint space for grant space") @@ -153,12 +160,8 @@ func (p *Provider) Search(ctx context.Context, req *searchsvc.SearchRequest) (*s res, err := p.indexClient.Search(ctx, &searchsvc.SearchIndexRequest{ Query: formatQuery(req.Query), Ref: &searchmsg.Reference{ - ResourceId: &searchmsg.ResourceID{ - StorageId: space.Root.StorageId, - SpaceId: space.Root.SpaceId, - OpaqueId: space.Root.OpaqueId, - }, - Path: mountpointPrefix, + ResourceId: searchRootId, + Path: mountpointPrefix, }, PageSize: req.PageSize, }) diff --git a/services/search/pkg/search/provider/searchprovider_test.go b/services/search/pkg/search/provider/searchprovider_test.go index 0badf5e715a..f16e6f6f1f8 100644 --- a/services/search/pkg/search/provider/searchprovider_test.go +++ b/services/search/pkg/search/provider/searchprovider_test.go @@ -49,8 +49,8 @@ var _ = Describe("Searchprovider", func() { }, }, }, - Id: &sprovider.StorageSpaceId{OpaqueId: "personalspace"}, - Root: &sprovider.ResourceId{StorageId: "storageid", OpaqueId: "storageid"}, + Id: &sprovider.StorageSpaceId{OpaqueId: "storageid$personalspace!personalspace"}, + Root: &sprovider.ResourceId{StorageId: "storageid", SpaceId: "personalspace", OpaqueId: "storageid"}, Name: "personalspace", } @@ -133,6 +133,7 @@ var _ = Describe("Searchprovider", func() { Ref: &searchmsg.Reference{ ResourceId: &searchmsg.ResourceID{ StorageId: personalSpace.Root.StorageId, + SpaceId: personalSpace.Root.SpaceId, OpaqueId: personalSpace.Root.OpaqueId, }, Path: "./path/to/Foo.pdf", @@ -259,6 +260,7 @@ var _ = Describe("Searchprovider", func() { Ref: &searchmsg.Reference{ ResourceId: &searchmsg.ResourceID{ StorageId: grantSpace.Root.StorageId, + SpaceId: grantSpace.Root.SpaceId, OpaqueId: grantSpace.Root.OpaqueId, }, Path: "./grant/path/to/Shared.pdf", @@ -297,7 +299,8 @@ var _ = Describe("Searchprovider", func() { StorageSpaces: []*sprovider.StorageSpace{personalSpace, grantSpace, mountpointSpace}, }, nil) indexClient.On("Search", mock.Anything, mock.MatchedBy(func(req *searchsvc.SearchIndexRequest) bool { - return req.Ref.ResourceId.StorageId == grantSpace.Root.StorageId + return req.Ref.ResourceId.OpaqueId == grantSpace.Root.SpaceId && + req.Ref.ResourceId.SpaceId == grantSpace.Root.SpaceId })).Return(&searchsvc.SearchIndexResponse{ TotalMatches: 2, Matches: []*searchmsg.Match{ @@ -307,6 +310,7 @@ var _ = Describe("Searchprovider", func() { Ref: &searchmsg.Reference{ ResourceId: &searchmsg.ResourceID{ StorageId: grantSpace.Root.StorageId, + SpaceId: grantSpace.Root.SpaceId, OpaqueId: grantSpace.Root.OpaqueId, }, Path: "./grant/path/to/Shared.pdf", @@ -324,6 +328,7 @@ var _ = Describe("Searchprovider", func() { Ref: &searchmsg.Reference{ ResourceId: &searchmsg.ResourceID{ StorageId: grantSpace.Root.StorageId, + SpaceId: grantSpace.Root.SpaceId, OpaqueId: grantSpace.Root.OpaqueId, }, Path: "./grant/path/to/Irrelevant.pdf", @@ -338,7 +343,8 @@ var _ = Describe("Searchprovider", func() { }, }, nil) indexClient.On("Search", mock.Anything, mock.MatchedBy(func(req *searchsvc.SearchIndexRequest) bool { - return req.Ref.ResourceId.StorageId == personalSpace.Root.StorageId + return req.Ref.ResourceId.OpaqueId == personalSpace.Root.OpaqueId && + req.Ref.ResourceId.SpaceId == personalSpace.Root.SpaceId })).Return(&searchsvc.SearchIndexResponse{ TotalMatches: 1, Matches: []*searchmsg.Match{ @@ -348,6 +354,7 @@ var _ = Describe("Searchprovider", func() { Ref: &searchmsg.Reference{ ResourceId: &searchmsg.ResourceID{ StorageId: personalSpace.Root.StorageId, + SpaceId: personalSpace.Root.SpaceId, OpaqueId: personalSpace.Root.OpaqueId, }, Path: "./path/to/Foo.pdf", From d8905734a89097e8d5e1c5644f46869aa65b2295 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Duffeck?= Date: Mon, 1 Aug 2022 13:58:45 +0200 Subject: [PATCH 14/16] Add changelog --- changelog/unreleased/fix-search-in-received-shares.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 changelog/unreleased/fix-search-in-received-shares.md diff --git a/changelog/unreleased/fix-search-in-received-shares.md b/changelog/unreleased/fix-search-in-received-shares.md new file mode 100644 index 00000000000..88bac6a23de --- /dev/null +++ b/changelog/unreleased/fix-search-in-received-shares.md @@ -0,0 +1,5 @@ +Bugfix: Fix search in received shares + +We fixed a problem where items in received shares were not found. + +https://github.com/owncloud/ocis/issues/4308 From c8c4d574e78de0ada5c304f2c803ae1dc56250a9 Mon Sep 17 00:00:00 2001 From: Michael Barz Date: Mon, 1 Aug 2022 15:48:53 +0000 Subject: [PATCH 15/16] Automated changelog update [skip ci] --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9776ad4ca83..454a56a452b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ The following sections list the changes for unreleased. ## Summary * Bugfix - Substring search for sharees: [#547](https://github.com/owncloud/ocis/issues/547) +* Bugfix - Space Creators can hand over spaces: [#4244](https://github.com/owncloud/ocis/pull/4244) * Enhancement - Add drives field to users endpoint: [#4072](https://github.com/owncloud/ocis/pull/4072) * Enhancement - Improve error log for "could not get user by claim" error: [#4227](https://github.com/owncloud/ocis/pull/4227) * Enhancement - Allow providing list of services NOT to start: [#4254](https://github.com/owncloud/ocis/pull/4254) @@ -30,6 +31,12 @@ The following sections list the changes for unreleased. https://github.com/owncloud/ocis/issues/547 +* Bugfix - Space Creators can hand over spaces: [#4244](https://github.com/owncloud/ocis/pull/4244) + + Set no owner on non personal spaces to be able to pass the space manager role to a new user. + + https://github.com/owncloud/ocis/pull/4244 + * Enhancement - Add drives field to users endpoint: [#4072](https://github.com/owncloud/ocis/pull/4072) We have added `$expand=drives` to the `/users/{id}/` endpoint using the user filter From 26f15c2fa9abd1767eb0f7d60200404a613a7dc3 Mon Sep 17 00:00:00 2001 From: Andre Duffeck Date: Tue, 2 Aug 2022 07:19:16 +0000 Subject: [PATCH 16/16] Automated changelog update [skip ci] --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 454a56a452b..4dd7ef7351f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ The following sections list the changes for unreleased. ## Summary +* Bugfix - Fix search in received shares: [#4308](https://github.com/owncloud/ocis/issues/4308) * Bugfix - Substring search for sharees: [#547](https://github.com/owncloud/ocis/issues/547) * Bugfix - Space Creators can hand over spaces: [#4244](https://github.com/owncloud/ocis/pull/4244) * Enhancement - Add drives field to users endpoint: [#4072](https://github.com/owncloud/ocis/pull/4072) @@ -16,6 +17,12 @@ The following sections list the changes for unreleased. ## Details +* Bugfix - Fix search in received shares: [#4308](https://github.com/owncloud/ocis/issues/4308) + + We fixed a problem where items in received shares were not found. + + https://github.com/owncloud/ocis/issues/4308 + * Bugfix - Substring search for sharees: [#547](https://github.com/owncloud/ocis/issues/547) We fixed searching for sharees to be no longer case-sensitive. With this we introduced two new