Merge pull request #4590 from owncloud/3-fixes
[full-ci] add web url to graph api and update reva
This commit is contained in:
@@ -525,7 +525,6 @@ func (g Graph) cs3StorageSpaceToDrive(ctx context.Context, baseURL *url.URL, spa
|
||||
Id: libregraph.PtrString(spaceID),
|
||||
Name: &space.Name,
|
||||
//"createdDateTime": "string (timestamp)", // TODO read from StorageSpace ... needs Opaque for now
|
||||
//"description": "string", // TODO read from StorageSpace ... needs Opaque for now
|
||||
DriveType: &space.SpaceType,
|
||||
Root: &libregraph.DriveItem{
|
||||
Id: libregraph.PtrString(storagespace.FormatResourceID(spaceRid)),
|
||||
@@ -572,15 +571,23 @@ func (g Graph) cs3StorageSpaceToDrive(ctx context.Context, baseURL *url.URL, spa
|
||||
}
|
||||
|
||||
if baseURL != nil {
|
||||
// TODO read from StorageSpace ... needs Opaque for now
|
||||
// TODO how do we build the url?
|
||||
// for now: read from request
|
||||
webDavURL := *baseURL
|
||||
webDavURL.Path = path.Join(webDavURL.Path, spaceID)
|
||||
drive.Root.WebDavUrl = libregraph.PtrString(webDavURL.String())
|
||||
}
|
||||
|
||||
// TODO The public space has no owner ... should we even show it?
|
||||
webURL, err := url.Parse(g.config.Commons.OcisURL)
|
||||
if err != nil {
|
||||
g.logger.Error().
|
||||
Err(err).
|
||||
Str("url", g.config.Commons.OcisURL).
|
||||
Msg("failed to parse base url")
|
||||
return nil, err
|
||||
}
|
||||
|
||||
webURL.Path = path.Join(webURL.Path, "f", storagespace.FormatResourceID(spaceRid))
|
||||
drive.WebUrl = libregraph.PtrString(webURL.String())
|
||||
|
||||
if space.Owner != nil && space.Owner.Id != nil {
|
||||
drive.Owner = &libregraph.IdentitySet{
|
||||
User: &libregraph.Identity{
|
||||
@@ -604,7 +611,6 @@ func (g Graph) cs3StorageSpaceToDrive(ctx context.Context, baseURL *url.URL, spa
|
||||
Total: &t,
|
||||
}
|
||||
}
|
||||
// FIXME use coowner from https://github.com/owncloud/open-graph-api
|
||||
|
||||
return drive, nil
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ import (
|
||||
. "github.com/onsi/ginkgo/v2"
|
||||
. "github.com/onsi/gomega"
|
||||
libregraph "github.com/owncloud/libre-graph-api-go"
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/shared"
|
||||
"github.com/owncloud/ocis/v2/services/graph/mocks"
|
||||
"github.com/owncloud/ocis/v2/services/graph/pkg/config"
|
||||
"github.com/owncloud/ocis/v2/services/graph/pkg/config/defaults"
|
||||
@@ -39,6 +40,8 @@ var _ = Describe("Graph", func() {
|
||||
cfg = defaults.FullDefaultConfig()
|
||||
cfg.Identity.LDAP.CACert = "" // skip the startup checks, we don't use LDAP at all in this tests
|
||||
cfg.TokenManager.JWTSecret = "loremipsum"
|
||||
cfg.Commons = &shared.Commons{}
|
||||
cfg.Commons.OcisURL = "https://ocis.test"
|
||||
|
||||
gatewayClient = &mocks.GatewayClient{}
|
||||
eventsPublisher = mocks.Publisher{}
|
||||
@@ -108,7 +111,8 @@ var _ = Describe("Graph", func() {
|
||||
"root":{
|
||||
"id":"pro-1$sameID",
|
||||
"webDavUrl":"https://localhost:9200/dav/spaces/pro-1$sameID"
|
||||
}
|
||||
},
|
||||
"webUrl": "https://ocis.test/f/pro-1$sameID"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -178,7 +182,8 @@ var _ = Describe("Graph", func() {
|
||||
"eTag":"101112131415",
|
||||
"id":"pro-1$asameID",
|
||||
"webDavUrl":"https://localhost:9200/dav/spaces/pro-1$asameID"
|
||||
}
|
||||
},
|
||||
"webUrl": "https://ocis.test/f/pro-1$asameID"
|
||||
},
|
||||
{
|
||||
"driveAlias":"bspacetype/bspacename",
|
||||
@@ -189,7 +194,8 @@ var _ = Describe("Graph", func() {
|
||||
"eTag":"123456789",
|
||||
"id":"pro-1$bsameID",
|
||||
"webDavUrl":"https://localhost:9200/dav/spaces/pro-1$bsameID"
|
||||
}
|
||||
},
|
||||
"webUrl": "https://ocis.test/f/pro-1$bsameID"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user