Skip to content

Commit

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

0 comments on commit e1c2e39

Please sign in to comment.