diff --git a/internal/http/services/ocmd/config.go b/internal/http/services/ocmd/config.go index a8666e53f18..abf0a3833b4 100644 --- a/internal/http/services/ocmd/config.go +++ b/internal/http/services/ocmd/config.go @@ -33,6 +33,7 @@ type configData struct { Endpoint string `json:"endPoint" xml:"endPoint"` Provider string `json:"provider" xml:"provider"` ResourceTypes []resourceTypes `json:"resourceTypes" xml:"resourceTypes"` + Capabilities []string `json:"capabilities" xml:"capabilities"` } type resourceTypes struct { @@ -43,6 +44,8 @@ type resourceTypes struct { type resourceTypesProtocols struct { Webdav string `json:"webdav"` + Webapp string `json:"webapp"` + Datatx string `json:"datatx"` } type configHandler struct { @@ -51,28 +54,37 @@ type configHandler struct { func (h *configHandler) init(c *config) { h.c = c.Config - if h.c.APIVersion == "" { - h.c.APIVersion = "1.0-proposal1" - } + h.c.Enabled = true + h.c.APIVersion = "1.1.0" if h.c.Host == "" { h.c.Host = "localhost" } - if h.c.Provider == "" { - h.c.Provider = "cernbox" - } - h.c.Enabled = true if len(c.Prefix) > 0 { h.c.Endpoint = fmt.Sprintf("https://%s/%s", h.c.Host, c.Prefix) } else { h.c.Endpoint = fmt.Sprintf("https://%s", h.c.Host) } + if h.c.Provider == "" { + h.c.Provider = "reva" + } + rtProtos := resourceTypesProtocols{} + if h.c.ResourceTypes[0].Protocols.Webdav != "" { + rtProtos.Webdav = fmt.Sprintf("https://%s/remote.php/dav/%s", h.c.Host, c.Prefix) + } + if h.c.ResourceTypes[0].Protocols.Webapp != "" { + rtProtos.Webapp = fmt.Sprintf("https://%s/external/sciencemesh", h.c.Host) + } + if h.c.ResourceTypes[0].Protocols.Datatx != "" { + rtProtos.Webdav = fmt.Sprintf("https://%s/remote.php/dav/%s", h.c.Host, c.Prefix) + } + h.c.ResourceTypes = []resourceTypes{{ - Name: "file", - ShareTypes: []string{"user"}, - Protocols: resourceTypesProtocols{ - Webdav: fmt.Sprintf("/%s/ocm_webdav", h.c.Provider), - }, + Name: "file", // so far we only support `file` + ShareTypes: []string{"user"}, // so far we only support `user` + Protocols: rtProtos, // expose the protocols as per configuration }} + // for now we hardcode the capabilities, as this is currently only advisory + h.c.Capabilities = []string{"/invite-accepted"} } // Send sends the configuration to the caller. diff --git a/internal/http/services/ocmd/ocm.go b/internal/http/services/ocmd/ocm.go index f998db52da7..04af6bf3447 100644 --- a/internal/http/services/ocmd/ocm.go +++ b/internal/http/services/ocmd/ocm.go @@ -90,7 +90,7 @@ func (s *svc) routerInit() error { return err } - s.router.Get("/ocm-provider", configHandler.Send) // FIXME: where this endpoint is documented? + s.router.Get("/ocm-provider", configHandler.Send) s.router.Post("/shares", sharesHandler.CreateShare) s.router.Post("/notifications", notificationsHandler.SendNotification) s.router.Post("/invite-accepted", invitesHandler.AcceptInvite)