Allow any user id format

The user id / account UUID should allow any format as in some cases a regular user name
could be used there.
This commit is contained in:
Vincent Petry
2020-08-12 14:21:31 +02:00
parent 614ddeca3a
commit 12c1b96f6f
4 changed files with 7 additions and 41 deletions
+1
View File
@@ -8,3 +8,4 @@ coverage.out
/node_modules
/assets
/ocis-settings-store
pkg/proto/v0/ocis-settings-store/
@@ -0,0 +1,6 @@
Bugfix: Allow any user id format
The user id / account UUID should allow any format as in some cases a regular user name
could be used there.
https://github.com/owncloud/ocis-settings/issues/41
-36
View File
@@ -1173,42 +1173,6 @@ func TestSaveGetListSettingsValues(t *testing.T) {
Status: "Internal Server Error",
},
},
{
testDataName: "../ in account uuid",
SettingsValue: proto.SettingsValue{
Identifier: &proto.Identifier{
Extension: "great-extension",
BundleKey: "bobs-bundle",
AccountUuid: "../123e4567-e89b-12d3-a456-426652340000",
SettingKey: "should-not-be-possible",
},
Value: &proto.SettingsValue_BoolValue{BoolValue: false},
},
expectedError: CustomError{
ID: "go.micro.client",
Code: 500,
Detail: "account_uuid: must be a valid UUID.",
Status: "Internal Server Error",
},
},
{
testDataName: "\\ in fields that are used to create folder and file names",
SettingsValue: proto.SettingsValue{
Identifier: &proto.Identifier{
Extension: "\\-extension",
BundleKey: "\\-bundle",
AccountUuid: "\\123e4567-e89b-12d3-a456-426652340000",
SettingKey: "should-not-be-possible",
},
Value: &proto.SettingsValue_BoolValue{BoolValue: false},
},
expectedError: CustomError{
ID: "go.micro.client",
Code: 500,
Detail: "account_uuid: must be a valid UUID; bundle_key: must be in a valid format; extension: must be in a valid format.",
Status: "Internal Server Error",
},
},
}
client := service.Client()
cl := proto.NewValueService("com.owncloud.api.settings", client)
-5
View File
@@ -19,10 +19,6 @@ var (
validation.Required,
validation.Match(regexForKeys),
}
accountUUIDRule = []validation.Rule{
validation.Required,
is.UUID,
}
)
func validateSaveSettingsBundle(req *proto.SaveSettingsBundleRequest) error {
@@ -82,6 +78,5 @@ func validateValueIdentifier(identifier *proto.Identifier) error {
validation.Field(&identifier.Extension, keyRule...),
validation.Field(&identifier.BundleKey, keyRule...),
validation.Field(&identifier.SettingKey, settingKeyRule...),
validation.Field(&identifier.AccountUuid, accountUUIDRule...),
)
}