diff --git a/.drone.env b/.drone.env index 24c029c028f..9ef0abd9c67 100644 --- a/.drone.env +++ b/.drone.env @@ -1,5 +1,5 @@ # The test runner source for API tests -CORE_COMMITID=854ee4b08674d1932fb0b7910a9124148df36e4c +CORE_COMMITID=0214d4bca2d0bb39ea6b2ad67c2df463b2647b76 CORE_BRANCH=master # The test runner source for UI tests diff --git a/.drone.star b/.drone.star index 9aa37640155..e6fc3e393cb 100644 --- a/.drone.star +++ b/.drone.star @@ -195,6 +195,7 @@ def main(ctx): test_pipelines = \ cancelPreviousBuilds() + \ + buildCacheWeb(ctx) + \ yarnCache(ctx) + \ [buildOcisBinaryForTesting(ctx)] + \ cacheCoreReposForTesting(ctx) + \ @@ -257,15 +258,33 @@ def main(ctx): pipelineSanityChecks(ctx, pipelines) return pipelines +def buildCacheWeb(ctx): + return [{ + "kind": "pipeline", + "type": "docker", + "name": "cache-web", + "steps": skipIfUnchanged(ctx, "cache") + + installWebTestRunner() + + rebuildBuildArtifactCache(ctx, "web-dist", "webTestRunner"), + "trigger": { + "ref": [ + "refs/heads/master", + "refs/tags/**", + "refs/pull/**", + ], + }, + }] + def yarnCache(ctx): return [{ "kind": "pipeline", "type": "docker", "name": "cache-yarn", "steps": skipIfUnchanged(ctx, "cache") + - installWebTestRunner() + + restoreBuildArtifactCache(ctx, "web-dist", "webTestRunner") + yarnInstallUITests() + rebuildBuildArtifactCache(ctx, "tests-yarn", "webTestRunner/tests/acceptance/.yarn"), + "depends_on": getPipelineNames(buildCacheWeb(ctx)), "trigger": { "ref": [ "refs/heads/master", @@ -289,7 +308,6 @@ def yarnInstallUITests(): "name": "yarn-install", "image": OC_CI_NODEJS % DEFAULT_NODEJS_VERSION, "commands": [ - "curl -SsfL -o /usr/local/bin/retry https://raw.githubusercontent.com/owncloud-ci/retry/master/retry && chmod +x /usr/local/bin/retry", ". /drone/src/.drone.env", "cd webTestRunner", "git checkout $WEB_COMMITID", @@ -773,7 +791,7 @@ def uiTestPipeline(ctx, filterTags, early_fail, runPart = 1, numberOfParts = 1, "os": "linux", "arch": "amd64", }, - "steps": skipIfUnchanged(ctx, "acceptance-tests") + restoreBuildArtifactCache(ctx, "ocis-binary-amd64", "ocis/bin/ocis") + installWebTestRunner() + + "steps": skipIfUnchanged(ctx, "acceptance-tests") + restoreBuildArtifactCache(ctx, "ocis-binary-amd64", "ocis/bin/ocis") + restoreBuildArtifactCache(ctx, "web-dist", "webTestRunner") + restoreBuildArtifactCache(ctx, "tests-yarn", "webTestRunner/tests/acceptance/.yarn") + yarnInstallUITests() + ocisServer(storage, accounts_hash_difficulty) + waitForSeleniumService() + waitForMiddlewareService() + restoreBuildArtifactCache(ctx, "testing_app", dirs["testing_app"]) + @@ -846,7 +864,6 @@ def settingsUITests(ctx, storage = "ocis", accounts_hash_difficulty = 4): "MIDDLEWARE_HOST": "http://middleware:3000", }, "commands": [ - "curl -SsfL -o /usr/local/bin/retry https://raw.githubusercontent.com/owncloud-ci/retry/master/retry && chmod +x /usr/local/bin/retry", ". /drone/src/.drone.env", # we need to have Web around for some general step definitions (eg. how to log in) "git clone -b $WEB_BRANCH --single-branch --no-tags https://github.com/owncloud/web.git /srv/app/web", @@ -1582,7 +1599,7 @@ def makeNodeGenerate(module): "CHROMEDRIVER_SKIP_DOWNLOAD": "true", # install fails on arm and chromedriver is a test only dependency }, "commands": [ - "%s ci-node-generate" % (make), + "retry -t 3 '%s ci-node-generate'" % (make), ], "volumes": [stepVolumeGo], }, @@ -1598,7 +1615,7 @@ def makeGoGenerate(module): "name": "generate go", "image": OC_CI_GOLANG, "commands": [ - "%s ci-go-generate" % (make), + "retry -t 3 '%s ci-go-generate'" % (make), ], "volumes": [stepVolumeGo], }, @@ -1643,6 +1660,8 @@ def ocisServer(storage, accounts_hash_difficulty = 4, volumes = [], depends_on = environment = { "OCIS_URL": OCIS_URL, "OCIS_CONFIG_DIR": "/root/.ocis/config", + "LDAP_GROUP_SUBSTRING_FILTER_TYPE": "any", + "LDAP_USER_SUBSTRING_FILTER_TYPE": "any", "GATEWAY_GRPC_ADDR": "0.0.0.0:9142", # cs3api-validator needs the cs3api gatway exposed "STORAGE_USERS_DRIVER": "%s" % (storage), "STORAGE_USERS_DRIVER_LOCAL_ROOT": "/srv/app/tmp/ocis/local/root", @@ -1655,6 +1674,7 @@ def ocisServer(storage, accounts_hash_difficulty = 4, volumes = [], depends_on = "SETTINGS_DATA_PATH": "/srv/app/tmp/ocis/settings", "IDM_CREATE_DEMO_USERS": True, "IDM_ADMIN_PASSWORD": "admin", # override the random admin password from `ocis init` + "FRONTEND_SEARCH_MIN_LENGTH": "2", } wait_for_ocis = { "name": "wait-for-ocis-server", @@ -1688,6 +1708,8 @@ def ocisServer(storage, accounts_hash_difficulty = 4, volumes = [], depends_on = "LDAP_USER_BASE_DN": "ou=TestUsers,dc=owncloud,dc=com", "LDAP_USER_SCHEMA_ID": "ownclouduuid", "LDAP_USER_FILTER": "(objectclass=owncloud)", + "LDAP_GROUP_SUBSTRING_FILTER_TYPE": "any", + "LDAP_USER_SUBSTRING_FILTER_TYPE": "any", # ownCloudSQL storage driver "STORAGE_USERS_DRIVER": "owncloudsql", "STORAGE_USERS_OWNCLOUDSQL_DATADIR": "/mnt/data/files", @@ -1713,6 +1735,7 @@ def ocisServer(storage, accounts_hash_difficulty = 4, volumes = [], depends_on = "OCIS_BASE_DATA_PATH": "/mnt/data/ocis", "OCIS_CONFIG_DIR": "/etc/ocis", "PROXY_ENABLE_BASIC_AUTH": "true", + "FRONTEND_SEARCH_MIN_LENGTH": "2", } wait_for_ocis = { "name": "wait-for-ocis-server", @@ -1838,7 +1861,7 @@ def build(): "name": "build", "image": OC_CI_GOLANG, "commands": [ - "make -C ocis build", + "retry -t 3 'make -C ocis build'", ], "volumes": [stepVolumeGo], }, diff --git a/CHANGELOG.md b/CHANGELOG.md index 11c14d56fcc..a4c0073087d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,10 +6,26 @@ The following sections list the changes for unreleased. ## Summary +* Bugfix - Substring search for sharees: [#547](https://github.com/owncloud/ocis/issues/547) * Enhancement - Improve error log for "could not get user by claim" error: [#4227](https://github.com/owncloud/ocis/pull/4227) ## Details +* Bugfix - Substring search for sharees: [#547](https://github.com/owncloud/ocis/issues/547) + + We fixed searching for sharees to be no longer case-sensitive. With this we introduced two new + settings for the users and groups services: "group_substring_filter_type" for the group + services and "user_substring_filter_type" for the users service. They allow to set the type + of LDAP filter that is used for substring user searches. Possible values are: "initial", + "final" and "any" to do either prefix, suffix or full substring searches. Both settings + default to "initial". + + Also a new option "search_min_length" was added for the "frontend" service. It allows to + configure the minimum number of characters to enter before a search for Sharees is started. + This setting is e.g. evaluated by the web ui via the capabilities endpoint. + + https://github.com/owncloud/ocis/issues/547 + * Enhancement - Improve error log for "could not get user by claim" error: [#4227](https://github.com/owncloud/ocis/pull/4227) We've improved the error log for "could not get user by claim" error where previously only the diff --git a/changelog/unreleased/fix-sharee-substring-search.md b/changelog/unreleased/fix-sharee-substring-search.md new file mode 100644 index 00000000000..40f492c76b4 --- /dev/null +++ b/changelog/unreleased/fix-sharee-substring-search.md @@ -0,0 +1,16 @@ +Bugfix: Substring search for sharees + +We fixed searching for sharees to be no longer case-sensitive. +With this we introduced two new settings for the users and groups services: +"group_substring_filter_type" for the group services and +"user_substring_filter_type" for the users service. +They allow to set the type of LDAP filter that is used for substring user +searches. Possible values are: "initial", "final" and "any" to do either +prefix, suffix or full substring searches. Both settings default to "initial". + +Also a new option "search_min_length" was added for the "frontend" service. It +allows to configure the minimum number of characters to enter before a search +for Sharees is started. This setting is e.g. evaluated by the web ui via the +capabilities endpoint. + +https://github.com/owncloud/ocis/issues/547 diff --git a/go.mod b/go.mod index 23f67f5e283..2a723599321 100644 --- a/go.mod +++ b/go.mod @@ -39,7 +39,7 @@ require ( github.com/gorilla/mux v1.8.0 github.com/grpc-ecosystem/grpc-gateway/v2 v2.10.3 github.com/justinas/alice v1.2.0 - github.com/libregraph/idm v0.3.1-0.20220714094919-c0f30ff05beb + github.com/libregraph/idm v0.3.1-0.20220718103124-c4f6613dce2b github.com/libregraph/lico v0.54.1-0.20220325072321-31efc3995d63 github.com/mitchellh/mapstructure v1.5.0 github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 diff --git a/go.sum b/go.sum index 423f00ddb96..00e0919f1c1 100644 --- a/go.sum +++ b/go.sum @@ -831,8 +831,8 @@ github.com/labbsr0x/goh v1.0.1/go.mod h1:8K2UhVoaWXcCU7Lxoa2omWnC8gyW8px7/lmO61c github.com/labstack/echo/v4 v4.1.11/go.mod h1:i541M3Fj6f76NZtHSj7TXnyM8n2gaodfvfxNnFqi74g= github.com/labstack/gommon v0.3.0/go.mod h1:MULnywXg0yavhxWKc+lOruYdAhDwPK9wf0OL7NoOu+k= github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= -github.com/libregraph/idm v0.3.1-0.20220714094919-c0f30ff05beb h1:kY+TjOyeXQ5kTzp66+c5C0sf5o9eLkYbxBPbB3iRQVk= -github.com/libregraph/idm v0.3.1-0.20220714094919-c0f30ff05beb/go.mod h1:ggVmYkaK5fu680QOnxkuyCRW5Wl5qzaYXgIiieNBOJE= +github.com/libregraph/idm v0.3.1-0.20220718103124-c4f6613dce2b h1:/BNTnfP6lqixKUP2kP9gKWiPRaBWvE5BJcFcIVd2Ekg= +github.com/libregraph/idm v0.3.1-0.20220718103124-c4f6613dce2b/go.mod h1:ggVmYkaK5fu680QOnxkuyCRW5Wl5qzaYXgIiieNBOJE= github.com/libregraph/lico v0.54.1-0.20220325072321-31efc3995d63 h1:oPqyRePmq+59YF1tAur7WXuM/z/epRd+HGGyPPx2Vv8= github.com/libregraph/lico v0.54.1-0.20220325072321-31efc3995d63/go.mod h1:KZ4X+bEbOQMSV6iPysZEqVO/Pa5Mvo7xhhcLwUNPjmw= github.com/linode/linodego v0.25.3/go.mod h1:GSBKPpjoQfxEfryoCRcgkuUOCuVtGHWhzI8OMdycNTE= diff --git a/services/frontend/pkg/config/config.go b/services/frontend/pkg/config/config.go index 3d8cef6b100..136d11d0945 100644 --- a/services/frontend/pkg/config/config.go +++ b/services/frontend/pkg/config/config.go @@ -32,6 +32,7 @@ type Config struct { UploadHTTPMethodOverride string `yaml:"upload_http_method_override" env:"FRONTEND_UPLOAD_HTTP_METHOD_OVERRIDE" desc:"Advise TUS to replace PATCH requests by POST requests."` DefaultUploadProtocol string `yaml:"default_upload_protocol" env:"FRONTEND_DEFAULT_UPLOAD_PROTOCOL" desc:"The default upload protocol to use in the frontend (e.g. tus)."` EnableResharing bool `yaml:"enable_resharing" env:"FRONTEND_ENABLE_RESHARING" desc:"Enables the support for resharing in the frontend."` + SearchMinLength int `yaml:"search_min_length" env:"FRONTEND_SEARCH_MIN_LENGTH" desc:"Minimum number of characters to enter before starting a search for Sharees."` PublicURL string `yaml:"public_url" env:"OCIS_URL;FRONTEND_PUBLIC_URL" desc:"The public facing URL of the oCIS frontend."` diff --git a/services/frontend/pkg/config/defaults/defaultconfig.go b/services/frontend/pkg/config/defaults/defaultconfig.go index f23891d14d3..4cd1ea94dea 100644 --- a/services/frontend/pkg/config/defaults/defaultconfig.go +++ b/services/frontend/pkg/config/defaults/defaultconfig.go @@ -39,6 +39,7 @@ func DefaultConfig() *config.Config { UploadHTTPMethodOverride: "", DefaultUploadProtocol: "tus", EnableResharing: true, + SearchMinLength: 3, Checksums: config.Checksums{ SupportedTypes: []string{"sha1", "md5", "adler32"}, PreferredUploadType: "", diff --git a/services/frontend/pkg/revaconfig/config.go b/services/frontend/pkg/revaconfig/config.go index 7b13c3bfb32..16a94e06f91 100644 --- a/services/frontend/pkg/revaconfig/config.go +++ b/services/frontend/pkg/revaconfig/config.go @@ -165,7 +165,7 @@ func FrontendConfigFromStruct(cfg *config.Config) map[string]interface{} { "share_with_group_members_only": true, "share_with_membership_groups_only": true, "default_permissions": 22, - "search_min_length": 3, + "search_min_length": cfg.SearchMinLength, "public": map[string]interface{}{ "alias": true, "enabled": true, diff --git a/services/groups/pkg/config/config.go b/services/groups/pkg/config/config.go index e792a17f2b8..fb8e9ed13bc 100644 --- a/services/groups/pkg/config/config.go +++ b/services/groups/pkg/config/config.go @@ -66,22 +66,23 @@ type Drivers struct { } type LDAPDriver struct { - URI string `yaml:"uri" env:"LDAP_URI;GROUPS_LDAP_URI" desc:"URI of the LDAP Server to connect to. Supported URI schemes are 'ldaps://' and 'ldap://'"` - CACert string `yaml:"ca_cert" env:"LDAP_CACERT;GROUPS_LDAP_CACERT" desc:"Path to a CA certificate file for validating the LDAP server's TLS certificate. If empty the system default CA bundle will be used."` - Insecure bool `yaml:"insecure" env:"LDAP_INSECURE;GROUPS_LDAP_INSECURE" desc:"Disable TLS certificate validation for the LDAP connections. Do not set this in production environments."` - BindDN string `yaml:"bind_dn" env:"LDAP_BIND_DN;GROUPS_LDAP_BIND_DN" desc:"LDAP DN to use for simple bind authentication with the target LDAP server."` - BindPassword string `yaml:"bind_password" env:"LDAP_BIND_PASSWORD;GROUPS_LDAP_BIND_PASSWORD" desc:"Password to use for authenticating the 'bind_dn'."` - UserBaseDN string `yaml:"user_base_dn" env:"LDAP_USER_BASE_DN;GROUPS_LDAP_USER_BASE_DN" desc:"Search base DN for looking up LDAP users."` - GroupBaseDN string `yaml:"group_base_dn" env:"LDAP_GROUP_BASE_DN;GROUPS_LDAP_GROUP_BASE_DN" desc:"Search base DN for looking up LDAP groups."` - UserScope string `yaml:"user_scope" env:"LDAP_USER_SCOPE;GROUPS_LDAP_USER_SCOPE" desc:"LDAP search scope to use when looking up users. Supported scopes are 'base', 'one' and 'sub'."` - GroupScope string `yaml:"group_scope" env:"LDAP_GROUP_SCOPE;GROUPS_LDAP_GROUP_SCOPE" desc:"LDAP search scope to use when looking up groups. Supported scopes are 'base', 'one' and 'sub'."` - UserFilter string `yaml:"user_filter" env:"LDAP_USER_FILTER;GROUPS_LDAP_USER_FILTER" desc:"LDAP filter to add to the default filters for user search like '(objectclass=ownCloud)'."` - GroupFilter string `yaml:"group_filter" env:"LDAP_GROUP_FILTER;GROUPS_LDAP_GROUP_FILTER" desc:"LDAP filter to add to the default filters for group searches."` - UserObjectClass string `yaml:"user_object_class" env:"LDAP_USER_OBJECTCLASS;GROUPS_LDAP_USER_OBJECTCLASS" desc:"The object class to use for users in the default user search filter ('inetOrgPerson')."` - GroupObjectClass string `yaml:"group_object_class" env:"LDAP_GROUP_OBJECTCLASS;GROUPS_LDAP_GROUP_OBJECTCLASS" desc:"The object class to use for groups in the default group search filter ('groupOfNames')."` - IDP string `yaml:"idp" env:"OCIS_URL;OCIS_OIDC_ISSUER;GROUPS_IDP_URL" desc:"The identity provider value to set in the group IDs of the CS3 group objects for groups returned by this group provider."` - UserSchema LDAPUserSchema `yaml:"user_schema"` - GroupSchema LDAPGroupSchema `yaml:"group_schema"` + URI string `yaml:"uri" env:"LDAP_URI;GROUPS_LDAP_URI" desc:"URI of the LDAP Server to connect to. Supported URI schemes are 'ldaps://' and 'ldap://'"` + CACert string `yaml:"ca_cert" env:"LDAP_CACERT;GROUPS_LDAP_CACERT" desc:"Path to a CA certificate file for validating the LDAP server's TLS certificate. If empty, the system default CA bundle will be used."` + Insecure bool `yaml:"insecure" env:"LDAP_INSECURE;GROUPS_LDAP_INSECURE" desc:"Disable TLS certificate validation for the LDAP connections. Do not set this in production environments."` + BindDN string `yaml:"bind_dn" env:"LDAP_BIND_DN;GROUPS_LDAP_BIND_DN" desc:"LDAP DN to use for simple bind authentication with the target LDAP server."` + BindPassword string `yaml:"bind_password" env:"LDAP_BIND_PASSWORD;GROUPS_LDAP_BIND_PASSWORD" desc:"Password to use for authenticating the 'bind_dn'."` + UserBaseDN string `yaml:"user_base_dn" env:"LDAP_USER_BASE_DN;GROUPS_LDAP_USER_BASE_DN" desc:"Search base DN for looking up LDAP users."` + GroupBaseDN string `yaml:"group_base_dn" env:"LDAP_GROUP_BASE_DN;GROUPS_LDAP_GROUP_BASE_DN" desc:"Search base DN for looking up LDAP groups."` + UserScope string `yaml:"user_scope" env:"LDAP_USER_SCOPE;GROUPS_LDAP_USER_SCOPE" desc:"LDAP search scope to use when looking up users. Supported scopes are 'base', 'one' and 'sub'."` + GroupScope string `yaml:"group_scope" env:"LDAP_GROUP_SCOPE;GROUPS_LDAP_GROUP_SCOPE" desc:"LDAP search scope to use when looking up groups. Supported scopes are 'base', 'one' and 'sub'."` + GroupSubstringFilterType string `yaml:"group_substring_filter_type" env:"LDAP_GROUP_SUBSTRING_FILTER_TYPE;GROUP_LDAP_GROUP_SUBSTRING_FILTER_TYPE" desc:"Type of substring search filter to use for substring searches for groups. Possible values: 'initial' for doing prefix only searches, 'final' for doing suffix only searches or 'any' for doing full substring searches"` + UserFilter string `yaml:"user_filter" env:"LDAP_USER_FILTER;GROUPS_LDAP_USER_FILTER" desc:"LDAP filter to add to the default filters for user search like '(objectclass=ownCloud)'."` + GroupFilter string `yaml:"group_filter" env:"LDAP_GROUP_FILTER;GROUPS_LDAP_GROUP_FILTER" desc:"LDAP filter to add to the default filters for group searches."` + UserObjectClass string `yaml:"user_object_class" env:"LDAP_USER_OBJECTCLASS;GROUPS_LDAP_USER_OBJECTCLASS" desc:"The object class to use for users in the default user search filter ('inetOrgPerson')."` + GroupObjectClass string `yaml:"group_object_class" env:"LDAP_GROUP_OBJECTCLASS;GROUPS_LDAP_GROUP_OBJECTCLASS" desc:"The object class to use for groups in the default group search filter ('groupOfNames')."` + IDP string `yaml:"idp" env:"OCIS_URL;OCIS_OIDC_ISSUER;GROUPS_IDP_URL" desc:"The identity provider value to set in the group IDs of the CS3 group objects for groups returned by this group provider."` + UserSchema LDAPUserSchema `yaml:"user_schema"` + GroupSchema LDAPGroupSchema `yaml:"group_schema"` } type LDAPUserSchema struct { diff --git a/services/groups/pkg/config/defaults/defaultconfig.go b/services/groups/pkg/config/defaults/defaultconfig.go index 4f65742b895..ec5cedf544e 100644 --- a/services/groups/pkg/config/defaults/defaultconfig.go +++ b/services/groups/pkg/config/defaults/defaultconfig.go @@ -36,19 +36,20 @@ func DefaultConfig() *config.Config { Driver: "ldap", Drivers: config.Drivers{ LDAP: config.LDAPDriver{ - URI: "ldaps://localhost:9235", - CACert: filepath.Join(defaults.BaseDataPath(), "idm", "ldap.crt"), - Insecure: false, - UserBaseDN: "ou=users,o=libregraph-idm", - GroupBaseDN: "ou=groups,o=libregraph-idm", - UserScope: "sub", - GroupScope: "sub", - UserFilter: "", - GroupFilter: "", - UserObjectClass: "inetOrgPerson", - GroupObjectClass: "groupOfNames", - BindDN: "uid=reva,ou=sysusers,o=libregraph-idm", - IDP: "https://localhost:9200", + URI: "ldaps://localhost:9235", + CACert: filepath.Join(defaults.BaseDataPath(), "idm", "ldap.crt"), + Insecure: false, + UserBaseDN: "ou=users,o=libregraph-idm", + GroupBaseDN: "ou=groups,o=libregraph-idm", + UserScope: "sub", + GroupScope: "sub", + GroupSubstringFilterType: "initial", + UserFilter: "", + GroupFilter: "", + UserObjectClass: "inetOrgPerson", + GroupObjectClass: "groupOfNames", + BindDN: "uid=reva,ou=sysusers,o=libregraph-idm", + IDP: "https://localhost:9200", UserSchema: config.LDAPUserSchema{ ID: "ownclouduuid", Mail: "mail", diff --git a/services/groups/pkg/revaconfig/config.go b/services/groups/pkg/revaconfig/config.go index 7e6d7fc4306..e5d048abf22 100644 --- a/services/groups/pkg/revaconfig/config.go +++ b/services/groups/pkg/revaconfig/config.go @@ -50,20 +50,21 @@ func GroupsConfigFromStruct(cfg *config.Config) map[string]interface{} { func ldapConfigFromString(cfg config.LDAPDriver) map[string]interface{} { return map[string]interface{}{ - "uri": cfg.URI, - "cacert": cfg.CACert, - "insecure": cfg.Insecure, - "bind_username": cfg.BindDN, - "bind_password": cfg.BindPassword, - "user_base_dn": cfg.UserBaseDN, - "group_base_dn": cfg.GroupBaseDN, - "user_scope": cfg.UserScope, - "group_scope": cfg.GroupScope, - "user_filter": cfg.UserFilter, - "group_filter": cfg.GroupFilter, - "user_objectclass": cfg.UserObjectClass, - "group_objectclass": cfg.GroupObjectClass, - "idp": cfg.IDP, + "uri": cfg.URI, + "cacert": cfg.CACert, + "insecure": cfg.Insecure, + "bind_username": cfg.BindDN, + "bind_password": cfg.BindPassword, + "user_base_dn": cfg.UserBaseDN, + "group_base_dn": cfg.GroupBaseDN, + "user_scope": cfg.UserScope, + "group_scope": cfg.GroupScope, + "group_substring_filter_type": cfg.GroupSubstringFilterType, + "user_filter": cfg.UserFilter, + "group_filter": cfg.GroupFilter, + "user_objectclass": cfg.UserObjectClass, + "group_objectclass": cfg.GroupObjectClass, + "idp": cfg.IDP, "user_schema": map[string]interface{}{ "id": cfg.UserSchema.ID, "idIsOctetString": cfg.UserSchema.IDIsOctetString, diff --git a/services/settings/package.json b/services/settings/package.json index 87f091b610c..36fa8a74dc5 100644 --- a/services/settings/package.json +++ b/services/settings/package.json @@ -64,7 +64,7 @@ "eslint": "^8.19.0", "eslint-config-standard": "^17.0.0", "eslint-plugin-import": "^2.26.0", - "eslint-plugin-n": "^15.2.3", + "eslint-plugin-n": "^15.2.4", "eslint-plugin-node": "11.1.0", "eslint-plugin-promise": "^6.0.0", "eslint-plugin-unused-imports": "^2.0.0", diff --git a/services/settings/yarn.lock b/services/settings/yarn.lock index 54b8cca07ce..53394a39098 100644 --- a/services/settings/yarn.lock +++ b/services/settings/yarn.lock @@ -1139,7 +1139,7 @@ "@jridgewell/set-array" "^1.0.0" "@jridgewell/sourcemap-codec" "^1.4.10" -"@jridgewell/gen-mapping@^0.3.2": +"@jridgewell/gen-mapping@^0.3.0", "@jridgewell/gen-mapping@^0.3.2": version "0.3.2" resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.2.tgz#c1aedc61e853f2bb9f5dfe6d4442d3b565b253b9" integrity sha512-mh65xKQAzI6iBcFzwv28KVWSmCkdRBWoOh+bYQGW3+6OZvbbN3TqMGo5hqYxQniRcH9F2VZIoJCm4pa3BPDK/A== @@ -1149,15 +1149,23 @@ "@jridgewell/trace-mapping" "^0.3.9" "@jridgewell/resolve-uri@^3.0.3": - version "3.0.8" - resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.0.8.tgz#687cc2bbf243f4e9a868ecf2262318e2658873a1" - integrity sha512-YK5G9LaddzGbcucK4c8h5tWFmMPBvRZ/uyWmN1/SbBdIvqGUdWGkJ5BAaccgs6XbzVLsqbPJrBSFwKv3kT9i7w== + version "3.1.0" + resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz#2203b118c157721addfe69d47b70465463066d78" + integrity sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w== "@jridgewell/set-array@^1.0.0", "@jridgewell/set-array@^1.0.1": version "1.1.2" resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.1.2.tgz#7c6cf998d6d20b914c0a55a91ae928ff25965e72" integrity sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw== +"@jridgewell/source-map@^0.3.2": + version "0.3.2" + resolved "https://registry.yarnpkg.com/@jridgewell/source-map/-/source-map-0.3.2.tgz#f45351aaed4527a298512ec72f81040c998580fb" + integrity sha512-m7O9o2uR8k2ObDysZYzdfhb08VuEml5oWGiosa1VdaPZ/A6QyPkAJuwN0Q1lhULOf6B7MtQmHENS743hWtCrgw== + dependencies: + "@jridgewell/gen-mapping" "^0.3.0" + "@jridgewell/trace-mapping" "^0.3.9" + "@jridgewell/sourcemap-codec@^1.4.10": version "1.4.14" resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz#add4c98d341472a289190b424efbdb096991bb24" @@ -1538,12 +1546,7 @@ acorn@^7.1.1, acorn@^7.4.0: resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.4.1.tgz#feaed255973d2e77555b83dbc08851a6c63520fa" integrity sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A== -acorn@^8.7.0: - version "8.7.0" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.7.0.tgz#90951fde0f8f09df93549481e5fc141445b791cf" - integrity sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ== - -acorn@^8.7.1: +acorn@^8.5.0, acorn@^8.7.0, acorn@^8.7.1: version "8.7.1" resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.7.1.tgz#0197122c843d1bf6d0a5e83220a788f278f63c30" integrity sha512-Xx54uLJQZ19lKygFXOWsscKUbsBZW0CPykPhVQdhIeIwrbPmJzqeASDInc8nKBnp/JT6igTs82qPXz069H8I/A== @@ -3349,10 +3352,10 @@ eslint-plugin-import@^2.26.0: resolve "^1.22.0" tsconfig-paths "^3.14.1" -eslint-plugin-n@^15.2.3: - version "15.2.3" - resolved "https://registry.yarnpkg.com/eslint-plugin-n/-/eslint-plugin-n-15.2.3.tgz#b8850b90a8c27d3d880521ad90dbf537ac0a9830" - integrity sha512-H+KC7U5R+3IWTeRnACm/4wlqLvS1Q7M6t7BGhn89qXDkZan8HTAEv3ouIONA0ifDwc2YzPFmyPzHuNLddNK4jw== +eslint-plugin-n@^15.2.4: + version "15.2.4" + resolved "https://registry.yarnpkg.com/eslint-plugin-n/-/eslint-plugin-n-15.2.4.tgz#d62021a0821ae650701ed459756aaf478a9b6056" + integrity sha512-tjnVMv2fiXYMnuiIFI8QMtyUFI42SckEEWvi8h68SWGWshfqO6SSCASy24dGMGAiy7NUk6DZt90DM0iNUsmQ5w== dependencies: builtins "^5.0.1" eslint-plugin-es "^4.1.0" @@ -4513,21 +4516,7 @@ is-callable@^1.1.4, is-callable@^1.2.3, is-callable@^1.2.4: resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.2.4.tgz#47301d58dd0259407865547853df6d61fe471945" integrity sha512-nsuwtxZfMX67Oryl9LCQ+upnC0Z0BgpwntpS89m1H/TLF0zNfzfLMV/9Wa/6MZsj0acpEjAO0KF1xT6ZdLl95w== -is-core-module@^2.2.0: - version "2.6.0" - resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.6.0.tgz#d7553b2526fe59b92ba3e40c8df757ec8a709e19" - integrity sha512-wShG8vs60jKfPWpF2KZRaAtvt3a20OAn7+IJ6hLPECpSABLcKtFKTTI4ZtH5QcBruBHlq+WsdHWyz0BCZW7svQ== - dependencies: - has "^1.0.3" - -is-core-module@^2.5.0: - version "2.8.1" - resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.8.1.tgz#f59fdfca701d5879d0a6b100a40aa1560ce27211" - integrity sha512-SdNCUs284hr40hFTFP6l0IfZ/RSrMXF3qgoRHd3/79unUTvrFO/JoXwkGm+5J/Oe3E/b5GsnG330uUNgRpu1PA== - dependencies: - has "^1.0.3" - -is-core-module@^2.8.1, is-core-module@^2.9.0: +is-core-module@^2.5.0, is-core-module@^2.8.1, is-core-module@^2.9.0: version "2.9.0" resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.9.0.tgz#e1c34429cd51c6dd9e09e0799e396e27b19a9c69" integrity sha512-+5FPy5PnwmO3lvfMb0AsoPaBG+5KHUI0wYFXOtYPnVVVspTFUuMZNfNaNVRt3FZadstu2c8x23vykRW/NBoU6A== @@ -6163,7 +6152,7 @@ path-key@^3.1.0: resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== -path-parse@^1.0.6, path-parse@^1.0.7: +path-parse@^1.0.7: version "1.0.7" resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== @@ -6914,15 +6903,7 @@ resolve-url@^0.2.1: resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a" integrity sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo= -resolve@^1.10.1, resolve@^1.11.1, resolve@^1.14.2, resolve@^1.15.1, resolve@^1.17.0, resolve@^1.19.0, resolve@^1.20.0: - version "1.20.0" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.20.0.tgz#629a013fb3f70755d6f0b7935cc1c2c5378b1975" - integrity sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A== - dependencies: - is-core-module "^2.2.0" - path-parse "^1.0.6" - -resolve@^1.22.0: +resolve@^1.10.1, resolve@^1.11.1, resolve@^1.14.2, resolve@^1.15.1, resolve@^1.17.0, resolve@^1.19.0, resolve@^1.20.0, resolve@^1.22.0: version "1.22.0" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.0.tgz#5e0b8c67c15df57a89bdbabe603a002f21731198" integrity sha512-Hhtrw0nLeSrFQ7phPp4OOcVjLPIeMnRlr5mcnVuMe7M/7eBn98A3hmFRLoFo3DLZkivSYwhRUJTyPyWAk56WLw== @@ -7277,7 +7258,7 @@ source-map-resolve@^0.5.2: source-map-url "^0.4.0" urix "^0.1.0" -source-map-support@0.5.19, source-map-support@^0.5.16, source-map-support@~0.5.19: +source-map-support@0.5.19: version "0.5.19" resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.19.tgz#a98b62f86dcaf4f67399648c085291ab9e8fed61" integrity sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw== @@ -7285,6 +7266,14 @@ source-map-support@0.5.19, source-map-support@^0.5.16, source-map-support@~0.5.1 buffer-from "^1.0.0" source-map "^0.6.0" +source-map-support@^0.5.16, source-map-support@~0.5.20: + version "0.5.21" + resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.21.tgz#04fe7c7f9e1ed2d662233c28cb2b35b9f63f6e4f" + integrity sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w== + dependencies: + buffer-from "^1.0.0" + source-map "^0.6.0" + source-map-url@^0.4.0: version "0.4.1" resolved "https://registry.yarnpkg.com/source-map-url/-/source-map-url-0.4.1.tgz#0af66605a745a5a2f91cf1bbf8a7afbc283dec56" @@ -7300,7 +7289,7 @@ source-map@0.6.*, source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.0, sourc resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== -source-map@0.7.3, source-map@^0.7.3, source-map@~0.7.2: +source-map@0.7.3, source-map@^0.7.3: version "0.7.3" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.7.3.tgz#5302f8169031735226544092e64981f751750383" integrity sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ== @@ -7705,13 +7694,14 @@ tcp-port-used@^1.0.1: is2 "^2.0.6" terser@^5.0.0, terser@^5.6.0: - version "5.7.2" - resolved "https://registry.yarnpkg.com/terser/-/terser-5.7.2.tgz#d4d95ed4f8bf735cb933e802f2a1829abf545e3f" - integrity sha512-0Omye+RD4X7X69O0eql3lC4Heh/5iLj3ggxR/B5ketZLOtLiOqukUgjw3q4PDnNQbsrkKr3UMypqStQG3XKRvw== + version "5.14.2" + resolved "https://registry.yarnpkg.com/terser/-/terser-5.14.2.tgz#9ac9f22b06994d736174f4091aa368db896f1c10" + integrity sha512-oL0rGeM/WFQCUd0y2QrWxYnq7tfSuKBiqTjRPWrRgB46WD/kiwHwF8T23z78H6Q6kGCuuHcPB+KULHRdxvVGQA== dependencies: + "@jridgewell/source-map" "^0.3.2" + acorn "^8.5.0" commander "^2.20.0" - source-map "~0.7.2" - source-map-support "~0.5.19" + source-map-support "~0.5.20" text-table@^0.2.0: version "0.2.0" diff --git a/services/users/pkg/config/config.go b/services/users/pkg/config/config.go index 38da71eccd3..269151597ba 100644 --- a/services/users/pkg/config/config.go +++ b/services/users/pkg/config/config.go @@ -69,22 +69,23 @@ type JSONDriver struct { File string `yaml:"file"` } type LDAPDriver struct { - URI string `yaml:"uri" env:"LDAP_URI;USERS_LDAP_URI" desc:"URI of the LDAP Server to connect to. Supported URI schemes are 'ldaps://' and 'ldap://'"` - CACert string `yaml:"ca_cert" env:"LDAP_CACERT;USERS_LDAP_CACERT" desc:"Path to a CA certificate file for validating the LDAP server's TLS certificate. If empty the system default CA bundle will be used."` - Insecure bool `yaml:"insecure" env:"LDAP_INSECURE;USERS_LDAP_INSECURE" desc:"Disable TLS certificate validation for the LDAP connections. Do not set this in production environments."` - BindDN string `yaml:"bind_dn" env:"LDAP_BIND_DN;USERS_LDAP_BIND_DN" desc:"LDAP DN to use for simple bind authentication with the target LDAP server."` - BindPassword string `yaml:"bind_password" env:"LDAP_BIND_PASSWORD;USERS_LDAP_BIND_PASSWORD" desc:"Password to use for authenticating the 'bind_dn'."` - UserBaseDN string `yaml:"user_base_dn" env:"LDAP_USER_BASE_DN;USERS_LDAP_USER_BASE_DN" desc:"Search base DN for looking up LDAP users."` - GroupBaseDN string `yaml:"group_base_dn" env:"LDAP_GROUP_BASE_DN;USERS_LDAP_GROUP_BASE_DN" desc:"Search base DN for looking up LDAP groups."` - UserScope string `yaml:"user_scope" env:"LDAP_USER_SCOPE;USERS_LDAP_USER_SCOPE" desc:"LDAP search scope to use when looking up users. Supported values are 'base', 'one' and 'sub'."` - GroupScope string `yaml:"group_scope" env:"LDAP_GROUP_SCOPE;USERS_LDAP_GROUP_SCOPE" desc:"LDAP search scope to use when looking up groups. Supported values are 'base', 'one' and 'sub'."` - UserFilter string `yaml:"user_filter" env:"LDAP_USER_FILTER;USERS_LDAP_USER_FILTER" desc:"LDAP filter to add to the default filters for user search like '(objectclass=ownCloud)'."` - GroupFilter string `yaml:"group_filter" env:"LDAP_GROUP_FILTER;USERS_LDAP_GROUP_FILTER" desc:"LDAP filter to add to the default filters for group searches."` - UserObjectClass string `yaml:"user_object_class" env:"LDAP_USER_OBJECTCLASS;USERS_LDAP_USER_OBJECTCLASS" desc:"The object class to use for users in the default user search filter like 'inetOrgPerson'."` - GroupObjectClass string `yaml:"group_object_class" env:"LDAP_GROUP_OBJECTCLASS;USERS_LDAP_GROUP_OBJECTCLASS" desc:"The object class to use for groups in the default group search filter like 'groupOfNames'. "` - IDP string `yaml:"idp" env:"OCIS_URL;OCIS_OIDC_ISSUER;USERS_IDP_URL" desc:"The identity provider value to set in the userids of the CS3 user objects for users returned by this user provider."` - UserSchema LDAPUserSchema `yaml:"user_schema"` - GroupSchema LDAPGroupSchema `yaml:"group_schema"` + URI string `yaml:"uri" env:"LDAP_URI;USERS_LDAP_URI" desc:"URI of the LDAP Server to connect to. Supported URI schemes are 'ldaps://' and 'ldap://'"` + CACert string `yaml:"ca_cert" env:"LDAP_CACERT;USERS_LDAP_CACERT" desc:"Path to a CA certificate file for validating the LDAP server's TLS certificate. If empty, the system default CA bundle will be used."` + Insecure bool `yaml:"insecure" env:"LDAP_INSECURE;USERS_LDAP_INSECURE" desc:"Disable TLS certificate validation for the LDAP connections. Do not set this in production environments."` + BindDN string `yaml:"bind_dn" env:"LDAP_BIND_DN;USERS_LDAP_BIND_DN" desc:"LDAP DN to use for simple bind authentication with the target LDAP server."` + BindPassword string `yaml:"bind_password" env:"LDAP_BIND_PASSWORD;USERS_LDAP_BIND_PASSWORD" desc:"Password to use for authenticating the 'bind_dn'."` + UserBaseDN string `yaml:"user_base_dn" env:"LDAP_USER_BASE_DN;USERS_LDAP_USER_BASE_DN" desc:"Search base DN for looking up LDAP users."` + GroupBaseDN string `yaml:"group_base_dn" env:"LDAP_GROUP_BASE_DN;USERS_LDAP_GROUP_BASE_DN" desc:"Search base DN for looking up LDAP groups."` + UserScope string `yaml:"user_scope" env:"LDAP_USER_SCOPE;USERS_LDAP_USER_SCOPE" desc:"LDAP search scope to use when looking up users. Supported values are 'base', 'one' and 'sub'."` + GroupScope string `yaml:"group_scope" env:"LDAP_GROUP_SCOPE;USERS_LDAP_GROUP_SCOPE" desc:"LDAP search scope to use when looking up groups. Supported values are 'base', 'one' and 'sub'."` + UserSubstringFilterType string `yaml:"user_substring_filter_type" env:"LDAP_USER_SUBSTRING_FILTER_TYPE;USERS_LDAP_USER_SUBSTRING_FILTER_TYPE" desc:"Type of substring search filter to use for substring searches for users. Possible values: 'initial' for doing prefix only searches, 'final' for doing suffix only searches or 'any' for doing full substring searches"` + UserFilter string `yaml:"user_filter" env:"LDAP_USER_FILTER;USERS_LDAP_USER_FILTER" desc:"LDAP filter to add to the default filters for user search like '(objectclass=ownCloud)'."` + GroupFilter string `yaml:"group_filter" env:"LDAP_GROUP_FILTER;USERS_LDAP_GROUP_FILTER" desc:"LDAP filter to add to the default filters for group searches."` + UserObjectClass string `yaml:"user_object_class" env:"LDAP_USER_OBJECTCLASS;USERS_LDAP_USER_OBJECTCLASS" desc:"The object class to use for users in the default user search filter like 'inetOrgPerson'."` + GroupObjectClass string `yaml:"group_object_class" env:"LDAP_GROUP_OBJECTCLASS;USERS_LDAP_GROUP_OBJECTCLASS" desc:"The object class to use for groups in the default group search filter like 'groupOfNames'. "` + IDP string `yaml:"idp" env:"OCIS_URL;OCIS_OIDC_ISSUER;USERS_IDP_URL" desc:"The identity provider value to set in the userids of the CS3 user objects for users returned by this user provider."` + UserSchema LDAPUserSchema `yaml:"user_schema"` + GroupSchema LDAPGroupSchema `yaml:"group_schema"` } type LDAPUserSchema struct { diff --git a/services/users/pkg/config/defaults/defaultconfig.go b/services/users/pkg/config/defaults/defaultconfig.go index 9353387d166..b6f43113d56 100644 --- a/services/users/pkg/config/defaults/defaultconfig.go +++ b/services/users/pkg/config/defaults/defaultconfig.go @@ -36,19 +36,20 @@ func DefaultConfig() *config.Config { Driver: "ldap", Drivers: config.Drivers{ LDAP: config.LDAPDriver{ - URI: "ldaps://localhost:9235", - CACert: filepath.Join(defaults.BaseDataPath(), "idm", "ldap.crt"), - Insecure: false, - UserBaseDN: "ou=users,o=libregraph-idm", - GroupBaseDN: "ou=groups,o=libregraph-idm", - UserScope: "sub", - GroupScope: "sub", - UserFilter: "", - GroupFilter: "", - UserObjectClass: "inetOrgPerson", - GroupObjectClass: "groupOfNames", - BindDN: "uid=reva,ou=sysusers,o=libregraph-idm", - IDP: "https://localhost:9200", + URI: "ldaps://localhost:9235", + CACert: filepath.Join(defaults.BaseDataPath(), "idm", "ldap.crt"), + Insecure: false, + UserBaseDN: "ou=users,o=libregraph-idm", + GroupBaseDN: "ou=groups,o=libregraph-idm", + UserScope: "sub", + GroupScope: "sub", + UserSubstringFilterType: "initial", + UserFilter: "", + GroupFilter: "", + UserObjectClass: "inetOrgPerson", + GroupObjectClass: "groupOfNames", + BindDN: "uid=reva,ou=sysusers,o=libregraph-idm", + IDP: "https://localhost:9200", UserSchema: config.LDAPUserSchema{ ID: "ownclouduuid", Mail: "mail", diff --git a/services/users/pkg/revaconfig/config.go b/services/users/pkg/revaconfig/config.go index 434daf23d37..187381c020f 100644 --- a/services/users/pkg/revaconfig/config.go +++ b/services/users/pkg/revaconfig/config.go @@ -52,20 +52,21 @@ func UsersConfigFromStruct(cfg *config.Config) map[string]interface{} { func ldapConfigFromString(cfg config.LDAPDriver) map[string]interface{} { return map[string]interface{}{ - "uri": cfg.URI, - "cacert": cfg.CACert, - "insecure": cfg.Insecure, - "bind_username": cfg.BindDN, - "bind_password": cfg.BindPassword, - "user_base_dn": cfg.UserBaseDN, - "group_base_dn": cfg.GroupBaseDN, - "user_scope": cfg.UserScope, - "group_scope": cfg.GroupScope, - "user_filter": cfg.UserFilter, - "group_filter": cfg.GroupFilter, - "user_objectclass": cfg.UserObjectClass, - "group_objectclass": cfg.GroupObjectClass, - "idp": cfg.IDP, + "uri": cfg.URI, + "cacert": cfg.CACert, + "insecure": cfg.Insecure, + "bind_username": cfg.BindDN, + "bind_password": cfg.BindPassword, + "user_base_dn": cfg.UserBaseDN, + "group_base_dn": cfg.GroupBaseDN, + "user_scope": cfg.UserScope, + "group_scope": cfg.GroupScope, + "user_substring_filter_type": cfg.UserSubstringFilterType, + "user_filter": cfg.UserFilter, + "group_filter": cfg.GroupFilter, + "user_objectclass": cfg.UserObjectClass, + "group_objectclass": cfg.GroupObjectClass, + "idp": cfg.IDP, "user_schema": map[string]interface{}{ "id": cfg.UserSchema.ID, "idIsOctetString": cfg.UserSchema.IDIsOctetString, diff --git a/tests/acceptance/expected-failures-API-on-OCIS-storage.md b/tests/acceptance/expected-failures-API-on-OCIS-storage.md index aa076ab4363..bec2ae20419 100644 --- a/tests/acceptance/expected-failures-API-on-OCIS-storage.md +++ b/tests/acceptance/expected-failures-API-on-OCIS-storage.md @@ -408,12 +408,6 @@ File and sync features in a shared scenario #### [Searching sharee with displayname](https://github.com/owncloud/ocis/issues/547) -- [apiSharees/sharees.feature:32](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiSharees/sharees.feature#L32) -- [apiSharees/sharees.feature:33](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiSharees/sharees.feature#L33) -- [apiSharees/sharees.feature:54](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiSharees/sharees.feature#L54) -- [apiSharees/sharees.feature:55](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiSharees/sharees.feature#L55) -- [apiSharees/sharees.feature:100](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiSharees/sharees.feature#L100) -- [apiSharees/sharees.feature:101](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiSharees/sharees.feature#L101) - [apiSharees/sharees.feature:350](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiSharees/sharees.feature#L350) - [apiSharees/sharees.feature:351](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiSharees/sharees.feature#L351) - [apiSharees/sharees.feature:370](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiSharees/sharees.feature#L370) @@ -424,12 +418,6 @@ File and sync features in a shared scenario - [apiSharees/sharees.feature:411](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiSharees/sharees.feature#L411) - [apiSharees/sharees.feature:430](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiSharees/sharees.feature#L430) - [apiSharees/sharees.feature:431](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiSharees/sharees.feature#L431) -- [apiSharees/sharees.feature:583](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiSharees/sharees.feature#L583) -- [apiSharees/sharees.feature:584](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiSharees/sharees.feature#L584) -- [apiSharees/sharees.feature:655](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiSharees/sharees.feature#L655) -- [apiSharees/sharees.feature:656](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiSharees/sharees.feature#L656) -- [apiSharees/sharees.feature:680](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiSharees/sharees.feature#L680) -- [apiSharees/sharees.feature:681](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiSharees/sharees.feature#L681) #### User cannot create a folder named Share diff --git a/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md b/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md index 585034e0048..f1c77d3cdb7 100644 --- a/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md +++ b/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md @@ -25,3 +25,11 @@ The expected failures in this file are from features in the owncloud/ocis repo. ### [Space Admin still has access to the project despite being removed from it](https://github.com/owncloud/ocis/issues/4127) - [apiSpaces/shareSpaces.feature:77](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/shareSpaces.feature#L77) - [apiSpaces/shareSpaces.feature:78](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/shareSpaces.feature#L78) + +### [Depth infinity not supported for space Shares Jail](https://github.com/owncloud/ocis/issues/4188) +- [apiSpaces/copySpaces.feature:112](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/copySpaces.feature#L112) +- [apiSpaces/copySpaces.feature:113](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/copySpaces.feature#L113) +- [apiSpaces/copySpaces.feature:114](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/copySpaces.feature#L114) +- [apiSpaces/copySpaces.feature:163](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/copySpaces.feature#L163) +- [apiSpaces/copySpaces.feature:260](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/copySpaces.feature#L260) +- [apiSpaces/copySpaces.feature:261](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/copySpaces.feature#L261) diff --git a/tests/acceptance/expected-failures-webUI-on-OCIS-storage.md b/tests/acceptance/expected-failures-webUI-on-OCIS-storage.md index 32587f2d1ea..59d3cd7146b 100644 --- a/tests/acceptance/expected-failures-webUI-on-OCIS-storage.md +++ b/tests/acceptance/expected-failures-webUI-on-OCIS-storage.md @@ -68,11 +68,9 @@ Other free text and markdown formatting can be used elsewhere in the document if - [webUISharingAutocompletion/shareAutocompletion.feature:168](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUISharingAutocompletion/shareAutocompletion.feature#L168) - [webUISharingAutocompletion/shareAutocompletionSpecialChars.feature:55](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUISharingAutocompletion/shareAutocompletionSpecialChars.feature#L55) - [webUISharingAutocompletion/shareAutocompletionSpecialChars.feature:56](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUISharingAutocompletion/shareAutocompletionSpecialChars.feature#L56) -- [webUISharingAutocompletion/shareAutocompletionSpecialChars.feature:57](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUISharingAutocompletion/shareAutocompletionSpecialChars.feature#L57) - [webUISharingAutocompletion/shareAutocompletionSpecialChars.feature:73](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUISharingAutocompletion/shareAutocompletionSpecialChars.feature#L73) - [webUISharingAutocompletion/shareAutocompletionSpecialChars.feature:74](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUISharingAutocompletion/shareAutocompletionSpecialChars.feature#L74) - [webUISharingAutocompletion/shareAutocompletionSpecialChars.feature:75](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUISharingAutocompletion/shareAutocompletionSpecialChars.feature#L75) -- [webUISharingAutocompletion/shareAutocompletionSpecialChars.feature:76](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUISharingAutocompletion/shareAutocompletionSpecialChars.feature#L76) ### [Minimum of three characters required for autocompletion](https://github.com/owncloud/ocis/issues/1961) - [webUISharingAutocompletion/shareAutocompletion.feature:32](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUISharingAutocompletion/shareAutocompletion.feature#L32) diff --git a/tests/acceptance/features/apiSpaces/copySpaces.feature b/tests/acceptance/features/apiSpaces/copySpaces.feature new file mode 100644 index 00000000000..03711d0f0a2 --- /dev/null +++ b/tests/acceptance/features/apiSpaces/copySpaces.feature @@ -0,0 +1,281 @@ +@api @skipOnOcV10 +Feature: copy file + As a user + I want to be able to copy files + So that I can manage my files + + Background: + Given these users have been created with default attributes and without skeleton files: + | username | + | Alice | + | Brian | + + + Scenario Outline: Copying a file within a same space project with role manager and editor + Given the administrator has given "Alice" the role "Space Admin" using the settings api + And user "Alice" has created a space "Project" with the default quota using the GraphApi + And user "Alice" has created a folder "newfolder" in space "Project" + And user "Alice" has uploaded a file inside space "Project" with content "some content" to "insideSpace.txt" + And user "Alice" has shared a space "Project" to user "Brian" with role "" + When user "Brian" copies file "insideSpace.txt" to "/newfolder/insideSpace.txt" inside space "Project" using the WebDAV API + Then the HTTP status code should be "201" + And for user "Brian" the space "Project" should contain these entries: + | newfolder/insideSpace.txt | + And for user "Alice" the content of the file "newfolder/insideSpace.txt" of the space "Project" should be "some content" + Examples: + | role | + | manager | + | editor | + + + Scenario: Copying a file within a same space project with role viewer + Given the administrator has given "Alice" the role "Space Admin" using the settings api + And user "Alice" has created a space "Project" with the default quota using the GraphApi + And user "Alice" has created a folder "newfolder" in space "Project" + And user "Alice" has uploaded a file inside space "Project" with content "some content" to "insideSpace.txt" + And user "Alice" has shared a space "Project" to user "Brian" with role "viewer" + When user "Brian" copies file "insideSpace.txt" to "newfolder/insideSpace.txt" inside space "Project" using the WebDAV API + Then the HTTP status code should be "403" + And for user "Brian" the space "Project" should not contain these entries: + | newfolder/insideSpace.txt | + + + Scenario Outline: User copies a file from a space project with a different role to a space project with the manager role + Given the administrator has given "Brian" the role "Space Admin" using the settings api + And user "Brian" has created a space "Project1" with the default quota using the GraphApi + And user "Brian" has created a space "Project2" with the default quota using the GraphApi + And user "Brian" has uploaded a file inside space "Project1" with content "Project1 content" to "project1.txt" + And user "Brian" has shared a space "Project2" to user "Alice" with role "" + And user "Brian" has shared a space "Project1" to user "Alice" with role "" + When user "Alice" copies file "project1.txt" from space "Project1" to "project1.txt" inside space "Project2" using the WebDAV API + Then the HTTP status code should be "201" + And for user "Alice" the space "Project2" should contain these entries: + | project1.txt | + And for user "Alice" the content of the file "project1.txt" of the space "Project2" should be "Project1 content" + Examples: + | from_role | to_role | + | manager | manager | + | manager | editor | + | editor | manager | + | editor | editor | + + + Scenario Outline: User copies a file from a space project with a different role to a space project with a viewer role + Given the administrator has given "Brian" the role "Space Admin" using the settings api + And user "Brian" has created a space "Project1" with the default quota using the GraphApi + And user "Brian" has created a space "Project2" with the default quota using the GraphApi + And user "Brian" has uploaded a file inside space "Project1" with content "Project1 content" to "project1.txt" + And user "Brian" has shared a space "Project2" to user "Alice" with role "viewer" + And user "Brian" has shared a space "Project1" to user "Alice" with role "" + When user "Alice" copies file "project1.txt" from space "Project1" to "project1.txt" inside space "Project2" using the WebDAV API + Then the HTTP status code should be "403" + And for user "Alice" the space "Project2" should not contain these entries: + | project1.txt | + Examples: + | role | + | manager | + | editor | + + + Scenario Outline: User copies a file from space project with different role to space personal + Given the administrator has given "Brian" the role "Space Admin" using the settings api + And user "Brian" has created a space "Project" with the default quota using the GraphApi + And user "Brian" has uploaded a file inside space "Project" with content "Project content" to "project.txt" + And user "Brian" has shared a space "Project" to user "Alice" with role "" + When user "Alice" copies file "project.txt" from space "Project" to "project.txt" inside space "Personal" using the WebDAV API + Then the HTTP status code should be "201" + And for user "Alice" the space "Personal" should contain these entries: + | project.txt | + And for user "Alice" the content of the file "project.txt" of the space "Personal" should be "Project content" + Examples: + | role | + | manager | + | editor | + | viewer | + + + Scenario Outline: User copies a file from space project with different role to space shares jail with editor role + Given the administrator has given "Brian" the role "Space Admin" using the settings api + And user "Brian" has created a space "Project" with the default quota using the GraphApi + And user "Brian" has created folder "/testshare" + And user "Brian" has uploaded a file inside space "Project" with content "Project content" to "project.txt" + And user "Brian" has shared a space "Project" to user "Alice" with role "" + And user "Brian" has shared folder "/testshare" with user "Alice" with permissions "31" + And user "Alice" has accepted share "/testshare" offered by user "Brian" + When user "Alice" copies file "project.txt" from space "Project" to "/testshare/project.txt" inside space "Shares Jail" using the WebDAV API + Then the HTTP status code should be "201" + And for user "Alice" the space "Shares Jail" should contain these entries: + | /testshare/project.txt | + And for user "Alice" the content of the file "/testshare/project.txt" of the space "Shares Jail" should be "Project content" + Examples: + | role | + | manager | + | editor | + | viewer | + + + Scenario Outline: User copies a file from space project with different role to shares jail with viewer role + Given the administrator has given "Brian" the role "Space Admin" using the settings api + And user "Brian" has created a space "Project" with the default quota using the GraphApi + And user "Brian" has created folder "/testshare" + And user "Brian" has uploaded a file inside space "Project" with content "Project content" to "project.txt" + And user "Brian" has shared a space "Project" to user "Alice" with role "" + And user "Brian" has shared folder "/testshare" with user "Alice" with permissions "17" + And user "Alice" has accepted share "/testshare" offered by user "Brian" + When user "Alice" copies file "project.txt" from space "Project" to "/testshare/project.txt" inside space "Shares Jail" using the WebDAV API + Then the HTTP status code should be "403" + And for user "Alice" the space "Shares Jail" should not contain these entries: + | /testshare/project.txt | + Examples: + | role | + | manager | + | editor | + | viewer | + + + Scenario Outline: User copies a file from space personal to space project with different role + Given the administrator has given "Brian" the role "Space Admin" using the settings api + And user "Brian" has created a space "Project" with the default quota using the GraphApi + And user "Brian" has shared a space "Project" to user "Alice" with role "" + And user "Alice" has uploaded file with content "personal space content" to "/personal.txt" + When user "Alice" copies file "personal.txt" from space "Personal" to "personal.txt" inside space "Project" using the WebDAV API + Then the HTTP status code should be "201" + And for user "Alice" the space "Project" should contain these entries: + | personal.txt | + And for user "Alice" the content of the file "personal.txt" of the space "Project" should be "personal space content" + Examples: + | role | + | manager | + | editor | + + + Scenario: User copies a file from space personal to space project with role viewer + Given the administrator has given "Brian" the role "Space Admin" using the settings api + And user "Brian" has created a space "Project" with the default quota using the GraphApi + And user "Brian" has shared a space "Project" to user "Alice" with role "viewer" + And user "Alice" has uploaded file with content "personal space content" to "/personal.txt" + When user "Alice" copies file "personal.txt" from space "Personal" to "personal.txt" inside space "Project" using the WebDAV API + Then the HTTP status code should be "403" + And for user "Alice" the space "Project" should not contain these entries: + | personal.txt | + + + Scenario: User copies a file from space personal to space shares jail with role editor + Given user "Brian" has created folder "/testshare" + And user "Brian" has shared folder "/testshare" with user "Alice" with permissions "31" + And user "Alice" has accepted share "/testshare" offered by user "Brian" + And user "Alice" has uploaded file with content "personal content" to "personal.txt" + When user "Alice" copies file "personal.txt" from space "Personal" to "/testshare/personal.txt" inside space "Shares Jail" using the WebDAV API + Then the HTTP status code should be "201" + And for user "Alice" the space "Shares Jail" should contain these entries: + | /testshare/personal.txt | + And for user "Alice" the content of the file "/testshare/personal.txt" of the space "Shares Jail" should be "personal content" + + + Scenario: User copies a file from space personal to space shares jail with role viewer + Given user "Brian" has created folder "/testshare" + And user "Brian" has shared folder "/testshare" with user "Alice" with permissions "17" + And user "Alice" has accepted share "/testshare" offered by user "Brian" + And user "Alice" has uploaded file with content "personal content" to "personal.txt" + When user "Alice" copies file "personal.txt" from space "Personal" to "/testshare/personal.txt" inside space "Shares Jail" using the WebDAV API + Then the HTTP status code should be "403" + And for user "Alice" the space "Shares Jail" should not contain these entries: + | /testshare/personal.txt | + + + Scenario Outline: User copies a file from space shares jail with different role to space personal + Given the administrator has given "Brian" the role "Space Admin" using the settings api + And user "Brian" has created folder "/testshare" + And user "Brian" has uploaded file with content "testshare content" to "/testshare/testshare.txt" + And user "Brian" has shared folder "/testshare" with user "Alice" with permissions "" + And user "Alice" has accepted share "/testshare" offered by user "Brian" + When user "Alice" copies file "/testshare/testshare.txt" from space "Shares Jail" to "testshare.txt" inside space "Personal" using the WebDAV API + Then the HTTP status code should be "201" + And for user "Alice" the space "Personal" should contain these entries: + | /testshare.txt | + And for user "Alice" the content of the file "/testshare.txt" of the space "Personal" should be "testshare content" + Examples: + | permissions | + | 31 | + | 17 | + + + Scenario Outline: User copies a file from space shares jail with different role to space project with different role + Given the administrator has given "Brian" the role "Space Admin" using the settings api + And user "Brian" has created a space "Project" with the default quota using the GraphApi + And user "Brian" has shared a space "Project" to user "Alice" with role "" + And user "Brian" has created folder "/testshare" + And user "Brian" has uploaded file with content "testshare content" to "/testshare/testshare.txt" + And user "Brian" has shared folder "/testshare" with user "Alice" with permissions "" + And user "Alice" has accepted share "/testshare" offered by user "Brian" + When user "Alice" copies file "/testshare/testshare.txt" from space "Shares Jail" to "testshare.txt" inside space "Project" using the WebDAV API + Then the HTTP status code should be "201" + And for user "Alice" the space "Project" should contain these entries: + | /testshare.txt | + And for user "Alice" the content of the file "testshare.txt" of the space "Project" should be "testshare content" + Examples: + | role | permissions | + | manager | 31 | + | manager | 17 | + | editor | 31 | + | editor | 17 | + + + Scenario Outline: User copies a file from space shares jail with different role to space project with role viewer + Given the administrator has given "Brian" the role "Space Admin" using the settings api + And user "Brian" has created a space "Project" with the default quota using the GraphApi + And user "Brian" has shared a space "Project" to user "Alice" with role "viewer" + And user "Brian" has created folder "/testshare" + And user "Brian" has uploaded file with content "testshare content" to "/testshare/testshare.txt" + And user "Brian" has shared folder "/testshare" with user "Alice" with permissions "" + And user "Alice" has accepted share "/testshare" offered by user "Brian" + When user "Alice" copies file "/testshare/testshare.txt" from space "Shares Jail" to "testshare.txt" inside space "Project" using the WebDAV API + Then the HTTP status code should be "403" + And for user "Alice" the space "Project" should not contain these entries: + | /testshare.txt | + Examples: + | permissions | + | 31 | + | 17 | + + + Scenario Outline: User copies a file from space shares jail with different role to space shares jail with role editor + Given user "Brian" has created folder "/testshare1" + And user "Brian" has created folder "/testshare2" + And user "Brian" has uploaded file with content "testshare1 content" to "/testshare1/testshare1.txt" + And user "Brian" has shared folder "/testshare1" with user "Alice" with permissions "" + And user "Brian" has shared folder "/testshare2" with user "Alice" with permissions "31" + And user "Alice" has accepted share "/testshare1" offered by user "Brian" + And user "Alice" has accepted share "/testshare2" offered by user "Brian" + When user "Alice" copies file "/testshare1/testshare1.txt" from space "Shares Jail" to "/testshare2/testshare1.txt" inside space "Shares Jail" using the WebDAV API + Then the HTTP status code should be "201" + And for user "Alice" the space "Shares Jail" should contain these entries: + | /testshare2/testshare1.txt | + And for user "Brian" the space "Personal" should contain these entries: + | /testshare2/testshare1.txt | + And for user "Alice" the content of the file "/testshare2/testshare1.txt" of the space "Shares Jail" should be "testshare1 content" + And for user "Brian" the content of the file "/testshare1/testshare1.txt" of the space "Personal" should be "testshare1 content" + Examples: + | permissions | + | 31 | + | 17 | + + + Scenario Outline: User copies a file from space shares jail with different role to space shares jail with role editor + Given user "Brian" has created folder "/testshare1" + And user "Brian" has created folder "/testshare2" + And user "Brian" has uploaded file with content "testshare1 content" to "/testshare1/testshare1.txt" + And user "Brian" has shared folder "/testshare1" with user "Alice" with permissions "" + And user "Brian" has shared folder "/testshare2" with user "Alice" with permissions "17" + And user "Alice" has accepted share "/testshare1" offered by user "Brian" + And user "Alice" has accepted share "/testshare2" offered by user "Brian" + When user "Alice" copies file "/testshare1/testshare1.txt" from space "Shares Jail" to "/testshare2/testshare1.txt" inside space "Shares Jail" using the WebDAV API + Then the HTTP status code should be "403" + And for user "Alice" the space "Shares Jail" should not contain these entries: + | /testshare2/testshare1.txt | + And for user "Brian" the space "Personal" should not contain these entries: + | /testshare2/testshare1.txt | + Examples: + | permissions | + | 31 | + | 17 | diff --git a/tests/acceptance/features/bootstrap/SpacesContext.php b/tests/acceptance/features/bootstrap/SpacesContext.php index de2cb86074f..31eaa26d8b5 100644 --- a/tests/acceptance/features/bootstrap/SpacesContext.php +++ b/tests/acceptance/features/bootstrap/SpacesContext.php @@ -781,13 +781,14 @@ class SpacesContext implements Context { Assert::assertIsArray($space); Assert::assertNotEmpty($spaceId = $space["id"]); Assert::assertNotEmpty($spaceWebDavUrl = $space["root"]["webDavUrl"]); + $headers['Depth'] = 'infinity'; $this->featureContext->setResponse( $this->sendPropfindRequestToUrl( $spaceWebDavUrl . '/' . $foldersPath, $user, $this->featureContext->getPasswordForUser($user), "", - [], + $headers, ) ); $this->setResponseSpaceId($spaceId);