Skip to content

Commit

Permalink
Move drives api endpoint to v1beta1
Browse files Browse the repository at this point in the history
  • Loading branch information
diocas committed Nov 19, 2024
1 parent 38f7477 commit 27805f2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
15 changes: 11 additions & 4 deletions internal/http/services/owncloud/ocgraph/drives.go
Original file line number Diff line number Diff line change
Expand Up @@ -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}
}

Expand Down
6 changes: 4 additions & 2 deletions internal/http/services/owncloud/ocgraph/ocgraph.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ func (s *svc) initRouter() {
s.router.Route("/v1.0", func(r chi.Router) {
r.Route("/me", func(r chi.Router) {
r.Get("/", s.getMe)
})
})
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)

Expand All @@ -79,8 +83,6 @@ func (s *svc) initRouter() {
r.Route("/drives", func(r chi.Router) {
r.Get("/{space-id}", s.getSpace)
})
})
s.router.Route("/v1beta1", func(r chi.Router) {
r.Route("/me/drive", func(r chi.Router) {
r.Get("/sharedWithMe", s.getSharedWithMe)
r.Get("/sharedByMe", s.getSharedByMe)
Expand Down

0 comments on commit 27805f2

Please sign in to comment.