diff --git a/.drone.env b/.drone.env index 695105ce3b..f87d485c1e 100644 --- a/.drone.env +++ b/.drone.env @@ -3,5 +3,5 @@ CORE_COMMITID=828075109e7d9b5e55db8b50d311d9a76b89d7e1 CORE_BRANCH=master # The test runner source for UI tests -WEB_COMMITID=94532551d3d89d5d3eeee016e2f0aae9fe919fce +WEB_COMMITID=1318eaad950cbeaaf6e30bcbfe998515a932be23 WEB_BRANCH=master diff --git a/.drone.star b/.drone.star index ee45183aff..7ac4513fe2 100644 --- a/.drone.star +++ b/.drone.star @@ -1260,7 +1260,7 @@ def docs(ctx): { "name": "docs-generate", "image": OC_CI_GOLANG, - "commands": ["make -C %s docs-generate" % (module) for module in config["modules"]], + "commands": ["make -C docs docs-generate"], }, { "name": "prepare", diff --git a/accounts/pkg/config/config.go b/accounts/pkg/config/config.go index 79024993be..9a4609d7e4 100644 --- a/accounts/pkg/config/config.go +++ b/accounts/pkg/config/config.go @@ -25,45 +25,45 @@ type Config struct { Repo Repo `ocisConfig:"repo"` Index Index `ocisConfig:"index"` ServiceUser ServiceUser `ocisConfig:"service_user"` - HashDifficulty int `ocisConfig:"hash_difficulty" env:"ACCOUNTS_HASH_DIFFICULTY"` - DemoUsersAndGroups bool `ocisConfig:"demo_users_and_groups" env:"ACCOUNTS_DEMO_USERS_AND_GROUPS"` + HashDifficulty int `ocisConfig:"hash_difficulty" env:"ACCOUNTS_HASH_DIFFICULTY" desc:"The hash difficulty makes sure that validating a password takes at least a certain amount of time."` + DemoUsersAndGroups bool `ocisConfig:"demo_users_and_groups" env:"ACCOUNTS_DEMO_USERS_AND_GROUPS" desc:"If this flag is set the service will setup the demo users and groups."` Context context.Context } // Asset defines the available asset configuration. type Asset struct { - Path string `ocisConfig:"path" env:"ACCOUNTS_ASSET_PATH"` + Path string `ocisConfig:"path" env:"ACCOUNTS_ASSET_PATH" desc:"The path to the ui assets."` } // TokenManager is the config for using the reva token manager type TokenManager struct { - JWTSecret string `ocisConfig:"jwt_secret" env:"OCIS_JWT_SECRET;ACCOUNTS_JWT_SECRET"` + JWTSecret string `ocisConfig:"jwt_secret" env:"OCIS_JWT_SECRET;ACCOUNTS_JWT_SECRET" desc:"The secret to mint jwt tokens."` } // Repo defines which storage implementation is to be used. type Repo struct { - Backend string `ocisConfig:"backend" env:"ACCOUNTS_STORAGE_BACKEND"` + Backend string `ocisConfig:"backend" env:"ACCOUNTS_STORAGE_BACKEND" desc:"Defines which storage implementation is to be used"` Disk Disk `ocisConfig:"disk"` CS3 CS3 `ocisConfig:"cs3"` } // Disk is the local disk implementation of the storage. type Disk struct { - Path string `ocisConfig:"path" env:"ACCOUNTS_STORAGE_DISK_PATH"` + Path string `ocisConfig:"path" env:"ACCOUNTS_STORAGE_DISK_PATH" desc:"The path where the accounts data is stored."` } // CS3 is the cs3 implementation of the storage. type CS3 struct { - ProviderAddr string `ocisConfig:"provider_addr" env:"ACCOUNTS_STORAGE_CS3_PROVIDER_ADDR"` + ProviderAddr string `ocisConfig:"provider_addr" env:"ACCOUNTS_STORAGE_CS3_PROVIDER_ADDR" desc:"The address to the storage provider."` } // ServiceUser defines the user required for EOS. type ServiceUser struct { - UUID string `ocisConfig:"uuid" env:"ACCOUNTS_SERVICE_USER_UUID"` - Username string `ocisConfig:"username" env:"ACCOUNTS_SERVICE_USER_USERNAME"` - UID int64 `ocisConfig:"uid" env:"ACCOUNTS_SERVICE_USER_UID"` - GID int64 `ocisConfig:"gid" env:"ACCOUNTS_SERVICE_USER_GID"` + UUID string `ocisConfig:"uuid" env:"ACCOUNTS_SERVICE_USER_UUID" desc:"The id of the accounts service user."` + Username string `ocisConfig:"username" env:"ACCOUNTS_SERVICE_USER_USERNAME" desc:"The username of the accounts service user."` + UID int64 `ocisConfig:"uid" env:"ACCOUNTS_SERVICE_USER_UID" desc:"The uid of the accounts service user."` + GID int64 `ocisConfig:"gid" env:"ACCOUNTS_SERVICE_USER_GID" desc:"The gid of the accounts service user."` } // Index defines config for indexes. @@ -74,12 +74,12 @@ type Index struct { // GIDBound defines a lower and upper bound. type GIDBound struct { - Lower int64 `ocisConfig:"lower" env:"ACCOUNTS_GID_INDEX_LOWER_BOUND"` - Upper int64 `ocisConfig:"upper" env:"ACCOUNTS_GID_INDEX_UPPER_BOUND"` + Lower int64 `ocisConfig:"lower" env:"ACCOUNTS_GID_INDEX_LOWER_BOUND" desc:"The lowest possible gid value for the indexer."` + Upper int64 `ocisConfig:"upper" env:"ACCOUNTS_GID_INDEX_UPPER_BOUND" desc:"The highest possible gid value for the indexer."` } // UIDBound defines a lower and upper bound. type UIDBound struct { - Lower int64 `ocisConfig:"lower" env:"ACCOUNTS_UID_INDEX_LOWER_BOUND"` - Upper int64 `ocisConfig:"upper" env:"ACCOUNTS_UID_INDEX_UPPER_BOUND"` + Lower int64 `ocisConfig:"lower" env:"ACCOUNTS_UID_INDEX_LOWER_BOUND" desc:"The lowest possible uid value for the indexer."` + Upper int64 `ocisConfig:"upper" env:"ACCOUNTS_UID_INDEX_UPPER_BOUND" desc:"The highest possible uid value for the indexer."` } diff --git a/accounts/pkg/config/grpc.go b/accounts/pkg/config/grpc.go index f16de42f2b..a89e0ca005 100644 --- a/accounts/pkg/config/grpc.go +++ b/accounts/pkg/config/grpc.go @@ -2,6 +2,6 @@ package config // GRPC defines the available grpc configuration. type GRPC struct { - Addr string `ocisConfig:"addr" env:"ACCOUNTS_GRPC_ADDR"` + Addr string `ocisConfig:"addr" env:"ACCOUNTS_GRPC_ADDR" desc:"The address of the grpc service."` Namespace string } diff --git a/accounts/pkg/config/http.go b/accounts/pkg/config/http.go index c8c7ab628e..6a8828ea9a 100644 --- a/accounts/pkg/config/http.go +++ b/accounts/pkg/config/http.go @@ -2,11 +2,11 @@ package config // HTTP defines the available http configuration. type HTTP struct { - Addr string `ocisConfig:"addr" env:"ACCOUNTS_HTTP_ADDR"` + Addr string `ocisConfig:"addr" env:"ACCOUNTS_HTTP_ADDR" desc:"The address of the http service."` Namespace string - Root string `ocisConfig:"root" env:"ACCOUNTS_HTTP_ROOT"` - CacheTTL int `ocisConfig:"cache_ttl" env:"ACCOUNTS_CACHE_TTL"` - CORS CORS `ocisConfig:"cors"` + Root string `ocisConfig:"root" env:"ACCOUNTS_HTTP_ROOT" desc:"The root path of the http service."` + CacheTTL int `ocisConfig:"cache_ttl" env:"ACCOUNTS_CACHE_TTL" desc:"The cache time for the static assets."` + CORS CORS } // CORS defines the available cors configuration. diff --git a/accounts/pkg/config/log.go b/accounts/pkg/config/log.go index 6ada8a7dd6..f9548ed777 100644 --- a/accounts/pkg/config/log.go +++ b/accounts/pkg/config/log.go @@ -2,8 +2,8 @@ package config // Log defines the available log configuration. type Log struct { - Level string `mapstructure:"level" env:"OCIS_LOG_LEVEL;ACCOUNTS_LOG_LEVEL"` - Pretty bool `mapstructure:"pretty" env:"OCIS_LOG_PRETTY;ACCOUNTS_LOG_PRETTY"` - Color bool `mapstructure:"color" env:"OCIS_LOG_COLOR;ACCOUNTS_LOG_COLOR"` - File string `mapstructure:"file" env:"OCIS_LOG_FILE;ACCOUNTS_LOG_FILE"` + Level string `ocisConfig:"level" env:"OCIS_LOG_LEVEL;ACCOUNTS_LOG_LEVEL" desc:"The log level."` + Pretty bool `ocisConfig:"pretty" env:"OCIS_LOG_PRETTY;ACCOUNTS_LOG_PRETTY" desc:"Activates pretty log output."` + Color bool `ocisConfig:"color" env:"OCIS_LOG_COLOR;ACCOUNTS_LOG_COLOR" desc:"Activates colorized log output."` + File string `ocisConfig:"file" env:"OCIS_LOG_FILE;ACCOUNTS_LOG_FILE" desc:"The target log file."` } diff --git a/accounts/pkg/config/tracing.go b/accounts/pkg/config/tracing.go index fc673f8246..4bd0c79248 100644 --- a/accounts/pkg/config/tracing.go +++ b/accounts/pkg/config/tracing.go @@ -2,8 +2,8 @@ package config // Tracing defines the available tracing configuration. type Tracing struct { - Enabled bool `ocisConfig:"enabled" env:"OCIS_TRACING_ENABLED;ACCOUNTS_TRACING_ENABLED"` + Enabled bool `ocisConfig:"enabled" env:"OCIS_TRACING_ENABLED;ACCOUNTS_TRACING_ENABLED" desc:"Activates tracing."` Type string `ocisConfig:"type" env:"OCIS_TRACING_TYPE;ACCOUNTS_TRACING_TYPE"` - Endpoint string `ocisConfig:"endpoint" env:"OCIS_TRACING_ENDPOINT;ACCOUNTS_TRACING_ENDPOINT"` + Endpoint string `ocisConfig:"endpoint" env:"OCIS_TRACING_ENDPOINT;ACCOUNTS_TRACING_ENDPOINT" desc:"The endpoint to the tracing collector."` Collector string `ocisConfig:"collector" env:"OCIS_TRACING_COLLECTOR;ACCOUNTS_TRACING_COLLECTOR"` } diff --git a/accounts/pkg/service/v0/accounts.go b/accounts/pkg/service/v0/accounts.go index 2b393cb710..bd28223106 100644 --- a/accounts/pkg/service/v0/accounts.go +++ b/accounts/pkg/service/v0/accounts.go @@ -746,7 +746,7 @@ func validateAccountEmail(serviceID string, a *accountsmsg.Account) error { // We want to allow email addresses as usernames so they show up when using them in ACLs on storages that allow integration with our glauth LDAP service // so we are adding a few restrictions from https://stackoverflow.com/questions/6949667/what-are-the-real-rules-for-linux-usernames-on-centos-6-and-rhel-6 // names should not start with numbers -var usernameRegex = regexp.MustCompile("^[a-zA-Z_][a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]*(@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)*$") +var usernameRegex = regexp.MustCompile("^[a-zA-Z_][a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]*(@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)*$") func isValidUsername(e string) bool { if len(e) < 1 && len(e) > 254 { @@ -756,7 +756,7 @@ func isValidUsername(e string) bool { } // regex from https://www.w3.org/TR/2016/REC-html51-20161101/sec-forms.html#valid-e-mail-address -var emailRegex = regexp.MustCompile("^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$") +var emailRegex = regexp.MustCompile("^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$") func isValidEmail(e string) bool { if len(e) < 3 && len(e) > 254 { diff --git a/accounts/ui/tests/acceptance/pageobjects/accountsPage.js b/accounts/ui/tests/acceptance/pageobjects/accountsPage.js index 928e5712d8..c47851763a 100644 --- a/accounts/ui/tests/acceptance/pageobjects/accountsPage.js +++ b/accounts/ui/tests/acceptance/pageobjects/accountsPage.js @@ -2,7 +2,7 @@ const util = require('util') module.exports = { url: function () { - return this.api.launchUrl + '/#/accounts' + return this.api.launchUrl + '/accounts' }, commands: { diff --git a/docs/Makefile b/docs/Makefile index 66ec7e7b93..12121bd84e 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -8,6 +8,7 @@ help: .PHONY: docs-generate docs-generate: ## run docs-generate for all oCIS extensions + @pushd helpers && go run configenvextractor.go; popd @$(MAKE) --no-print-directory -C ../ docs-generate .PHONY: docs-init diff --git a/docs/extensions/_includes/.gitignore b/docs/extensions/_includes/.gitignore new file mode 100644 index 0000000000..a463a88c51 --- /dev/null +++ b/docs/extensions/_includes/.gitignore @@ -0,0 +1 @@ +*_configvars.md diff --git a/docs/extensions/_includes/_index.md b/docs/extensions/_includes/_index.md new file mode 100644 index 0000000000..b58ce0c82f --- /dev/null +++ b/docs/extensions/_includes/_index.md @@ -0,0 +1,3 @@ +--- +GeekdocHidden: true +--- \ No newline at end of file diff --git a/docs/extensions/accounts/.gitignore b/docs/extensions/accounts/.gitignore index 582a0f8475..63536ebfa2 100644 --- a/docs/extensions/accounts/.gitignore +++ b/docs/extensions/accounts/.gitignore @@ -1,2 +1 @@ -configuration.md grpc.md diff --git a/docs/extensions/accounts/configuration.md b/docs/extensions/accounts/configuration.md new file mode 100644 index 0000000000..584b5b1830 --- /dev/null +++ b/docs/extensions/accounts/configuration.md @@ -0,0 +1,12 @@ +--- +title: Service Configuration +date: 2018-05-02T00:00:00+00:00 +weight: 20 +geekdocRepo: https://github.com/owncloud/ocis +geekdocEditPath: edit/master/docs/extensions/accounts +geekdocFilePath: configuration.md +geekdocCollapseSection: true +--- + + +{{< include file="extensions/_includes/accounts_configvars.md" >}} \ No newline at end of file diff --git a/docs/extensions/glauth/.gitignore b/docs/extensions/glauth/.gitignore index 582a0f8475..63536ebfa2 100644 --- a/docs/extensions/glauth/.gitignore +++ b/docs/extensions/glauth/.gitignore @@ -1,2 +1 @@ -configuration.md grpc.md diff --git a/docs/extensions/glauth/configuration.md b/docs/extensions/glauth/configuration.md new file mode 100644 index 0000000000..7132fe0e50 --- /dev/null +++ b/docs/extensions/glauth/configuration.md @@ -0,0 +1,12 @@ +--- +title: Service Configuration +date: 2018-05-02T00:00:00+00:00 +weight: 20 +geekdocRepo: https://github.com/owncloud/ocis +geekdocEditPath: edit/master/docs/extensions/glauth +geekdocFilePath: configuration.md +geekdocCollapseSection: true +--- + + +{{< include file="extensions/_includes/glauth_configvars.md" >}} \ No newline at end of file diff --git a/docs/extensions/graph-explorer/.gitignore b/docs/extensions/graph-explorer/.gitignore index b0c8840e2f..e69de29bb2 100644 --- a/docs/extensions/graph-explorer/.gitignore +++ b/docs/extensions/graph-explorer/.gitignore @@ -1 +0,0 @@ -configuration.md diff --git a/docs/extensions/graph-explorer/configuration.md b/docs/extensions/graph-explorer/configuration.md new file mode 100644 index 0000000000..c27fe24673 --- /dev/null +++ b/docs/extensions/graph-explorer/configuration.md @@ -0,0 +1,12 @@ +--- +title: Service Configuration +date: 2018-05-02T00:00:00+00:00 +weight: 20 +geekdocRepo: https://github.com/owncloud/ocis +geekdocEditPath: edit/master/docs/extensions/graph-explorer +geekdocFilePath: configuration.md +geekdocCollapseSection: true +--- + + +{{< include file="extensions/_includes/graph-explorer_configvars.md" >}} \ No newline at end of file diff --git a/docs/extensions/graph/.gitignore b/docs/extensions/graph/.gitignore index b0c8840e2f..e69de29bb2 100644 --- a/docs/extensions/graph/.gitignore +++ b/docs/extensions/graph/.gitignore @@ -1 +0,0 @@ -configuration.md diff --git a/docs/extensions/graph/configuration.md b/docs/extensions/graph/configuration.md new file mode 100644 index 0000000000..786dfb1339 --- /dev/null +++ b/docs/extensions/graph/configuration.md @@ -0,0 +1,12 @@ +--- +title: Service Configuration +date: 2018-05-02T00:00:00+00:00 +weight: 20 +geekdocRepo: https://github.com/owncloud/ocis +geekdocEditPath: edit/master/docs/extensions/graph +geekdocFilePath: configuration.md +geekdocCollapseSection: true +--- + + +{{< include file="extensions/_includes/graph_configvars.md" >}} \ No newline at end of file diff --git a/docs/extensions/idm/_index.md b/docs/extensions/idm/_index.md new file mode 100644 index 0000000000..19306118e6 --- /dev/null +++ b/docs/extensions/idm/_index.md @@ -0,0 +1,16 @@ +--- +title: IDM +date: 2022-03-02T00:00:00+00:00 +weight: 20 +geekdocRepo: https://github.com/owncloud/ocis +geekdocEditPath: edit/master/docs/extensions/idm +geekdocFilePath: _index.md +geekdocCollapseSection: true +--- + +## Abstract + + +## Table of Contents + +{{< toc-tree >}} diff --git a/docs/extensions/idm/configuration.md b/docs/extensions/idm/configuration.md new file mode 100644 index 0000000000..14200bcde0 --- /dev/null +++ b/docs/extensions/idm/configuration.md @@ -0,0 +1,12 @@ +--- +title: Service Configuration +date: 2018-05-02T00:00:00+00:00 +weight: 20 +geekdocRepo: https://github.com/owncloud/ocis +geekdocEditPath: edit/master/docs/extensions/idm +geekdocFilePath: configuration.md +geekdocCollapseSection: true +--- + + +{{< include file="extensions/_includes/idm_configvars.md" >}} \ No newline at end of file diff --git a/docs/extensions/idp/.gitignore b/docs/extensions/idp/.gitignore index 582a0f8475..63536ebfa2 100644 --- a/docs/extensions/idp/.gitignore +++ b/docs/extensions/idp/.gitignore @@ -1,2 +1 @@ -configuration.md grpc.md diff --git a/docs/extensions/idp/configuration.md b/docs/extensions/idp/configuration.md new file mode 100644 index 0000000000..bc6011eac8 --- /dev/null +++ b/docs/extensions/idp/configuration.md @@ -0,0 +1,12 @@ +--- +title: Service Configuration +date: 2018-05-02T00:00:00+00:00 +weight: 20 +geekdocRepo: https://github.com/owncloud/ocis +geekdocEditPath: edit/master/docs/extensions/idp +geekdocFilePath: configuration.md +geekdocCollapseSection: true +--- + + +{{< include file="extensions/_includes/idp_configvars.md" >}} \ No newline at end of file diff --git a/docs/extensions/nats/_index.md b/docs/extensions/nats/_index.md new file mode 100644 index 0000000000..bd785e2223 --- /dev/null +++ b/docs/extensions/nats/_index.md @@ -0,0 +1,16 @@ +--- +title: NATS +date: 2022-03-02T00:00:00+00:00 +weight: 20 +geekdocRepo: https://github.com/owncloud/ocis +geekdocEditPath: edit/master/docs/extensions/nats +geekdocFilePath: _index.md +geekdocCollapseSection: true +--- + +## Abstract + + +## Table of Contents + +{{< toc-tree >}} \ No newline at end of file diff --git a/docs/extensions/nats/configuration.md b/docs/extensions/nats/configuration.md new file mode 100644 index 0000000000..20ba82f34b --- /dev/null +++ b/docs/extensions/nats/configuration.md @@ -0,0 +1,12 @@ +--- +title: Service Configuration +date: 2018-05-02T00:00:00+00:00 +weight: 20 +geekdocRepo: https://github.com/owncloud/ocis +geekdocEditPath: edit/master/docs/extensions/nats +geekdocFilePath: configuration.md +geekdocCollapseSection: true +--- + + +{{< include file="extensions/_includes/nats_configvars.md" >}} \ No newline at end of file diff --git a/docs/extensions/notifications/_index.md b/docs/extensions/notifications/_index.md new file mode 100644 index 0000000000..c0ad0f7a59 --- /dev/null +++ b/docs/extensions/notifications/_index.md @@ -0,0 +1,16 @@ +--- +title: Notifications +date: 2022-03-02T00:00:00+00:00 +weight: 20 +geekdocRepo: https://github.com/owncloud/ocis +geekdocEditPath: edit/master/docs/extensions/notifications +geekdocFilePath: _index.md +geekdocCollapseSection: true +--- + +## Abstract + + +## Table of Contents + +{{< toc-tree >}} \ No newline at end of file diff --git a/docs/extensions/notifications/configuration.md b/docs/extensions/notifications/configuration.md new file mode 100644 index 0000000000..7da0ba47b6 --- /dev/null +++ b/docs/extensions/notifications/configuration.md @@ -0,0 +1,12 @@ +--- +title: Service Configuration +date: 2018-05-02T00:00:00+00:00 +weight: 20 +geekdocRepo: https://github.com/owncloud/ocis +geekdocEditPath: edit/master/docs/extensions/notifications +geekdocFilePath: configuration.md +geekdocCollapseSection: true +--- + + +{{< include file="extensions/_includes/notifications_configvars.md" >}} \ No newline at end of file diff --git a/docs/extensions/ocs/.gitignore b/docs/extensions/ocs/.gitignore index 582a0f8475..63536ebfa2 100644 --- a/docs/extensions/ocs/.gitignore +++ b/docs/extensions/ocs/.gitignore @@ -1,2 +1 @@ -configuration.md grpc.md diff --git a/docs/extensions/ocs/configuration.md b/docs/extensions/ocs/configuration.md new file mode 100644 index 0000000000..502fead64e --- /dev/null +++ b/docs/extensions/ocs/configuration.md @@ -0,0 +1,12 @@ +--- +title: Service Configuration +date: 2018-05-02T00:00:00+00:00 +weight: 20 +geekdocRepo: https://github.com/owncloud/ocis +geekdocEditPath: edit/master/docs/extensions/ocs +geekdocFilePath: configuration.md +geekdocCollapseSection: true +--- + + +{{< include file="extensions/_includes/ocs_configvars.md" >}} \ No newline at end of file diff --git a/docs/extensions/proxy/.gitignore b/docs/extensions/proxy/.gitignore index 582a0f8475..63536ebfa2 100644 --- a/docs/extensions/proxy/.gitignore +++ b/docs/extensions/proxy/.gitignore @@ -1,2 +1 @@ -configuration.md grpc.md diff --git a/docs/extensions/proxy/configuration.md b/docs/extensions/proxy/configuration.md new file mode 100644 index 0000000000..785922489a --- /dev/null +++ b/docs/extensions/proxy/configuration.md @@ -0,0 +1,12 @@ +--- +title: Service Configuration +date: 2018-05-02T00:00:00+00:00 +weight: 20 +geekdocRepo: https://github.com/owncloud/ocis +geekdocEditPath: edit/master/docs/extensions/proxy +geekdocFilePath: configuration.md +geekdocCollapseSection: true +--- + + +{{< include file="extensions/_includes/proxy_configvars.md" >}} \ No newline at end of file diff --git a/docs/extensions/settings/.gitignore b/docs/extensions/settings/.gitignore index 582a0f8475..63536ebfa2 100644 --- a/docs/extensions/settings/.gitignore +++ b/docs/extensions/settings/.gitignore @@ -1,2 +1 @@ -configuration.md grpc.md diff --git a/docs/extensions/settings/configuration.md b/docs/extensions/settings/configuration.md new file mode 100644 index 0000000000..b20e913a7f --- /dev/null +++ b/docs/extensions/settings/configuration.md @@ -0,0 +1,12 @@ +--- +title: Service Configuration +date: 2018-05-02T00:00:00+00:00 +weight: 20 +geekdocRepo: https://github.com/owncloud/ocis +geekdocEditPath: edit/master/docs/extensions/settings +geekdocFilePath: configuration.md +geekdocCollapseSection: true +--- + + +{{< include file="extensions/_includes/settings_configvars.md" >}} \ No newline at end of file diff --git a/docs/extensions/storage/.gitignore b/docs/extensions/storage/.gitignore index 582a0f8475..63536ebfa2 100644 --- a/docs/extensions/storage/.gitignore +++ b/docs/extensions/storage/.gitignore @@ -1,2 +1 @@ -configuration.md grpc.md diff --git a/docs/extensions/store/.gitignore b/docs/extensions/store/.gitignore index 582a0f8475..63536ebfa2 100644 --- a/docs/extensions/store/.gitignore +++ b/docs/extensions/store/.gitignore @@ -1,2 +1 @@ -configuration.md grpc.md diff --git a/docs/extensions/store/configuration.md b/docs/extensions/store/configuration.md new file mode 100644 index 0000000000..a974e254af --- /dev/null +++ b/docs/extensions/store/configuration.md @@ -0,0 +1,12 @@ +--- +title: Service Configuration +date: 2018-05-02T00:00:00+00:00 +weight: 20 +geekdocRepo: https://github.com/owncloud/ocis +geekdocEditPath: edit/master/docs/extensions/store +geekdocFilePath: configuration.md +geekdocCollapseSection: true +--- + + +{{< include file="extensions/_includes/store_configvars.md" >}} \ No newline at end of file diff --git a/docs/extensions/thumbnails/.gitignore b/docs/extensions/thumbnails/.gitignore index 582a0f8475..63536ebfa2 100644 --- a/docs/extensions/thumbnails/.gitignore +++ b/docs/extensions/thumbnails/.gitignore @@ -1,2 +1 @@ -configuration.md grpc.md diff --git a/docs/extensions/thumbnails/configuration.md b/docs/extensions/thumbnails/configuration.md new file mode 100644 index 0000000000..7b6e85bde5 --- /dev/null +++ b/docs/extensions/thumbnails/configuration.md @@ -0,0 +1,12 @@ +--- +title: Service Configuration +date: 2018-05-02T00:00:00+00:00 +weight: 20 +geekdocRepo: https://github.com/owncloud/ocis +geekdocEditPath: edit/master/docs/extensions/thumbnails +geekdocFilePath: configuration.md +geekdocCollapseSection: true +--- + + +{{< include file="extensions/_includes/thumbnails_configvars.md" >}} \ No newline at end of file diff --git a/docs/extensions/web/.gitignore b/docs/extensions/web/.gitignore index 582a0f8475..63536ebfa2 100644 --- a/docs/extensions/web/.gitignore +++ b/docs/extensions/web/.gitignore @@ -1,2 +1 @@ -configuration.md grpc.md diff --git a/docs/extensions/web/configuration.md b/docs/extensions/web/configuration.md new file mode 100644 index 0000000000..d55237fd90 --- /dev/null +++ b/docs/extensions/web/configuration.md @@ -0,0 +1,12 @@ +--- +title: Service Configuration +date: 2018-05-02T00:00:00+00:00 +weight: 20 +geekdocRepo: https://github.com/owncloud/ocis +geekdocEditPath: edit/master/docs/extensions/web +geekdocFilePath: configuration.md +geekdocCollapseSection: true +--- + + +{{< include file="extensions/_includes/web_configvars.md" >}} \ No newline at end of file diff --git a/docs/extensions/webdav/.gitignore b/docs/extensions/webdav/.gitignore index 582a0f8475..63536ebfa2 100644 --- a/docs/extensions/webdav/.gitignore +++ b/docs/extensions/webdav/.gitignore @@ -1,2 +1 @@ -configuration.md grpc.md diff --git a/docs/extensions/webdav/configuration.md b/docs/extensions/webdav/configuration.md new file mode 100644 index 0000000000..7ae4a04860 --- /dev/null +++ b/docs/extensions/webdav/configuration.md @@ -0,0 +1,12 @@ +--- +title: Service Configuration +date: 2018-05-02T00:00:00+00:00 +weight: 20 +geekdocRepo: https://github.com/owncloud/ocis +geekdocEditPath: edit/master/docs/extensions/webdav +geekdocFilePath: configuration.md +geekdocCollapseSection: true +--- + + +{{< include file="extensions/_includes/webdav_configvars.md" >}} \ No newline at end of file diff --git a/docs/helpers/configenvextractor.go b/docs/helpers/configenvextractor.go new file mode 100644 index 0000000000..bc504fc32e --- /dev/null +++ b/docs/helpers/configenvextractor.go @@ -0,0 +1,50 @@ +package main + +import ( + "fmt" + "io/ioutil" + "log" + "os" + "os/exec" + "path/filepath" + "strings" + "text/template" +) + +func main() { + fmt.Println("Getting relevant packages") + paths, err := filepath.Glob("../../*/pkg/config/defaultconfig.go") + if err != nil { + log.Fatal(err) + } + replacer := strings.NewReplacer( + "../../", "github.com/owncloud/ocis/", + "/defaultconfig.go", "", + ) + for i := range paths { + paths[i] = replacer.Replace(paths[i]) + } + content, err := ioutil.ReadFile("extractor.go.tmpl") + if err != nil { + log.Fatal(err) + } + fmt.Println("Generating intermediate go code") + tpl := template.Must(template.New("").Parse(string(content))) + os.Mkdir("output", 0700) + runner, err := os.Create("output/runner.go") + if err != nil { + log.Fatal(err) + } + tpl.Execute(runner, paths) + fmt.Println("Running intermediate go code") + os.Chdir("output") + os.Setenv("OCIS_BASE_DATA_PATH", "~/.ocis") + out, err := exec.Command("go", "run", "runner.go").Output() + if err != nil { + log.Fatal(err) + } + fmt.Println(string(out)) + fmt.Println("Cleaning up") + os.Chdir("../") + os.RemoveAll("output") +} diff --git a/docs/helpers/extractor.go.tmpl b/docs/helpers/extractor.go.tmpl new file mode 100644 index 0000000000..3503ea2274 --- /dev/null +++ b/docs/helpers/extractor.go.tmpl @@ -0,0 +1,85 @@ +package main + +import ( + "fmt" + "io/ioutil" + "log" + "os" + "path/filepath" + "reflect" + "strings" + "text/template" + + {{- range $key, $value := .}} + pkg{{$key}} "{{$value}}" + {{- end}}) + +type ConfigField struct { + Name string + DefaultValue string + Type string + Description string +} + +func main() { +fmt.Println("Generating documentation for environment variables:") +content, err := ioutil.ReadFile("../../../docs/templates/CONFIGURATION.tmpl") +if err != nil { + log.Fatal(err) +} +replacer := strings.NewReplacer( + "github.com/owncloud/ocis/", "", + "/pkg/config", "", + ) +var fields []ConfigField +var targetFile *os.File +tpl := template.Must(template.New("").Parse(string(content))) + +m := map[string]interface{}{ +{{- range $key, $value := .}} + "{{$value}}": *pkg{{$key}}.DefaultConfig(), +{{- end }} +} + + targetFolder := "../../../docs/extensions/_includes/" + for pkg, conf := range m { + fields = GetAnnotatedVariables(conf) + if len(fields) > 0 { + fmt.Printf("... %s\n", pkg) + targetFile, err = os.Create(filepath.Join(targetFolder, replacer.Replace(pkg) + "_configvars.md")) + if err != nil { + log.Fatalf("Failed to create target file: %s", err) + } + defer targetFile.Close() + if err := tpl.Execute(targetFile, fields); err != nil { + log.Fatalf("Failed to execute template: %s", err) + } + } + } + fmt.Println("done") +} + +func GetAnnotatedVariables(s interface{}) []ConfigField { + t := reflect.TypeOf(s) + v := reflect.ValueOf(s) + + var fields []ConfigField + for i := 0; i < t.NumField(); i++ { + field := t.Field(i) + value := v.Field(i) + + switch value.Kind() { + default: + desc := field.Tag.Get("desc") + env, ok := field.Tag.Lookup("env") + if !ok { + continue + } + v := fmt.Sprintf("%v", value.Interface()) + fields = append(fields, ConfigField{Name: env, DefaultValue: v, Description: desc, Type: value.Type().Name()}) + case reflect.Struct: + fields = append(fields, GetAnnotatedVariables(value.Interface())...) + } + } + return fields +} diff --git a/docs/ocis/adr/0016-files-metadata.md b/docs/ocis/adr/0016-files-metadata.md index b9a3089aa4..55fe7fe61d 100644 --- a/docs/ocis/adr/0016-files-metadata.md +++ b/docs/ocis/adr/0016-files-metadata.md @@ -1,5 +1,10 @@ --- title: "16. Storage for Files Metadata" +weight: 16 +date: 2022-03-02T00:00:00+01:00 +geekdocRepo: https://github.com/owncloud/ocis +geekdocEditPath: edit/master/docs/ocis/adr +geekdocFilePath: 0016-files-metadata.md --- * Status: proposed diff --git a/docs/templates/CONFIGURATION.tmpl b/docs/templates/CONFIGURATION.tmpl new file mode 100644 index 0000000000..ffa87ae79d --- /dev/null +++ b/docs/templates/CONFIGURATION.tmpl @@ -0,0 +1,7 @@ +## Environment Variables + +| Name | Type | Default Value | Description | +|------|------|---------------|-------------| +{{- range .}} +| {{.Name}} | {{.Type}} | {{.DefaultValue}} | {{.Description}}| +{{- end }} \ No newline at end of file diff --git a/go.mod b/go.mod index d7965c817c..234f66a073 100644 --- a/go.mod +++ b/go.mod @@ -22,7 +22,7 @@ require ( github.com/blevesearch/bleve/v2 v2.3.1 github.com/coreos/go-oidc/v3 v3.1.0 github.com/cs3org/go-cs3apis v0.0.0-20220126114148-64c025ccdd19 - github.com/cs3org/reva v1.16.1-0.20220301071903-1fd81b097801 + github.com/cs3org/reva v1.16.1-0.20220301130454-abc01bbfa855 github.com/disintegration/imaging v1.6.2 github.com/glauth/glauth/v2 v2.0.0-20211021011345-ef3151c28733 github.com/go-chi/chi/v5 v5.0.7 diff --git a/go.sum b/go.sum index 092bf56979..65f3c08232 100644 --- a/go.sum +++ b/go.sum @@ -342,8 +342,6 @@ github.com/crewjam/saml v0.4.5/go.mod h1:qCJQpUtZte9R1ZjUBcW8qtCNlinbO363ooNl02S github.com/cs3org/cato v0.0.0-20200828125504-e418fc54dd5e/go.mod h1:XJEZ3/EQuI3BXTp/6DUzFr850vlxq11I6satRtz0YQ4= github.com/cs3org/go-cs3apis v0.0.0-20220126114148-64c025ccdd19 h1:1jqPH58jCxvbaJ9WLIJ7W2/m622bWS6ChptzljSG6IQ= github.com/cs3org/go-cs3apis v0.0.0-20220126114148-64c025ccdd19/go.mod h1:UXha4TguuB52H14EMoSsCqDj7k8a/t7g4gVP+bgY5LY= -github.com/cs3org/reva v1.16.1-0.20220228144359-3e80be7f6667 h1:6Cjm0dV/6RcneBhnMAJmUDYgxzeEizumRnDyqiVvDJQ= -github.com/cs3org/reva v1.16.1-0.20220228144359-3e80be7f6667/go.mod h1:fdlrnZ0f+UtAdpZfLG+4LM0ZrhT5V8tPEQt6ycYm82c= github.com/cubewise-code/go-mime v0.0.0-20200519001935-8c5762b177d8 h1:Z9lwXumT5ACSmJ7WGnFl+OMLLjpz5uR2fyz7dC255FI= github.com/cubewise-code/go-mime v0.0.0-20200519001935-8c5762b177d8/go.mod h1:4abs/jPXcmJzYoYGF91JF9Uq9s/KL5n1jvFDix8KcqY= github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4= @@ -912,6 +910,8 @@ github.com/klauspost/cpuid/v2 v2.0.4/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa02 github.com/klauspost/cpuid/v2 v2.0.9 h1:lgaqFMSdTdQYdZ04uHyN2d/eKdOMyi2YLSvlQIBFYa4= github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/kljensen/snowball v0.6.0/go.mod h1:27N7E8fVU5H68RlUmnWwZCfxgt4POBJfENGMvNRhldw= +github.com/kobergj/reva v1.13.1-0.20220303101200-03258eac912d h1:pEytDpB4JhfL+iieFUHyccJ0yY04pXTogIuypT8yEDI= +github.com/kobergj/reva v1.13.1-0.20220303101200-03258eac912d/go.mod h1:fdlrnZ0f+UtAdpZfLG+4LM0ZrhT5V8tPEQt6ycYm82c= github.com/kolo/xmlrpc v0.0.0-20200310150728-e0350524596b/go.mod h1:o03bZfuBwAXHetKXuInt4S7omeXUu62/A845kiycsSQ= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= diff --git a/graph/pkg/service/v0/graph.go b/graph/pkg/service/v0/graph.go index b634384e33..2dd618d09a 100644 --- a/graph/pkg/service/v0/graph.go +++ b/graph/pkg/service/v0/graph.go @@ -11,6 +11,7 @@ import ( "github.com/owncloud/ocis/graph/pkg/config" "github.com/owncloud/ocis/graph/pkg/identity" "github.com/owncloud/ocis/ocis-pkg/log" + settingssvc "github.com/owncloud/ocis/protogen/gen/ocis/services/settings/v0" "google.golang.org/grpc" ) @@ -66,6 +67,7 @@ type Graph struct { identityBackend identity.Backend gatewayClient GatewayClient httpClient HTTPClient + roleService settingssvc.RoleService spacePropertiesCache *ttlcache.Cache } diff --git a/graph/pkg/service/v0/service.go b/graph/pkg/service/v0/service.go index a2bf0567b8..c77959d963 100644 --- a/graph/pkg/service/v0/service.go +++ b/graph/pkg/service/v0/service.go @@ -116,17 +116,19 @@ func NewService(opts ...Option) Service { svc.httpClient = options.HTTPClient } - roleService := options.RoleService - if roleService == nil { - roleService = settingssvc.NewRoleService("com.owncloud.api.settings", grpc.DefaultClient) + if options.RoleService == nil { + svc.roleService = settingssvc.NewRoleService("com.owncloud.api.settings", grpc.DefaultClient) + } else { + svc.roleService = options.RoleService } + roleManager := options.RoleManager if roleManager == nil { m := roles.NewManager( roles.CacheSize(1024), roles.CacheTTL(time.Hour), roles.Logger(options.Logger), - roles.RoleService(roleService), + roles.RoleService(svc.roleService), ) roleManager = &m } diff --git a/graph/pkg/service/v0/users.go b/graph/pkg/service/v0/users.go index 88d87a420e..ebdba6bb8a 100644 --- a/graph/pkg/service/v0/users.go +++ b/graph/pkg/service/v0/users.go @@ -3,8 +3,10 @@ package svc import ( "encoding/json" "errors" + "fmt" "net/http" "net/url" + "regexp" revactx "github.com/cs3org/reva/pkg/ctx" "github.com/go-chi/chi/v5" @@ -12,6 +14,8 @@ import ( libregraph "github.com/owncloud/libre-graph-api-go" "github.com/owncloud/ocis/graph/pkg/identity" "github.com/owncloud/ocis/graph/pkg/service/v0/errorcode" + settings "github.com/owncloud/ocis/protogen/gen/ocis/services/settings/v0" + settingssvc "github.com/owncloud/ocis/settings/pkg/service/v0" ) // GetMe implements the Service interface. @@ -56,7 +60,18 @@ func (g Graph) PostUser(w http.ResponseWriter, r *http.Request) { } if isNilOrEmpty(u.DisplayName) || isNilOrEmpty(u.OnPremisesSamAccountName) || isNilOrEmpty(u.Mail) { - errorcode.InvalidRequest.Render(w, r, http.StatusBadRequest, "Missing Required Attribute") + errorcode.InvalidRequest.Render(w, r, http.StatusBadRequest, err.Error()) + return + } + + if !isValidUsername(*u.OnPremisesSamAccountName) { + errorcode.InvalidRequest.Render(w, r, http.StatusBadRequest, + fmt.Sprintf("username '%s' must be at least the local part of an email", *u.OnPremisesSamAccountName)) + return + } + if !isValidEmail(*u.Mail) { + errorcode.InvalidRequest.Render(w, r, http.StatusBadRequest, + fmt.Sprintf("'%s' is not a valid email address", *u.Mail)) return } @@ -73,6 +88,19 @@ func (g Graph) PostUser(w http.ResponseWriter, r *http.Request) { return } + // All users get the user role by default currently. + // to all new users for now, as create Account request does not have any role field + if g.roleService == nil { + errorcode.GeneralException.Render(w, r, http.StatusInternalServerError, "could not assign role to account: roleService not configured") + return + } + if _, err = g.roleService.AssignRoleToUser(r.Context(), &settings.AssignRoleToUserRequest{ + AccountUuid: *u.Id, + RoleId: settingssvc.BundleUUIDRoleUser, + }); err != nil { + errorcode.GeneralException.Render(w, r, http.StatusInternalServerError, fmt.Sprintf("could not assign role to account %s", err.Error())) + return + } render.Status(r, http.StatusOK) render.JSON(w, r, u) } @@ -151,6 +179,13 @@ func (g Graph) PatchUser(w http.ResponseWriter, r *http.Request) { return } + mail := changes.GetMail() + if !isValidEmail(mail) { + errorcode.InvalidRequest.Render(w, r, http.StatusBadRequest, + fmt.Sprintf("'%s' is not a valid email address", mail)) + return + } + u, err := g.identityBackend.UpdateUser(r.Context(), nameOrID, *changes) if err != nil { var errcode errorcode.Error @@ -169,3 +204,25 @@ func (g Graph) PatchUser(w http.ResponseWriter, r *http.Request) { func isNilOrEmpty(s *string) bool { return s == nil || *s == "" } + +// We want to allow email addresses as usernames so they show up when using them in ACLs on storages that allow integration with our glauth LDAP service +// so we are adding a few restrictions from https://stackoverflow.com/questions/6949667/what-are-the-real-rules-for-linux-usernames-on-centos-6-and-rhel-6 +// names should not start with numbers +var usernameRegex = regexp.MustCompile("^[a-zA-Z_][a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]*(@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)*$") + +func isValidUsername(e string) bool { + if len(e) < 1 && len(e) > 254 { + return false + } + return usernameRegex.MatchString(e) +} + +// regex from https://www.w3.org/TR/2016/REC-html51-20161101/sec-forms.html#valid-e-mail-address +var emailRegex = regexp.MustCompile("^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$") + +func isValidEmail(e string) bool { + if len(e) < 3 && len(e) > 254 { + return false + } + return emailRegex.MatchString(e) +} diff --git a/settings/ui/tests/acceptance/pageobjects/settingsPage.js b/settings/ui/tests/acceptance/pageobjects/settingsPage.js index b109ff72c1..b49565c5fa 100644 --- a/settings/ui/tests/acceptance/pageobjects/settingsPage.js +++ b/settings/ui/tests/acceptance/pageobjects/settingsPage.js @@ -1,9 +1,8 @@ const { client } = require('nightwatch-api') -const util = require('util') module.exports = { url: function () { - return this.api.launchUrl + '/#/settings' + return this.api.launchUrl + '/settings' }, commands: { @@ -78,6 +77,6 @@ module.exports = { languageInput: { selector: "//label[.='Language']/..//input", locateStrategy: 'xpath' - }, + } } } diff --git a/web/Makefile b/web/Makefile index ce33ae9bec..71238f7de7 100644 --- a/web/Makefile +++ b/web/Makefile @@ -1,6 +1,6 @@ SHELL := bash NAME := web -WEB_ASSETS_VERSION = v5.1.0 +WEB_ASSETS_VERSION = v5.2.0-rc.2 include ../.make/recursion.mk