Skip to content

Commit 6c50d6c

Browse files
committed
use space type from request
1 parent 21acef4 commit 6c50d6c

File tree

4 files changed

+16
-4
lines changed

4 files changed

+16
-4
lines changed

changelog/unreleased/create-spaces-odata.md

+1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ Change: Make the drives create method odata compliant
33
When creating a space on the graph API we now use the POST Body to provide the parameters.
44

55
https://github.com/owncloud/ocis/pull/2531
6+
https://github.com/owncloud/ocis/pull/2535
67
https://www.odata.org/getting-started/basic-tutorial/#modifyData

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ require (
2020
github.com/blevesearch/bleve/v2 v2.1.0
2121
github.com/coreos/go-oidc/v3 v3.0.0
2222
github.com/cs3org/go-cs3apis v0.0.0-20210922150613-cb9e3c99f8de
23-
github.com/cs3org/reva v1.13.1-0.20211005112832-fc6a28e1c206
23+
github.com/cs3org/reva v1.13.1-0.20211006080436-67f39be571fa
2424
github.com/disintegration/imaging v1.6.2
2525
github.com/glauth/glauth v1.1.3-0.20210729125545-b9aecdfcac31
2626
github.com/go-chi/chi/v5 v5.0.4

go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -291,8 +291,8 @@ github.com/crewjam/saml v0.4.5/go.mod h1:qCJQpUtZte9R1ZjUBcW8qtCNlinbO363ooNl02S
291291
github.com/cs3org/cato v0.0.0-20200828125504-e418fc54dd5e/go.mod h1:XJEZ3/EQuI3BXTp/6DUzFr850vlxq11I6satRtz0YQ4=
292292
github.com/cs3org/go-cs3apis v0.0.0-20210922150613-cb9e3c99f8de h1:N+AI8wz7yhDDqHDuq9EGaqQoFhAOi9XW37xt0ormflw=
293293
github.com/cs3org/go-cs3apis v0.0.0-20210922150613-cb9e3c99f8de/go.mod h1:UXha4TguuB52H14EMoSsCqDj7k8a/t7g4gVP+bgY5LY=
294-
github.com/cs3org/reva v1.13.1-0.20211005112832-fc6a28e1c206 h1:JKVYnbtWYNunOzDx9++NEKevnUKygypAEA66TT4j5aQ=
295-
github.com/cs3org/reva v1.13.1-0.20211005112832-fc6a28e1c206/go.mod h1:z1GjBB1gBv2olyqhWpTbL+JOobb2Q+GCSebR09x797A=
294+
github.com/cs3org/reva v1.13.1-0.20211006080436-67f39be571fa h1:sKNIaZ7rZFi+32Wnv8Z8Tc+J4gh0AYrUjaxl0Uk8JCQ=
295+
github.com/cs3org/reva v1.13.1-0.20211006080436-67f39be571fa/go.mod h1:z1GjBB1gBv2olyqhWpTbL+JOobb2Q+GCSebR09x797A=
296296
github.com/cubewise-code/go-mime v0.0.0-20200519001935-8c5762b177d8 h1:Z9lwXumT5ACSmJ7WGnFl+OMLLjpz5uR2fyz7dC255FI=
297297
github.com/cubewise-code/go-mime v0.0.0-20200519001935-8c5762b177d8/go.mod h1:4abs/jPXcmJzYoYGF91JF9Uq9s/KL5n1jvFDix8KcqY=
298298
github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4=

graph/pkg/service/v0/drives.go

+12-1
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,17 @@ func (g Graph) CreateDrive(w http.ResponseWriter, r *http.Request) {
170170
errorcode.GeneralException.Render(w, r, http.StatusInternalServerError, fmt.Errorf("invalid name").Error())
171171
return
172172
}
173+
var driveType string
174+
if drive.DriveType != nil {
175+
driveType = *drive.DriveType
176+
}
177+
178+
if driveType == "" {
179+
driveType = "project"
180+
}
181+
if driveType == "share" {
182+
errorcode.GeneralException.Render(w, r, http.StatusBadRequest, fmt.Errorf("drives of type share cannot be created via this api").Error())
183+
}
173184
var quota uint64
174185
if drive.Quota != nil && drive.Quota.Total != nil {
175186
quota = uint64(*drive.Quota.Total)
@@ -179,7 +190,7 @@ func (g Graph) CreateDrive(w http.ResponseWriter, r *http.Request) {
179190

180191
csr := provider.CreateStorageSpaceRequest{
181192
Owner: us,
182-
Type: "share",
193+
Type: driveType,
183194
Name: spaceName,
184195
Quota: &provider.Quota{
185196
QuotaMaxBytes: quota,

0 commit comments

Comments
 (0)