From e1c2e39ea90c04e2a70758804264aa6542f3b849 Mon Sep 17 00:00:00 2001 From: Diogo Castro Date: Tue, 19 Nov 2024 17:22:40 +0100 Subject: [PATCH] Move list my drives api endpoint to v1beta1 --- internal/http/services/owncloud/ocgraph/drives.go | 15 +++++++++++---- .../http/services/owncloud/ocgraph/ocgraph.go | 10 ++++++---- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/internal/http/services/owncloud/ocgraph/drives.go b/internal/http/services/owncloud/ocgraph/drives.go index de40f388bf..791a1c6264 100644 --- a/internal/http/services/owncloud/ocgraph/drives.go +++ b/internal/http/services/owncloud/ocgraph/drives.go @@ -358,14 +358,21 @@ func cs3PermissionsToLibreGraph(user *userpb.User, perms *providerpb.ResourcePer case perms.Stat: p.SetRoles([]string{"viewer"}) } + + identity := &libregraph.Identity{ + DisplayName: user.DisplayName, + Id: &user.Id.OpaqueId, + } + p.GrantedToIdentities = []libregraph.IdentitySet{ { - User: &libregraph.Identity{ - DisplayName: user.DisplayName, - Id: &user.Id.OpaqueId, - }, + User: identity, }, } + + p.GrantedToV2 = &libregraph.SharePointIdentitySet{ + User: identity, + } return []libregraph.Permission{p} } diff --git a/internal/http/services/owncloud/ocgraph/ocgraph.go b/internal/http/services/owncloud/ocgraph/ocgraph.go index ce2525a8c6..6f8d71806c 100644 --- a/internal/http/services/owncloud/ocgraph/ocgraph.go +++ b/internal/http/services/owncloud/ocgraph/ocgraph.go @@ -71,16 +71,18 @@ func (s *svc) initRouter() { s.router.Route("/v1.0", func(r chi.Router) { r.Route("/me", func(r chi.Router) { r.Get("/", s.getMe) - r.Route("/drives", func(r chi.Router) { - r.Get("/", s.listMySpaces) - - }) }) r.Route("/drives", func(r chi.Router) { r.Get("/{space-id}", s.getSpace) }) }) s.router.Route("/v1beta1", func(r chi.Router) { + r.Route("/me", func(r chi.Router) { + r.Route("/drives", func(r chi.Router) { + r.Get("/", s.listMySpaces) + + }) + }) r.Route("/me/drive", func(r chi.Router) { r.Get("/sharedWithMe", s.getSharedWithMe) r.Get("/sharedByMe", s.getSharedByMe)