Compare commits
248
Commits
fix/kapp
...
stable-2.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8c623357d1 | ||
|
|
0867011d0a | ||
|
|
40a6d5624d | ||
|
|
348850e3cb | ||
|
|
1126ff5f5e | ||
|
|
416a3c6e25 | ||
|
|
586a52d651 | ||
|
|
7cdd6cf9d2 | ||
|
|
5bb790274d | ||
|
|
eb2ff10728 | ||
|
|
f2f3dc5bdb | ||
|
|
a0a73ab8ab | ||
|
|
bff170c5dd | ||
|
|
611fa136af | ||
|
|
a39d2e0327 | ||
|
|
736348f5e9 | ||
|
|
47cddcdb29 | ||
|
|
2665b2a9c7 | ||
|
|
ae7f334292 | ||
|
|
81b479a387 | ||
|
|
0b3688c7b8 | ||
|
|
909848f106 | ||
|
|
4322452f5f | ||
|
|
4f42d08879 | ||
|
|
af35644dc9 | ||
|
|
921343d020 | ||
|
|
8a93068fba | ||
|
|
fc90ebf728 | ||
|
|
57d4c995ac | ||
|
|
a3e124a1e6 | ||
|
|
66c03593db | ||
|
|
84675727e1 | ||
|
|
43267c8251 | ||
|
|
b244be650d | ||
|
|
37273b080b | ||
|
|
2cd1b49d32 | ||
|
|
5e6313b8f7 | ||
|
|
cd3e8ed47e | ||
|
|
b856f6546c | ||
|
|
05c22c6cf9 | ||
|
|
996565cc6e | ||
|
|
4bf90fb0c8 | ||
|
|
bcc39d9f16 | ||
|
|
3cc016ae1b | ||
|
|
53224c182d | ||
|
|
5a57a7c6fb | ||
|
|
8e2a8521ec | ||
|
|
f26d9c7a7b | ||
|
|
da94701dca | ||
|
|
950f17543b | ||
|
|
1ac1ed825c | ||
|
|
daddb63900 | ||
|
|
5a97f72ad8 | ||
|
|
fe4195d694 | ||
|
|
2ceab0146f | ||
|
|
8f44c8a3ab | ||
|
|
9c1de43dd1 | ||
|
|
968e965519 | ||
|
|
a86d5f6764 | ||
|
|
880d1a5075 | ||
|
|
63d26c7e2e | ||
|
|
337f6bf7f0 | ||
|
|
3671b5debe | ||
|
|
d447b05a55 | ||
|
|
0d6c140e05 | ||
|
|
ff95ee1f97 | ||
|
|
8998719133 | ||
|
|
817db7174a | ||
|
|
9c699dab08 | ||
|
|
e3f20fb9eb | ||
|
|
64953e632a | ||
|
|
cdcd44af8c | ||
|
|
04ac6bbe55 | ||
|
|
1f2f9f3107 | ||
|
|
2078bbc22e | ||
|
|
bd389da402 | ||
|
|
338512b0f1 | ||
|
|
38221012cf | ||
|
|
2fbcf0e706 | ||
|
|
1dee1d8409 | ||
|
|
cb6f243b6a | ||
|
|
1e9632652d | ||
|
|
a71dbacc62 | ||
|
|
d62ec0e4f1 | ||
|
|
ba5770a00c | ||
|
|
5b978a5100 | ||
|
|
0c1006cad2 | ||
|
|
d6c08e1e51 | ||
|
|
d59dd4cd91 | ||
|
|
4bd2b2ba66 | ||
|
|
e73b55c905 | ||
|
|
0ca457bd6b | ||
|
|
ca58f52ff2 | ||
|
|
7121ad748a | ||
|
|
59b7c36387 | ||
|
|
3cc71adbe3 | ||
|
|
8abf65b2db | ||
|
|
167bd97f1e | ||
|
|
d6f50e67ba | ||
|
|
d47a4a136d | ||
|
|
5381b485af | ||
|
|
d17e617890 | ||
|
|
5b8f6565fa | ||
|
|
fe94c4179d | ||
|
|
3ad8790851 | ||
|
|
625fee3aee | ||
|
|
6bc7c6e4c6 | ||
|
|
01a007be39 | ||
|
|
25c791c005 | ||
|
|
5920e8514e | ||
|
|
cfe314d024 | ||
|
|
a04ce720d0 | ||
|
|
515f4c49ce | ||
|
|
fa06c09895 | ||
|
|
899d43767c | ||
|
|
ed57edb3f7 | ||
|
|
5da85fd69c | ||
|
|
d4ffe37ad0 | ||
|
|
bfd154ce39 | ||
|
|
6815cba92d | ||
|
|
8c1803e30a | ||
|
|
7df2f27797 | ||
|
|
38b34344b6 | ||
|
|
fe490fd28c | ||
|
|
8cca2acbbc | ||
|
|
039da2952a | ||
|
|
2949b319e5 | ||
|
|
2c88d21519 | ||
|
|
d1a69cac14 | ||
|
|
c80dbeadb8 | ||
|
|
b06983f558 | ||
|
|
b68914b521 | ||
|
|
9ddbe9168b | ||
|
|
cd804685b5 | ||
|
|
cc3f983e22 | ||
|
|
9286df9a1c | ||
|
|
f85d7d7e52 | ||
|
|
f67f7dbcd5 | ||
|
|
bdd941e93d | ||
|
|
d0e71a6c68 | ||
|
|
fbe05dcce0 | ||
|
|
85e7c64aed | ||
|
|
15c152bd62 | ||
|
|
4e69478625 | ||
|
|
f627499f95 | ||
|
|
4e0cdaa04f | ||
|
|
d3a1c36c21 | ||
|
|
9983aa760d | ||
|
|
388ec1f66f | ||
|
|
8e57f038d5 | ||
|
|
e3ddfbd4eb | ||
|
|
266cbaf1f1 | ||
|
|
2a6e7a765e | ||
|
|
9b2f3a18ca | ||
|
|
8f257d1d96 | ||
|
|
ed2c63ba31 | ||
|
|
f272962795 | ||
|
|
d38d9a6991 | ||
|
|
54d442cf99 | ||
|
|
72de543124 | ||
|
|
318f146de3 | ||
|
|
dc34169066 | ||
|
|
d0d0517b43 | ||
|
|
a4a6c4bf79 | ||
|
|
0d0f296b76 | ||
|
|
bcb2159cb3 | ||
|
|
d5d9640d4b | ||
|
|
176272d8ae | ||
|
|
348dc74550 | ||
|
|
1b3b9527f8 | ||
|
|
6d3a411e5d | ||
|
|
3c544707ef | ||
|
|
af74785eba | ||
|
|
da7c2ebdd2 | ||
|
|
7c269633bc | ||
|
|
faa9c6f8c9 | ||
|
|
bf95981478 | ||
|
|
13a7065f3a | ||
|
|
b1c0ea6720 | ||
|
|
b227b5d372 | ||
|
|
998da12b08 | ||
|
|
c3a3653092 | ||
|
|
de90cfd616 | ||
|
|
824545f26c | ||
|
|
60ee3c85f4 | ||
|
|
3030c2bc67 | ||
|
|
67db2f1079 | ||
|
|
18ba8cbbb8 | ||
|
|
d4d71a6059 | ||
|
|
ef99674ad7 | ||
|
|
11d43172ee | ||
|
|
62ef3c024a | ||
|
|
0bc852d11b | ||
|
|
5c01fa2019 | ||
|
|
9ce6f8a4f1 | ||
|
|
4001919025 | ||
|
|
09c9da8c44 | ||
|
|
88c30068d7 | ||
|
|
2a6e601407 | ||
|
|
ca42566265 | ||
|
|
688c146047 | ||
|
|
261cf0b848 | ||
|
|
fcccd31c1e | ||
|
|
c5169ef2cc | ||
|
|
b36c2e6dbf | ||
|
|
55948da489 | ||
|
|
e5e1cbd545 | ||
|
|
75482c2dcd | ||
|
|
30a744ea13 | ||
|
|
489b3f8dca | ||
|
|
fb3d7b7bff | ||
|
|
b275bd8bf4 | ||
|
|
056bb25b57 | ||
|
|
b23bc2bed0 | ||
|
|
061d25a1fb | ||
|
|
1cdca3febf | ||
|
|
dcc65b09ea | ||
|
|
4de7499ce6 | ||
|
|
8109997289 | ||
|
|
5c8c9cf8e6 | ||
|
|
8426eb5e3e | ||
|
|
d1a20549c5 | ||
|
|
563f7a83ca | ||
|
|
4328b852b4 | ||
|
|
8222c4ee17 | ||
|
|
131327dd09 | ||
|
|
883ed8a2b4 | ||
|
|
748f1747e0 | ||
|
|
1c662ed4d6 | ||
|
|
c864071328 | ||
|
|
c8a9304c57 | ||
|
|
70e41d709d | ||
|
|
abff143319 | ||
|
|
2f202c70bb | ||
|
|
2644700859 | ||
|
|
ff571ec8b1 | ||
|
|
218ef2b4d8 | ||
|
|
55ba9ff301 | ||
|
|
36d15194e7 | ||
|
|
eb656a67ec | ||
|
|
e81bbd775e | ||
|
|
42b4ca60b3 | ||
|
|
bdbb86dd8d | ||
|
|
cee9043e7d | ||
|
|
8262aa3719 | ||
|
|
add7bda89c | ||
|
|
b69bf2be90 | ||
|
|
32184a4822 |
No files matched your search
+1
-1
@@ -16,5 +16,5 @@ exclude_paths:
|
||||
- 'tests/acceptance/expected-failures-*.md'
|
||||
- 'tests/acceptance/features/bootstrap/**'
|
||||
- 'tests/TestHelpers/**'
|
||||
|
||||
- 'tests/acceptance/run.sh'
|
||||
...
|
||||
@@ -1,7 +1,3 @@
|
||||
# The test runner source for API tests
|
||||
CORE_COMMITID=3ea9a1d44df397a504ca7ed8eb8c8c59b5a16852
|
||||
CORE_BRANCH=master
|
||||
|
||||
# The test runner source for UI tests
|
||||
WEB_COMMITID=7dfd87f63374aba68d8bc888dd0b86cee2fa68d5
|
||||
WEB_BRANCH=stable-6.0
|
||||
+270
-501
File diff suppressed because it is too large.
Load diff
@@ -1,3 +1,5 @@
|
||||
run:
|
||||
modules-download-mode: readonly
|
||||
linters:
|
||||
enable-all: true
|
||||
disable:
|
||||
|
||||
@@ -68,6 +68,7 @@ help:
|
||||
@echo -e "${GREEN}Testing with test suite natively installed:${RESET}\n"
|
||||
@echo -e "${PURPLE}\tdocs: https://owncloud.dev/ocis/development/testing/#testing-with-test-suite-natively-installed${RESET}\n"
|
||||
@echo -e "\tmake test-acceptance-api\t\t${BLUE}run API acceptance tests${RESET}"
|
||||
@echo -e "\tmake test-acceptance-from-core-api\t\t${BLUE}run core API acceptance tests${RESET}"
|
||||
@echo -e "\tmake test-paralleldeployment-api\t${BLUE}run API acceptance tests for parallel deployment${RESET}"
|
||||
@echo -e "\tmake clean-tests\t\t\t${BLUE}delete API tests framework dependencies${RESET}"
|
||||
@echo
|
||||
@@ -102,14 +103,20 @@ clean-tests:
|
||||
BEHAT_BIN=vendor-bin/behat/vendor/bin/behat
|
||||
# behat config file for parallel deployment tests
|
||||
PARALLEL_BEHAT_YML=tests/parallelDeployAcceptance/config/behat.yml
|
||||
# behat config file for core api tests
|
||||
CORE_BEHAT_YML=tests/acceptance/config/behat-core.yml
|
||||
|
||||
.PHONY: test-acceptance-api
|
||||
test-acceptance-api: vendor-bin/behat/vendor
|
||||
BEHAT_BIN=$(BEHAT_BIN) $(PATH_TO_CORE)/tests/acceptance/run.sh --remote --type api
|
||||
BEHAT_BIN=$(BEHAT_BIN) $(PWD)/tests/acceptance/run.sh --type api
|
||||
|
||||
.PHONY: test-acceptance-from-core-api
|
||||
test-acceptance-from-core-api: vendor-bin/behat/vendor
|
||||
BEHAT_BIN=$(BEHAT_BIN) BEHAT_YML=$(CORE_BEHAT_YML) $(PWD)/tests/acceptance/run.sh --type core-api
|
||||
|
||||
.PHONY: test-paralleldeployment-api
|
||||
test-paralleldeployment-api: vendor-bin/behat/vendor
|
||||
BEHAT_BIN=$(BEHAT_BIN) BEHAT_YML=$(PARALLEL_BEHAT_YML) $(PATH_TO_CORE)/tests/acceptance/run.sh --type api
|
||||
BEHAT_BIN=$(BEHAT_BIN) BEHAT_YML=$(PARALLEL_BEHAT_YML) $(PWD)/tests/acceptance/run.sh --type api
|
||||
|
||||
vendor/bamarni/composer-bin-plugin: composer.lock
|
||||
composer install
|
||||
@@ -143,9 +150,12 @@ clean:
|
||||
|
||||
.PHONY: docs-generate
|
||||
docs-generate:
|
||||
# empty the folders first to only have files that are generated without remnants
|
||||
find docs/services/_includes/ -type f \( -name "*" ! -name ".git*" ! -name "_*" \) -delete || exit 1
|
||||
@for mod in $(OCIS_MODULES); do \
|
||||
$(MAKE) --no-print-directory -C $$mod docs-generate || exit 1; \
|
||||
done
|
||||
$(MAKE) --no-print-directory -C docs docs-generate || exit 1
|
||||
|
||||
.PHONY: ci-go-generate
|
||||
ci-go-generate:
|
||||
@@ -199,7 +209,7 @@ golangci-lint-fix:
|
||||
|
||||
.PHONY: bingo-update
|
||||
bingo-update: $(BINGO)
|
||||
$(BINGO) get -l -u
|
||||
$(BINGO) get -l -v
|
||||
|
||||
.PHONY: check-licenses
|
||||
check-licenses: ci-go-check-licenses ci-node-check-licenses
|
||||
|
||||
+1
-2
@@ -9,9 +9,8 @@
|
||||
"bamarni/composer-bin-plugin": true
|
||||
}
|
||||
},
|
||||
"require": {
|
||||
},
|
||||
"require-dev": {
|
||||
"ext-simplexml": "*",
|
||||
"bamarni/composer-bin-plugin": "^1.4"
|
||||
},
|
||||
"extra": {
|
||||
|
||||
+3
-2
@@ -8,12 +8,13 @@ help:
|
||||
|
||||
.PHONY: docs-generate
|
||||
docs-generate: ## run docs-generate for all oCIS services
|
||||
@pushd helpers && go run configenvextractor.go; popd
|
||||
@$(MAKE) --no-print-directory -C ../ docs-generate
|
||||
@pushd helpers && go run .; popd
|
||||
|
||||
.PHONY: docs-init
|
||||
docs-init:
|
||||
@mkdir -p hugo/content/
|
||||
@mkdir -p hugo/public/
|
||||
@touch hugo/public/.nojekyll
|
||||
@cd hugo && git init
|
||||
@cd hugo && git config advice.detachedHead false
|
||||
@cd hugo && git remote rm origin || true
|
||||
|
||||
@@ -0,0 +1,132 @@
|
||||
# Docs Helpers
|
||||
|
||||
* [Introduction](#introduction)
|
||||
* [Output Generated](#output)
|
||||
* [Admin Doc Process](#admin-doc-process)
|
||||
* [Branching](#branching)
|
||||
* [Service-Dependent Output](#service-dependent-output)
|
||||
* [Generate Envvar Docs for Config Structs](#generate-envvar-docs-for-config-structs)
|
||||
* [Deprecation Process](#deprecation-process)
|
||||
* [Global Envvars](#global-envvars)
|
||||
* [Extended Envvars](#extended-envvars)
|
||||
* [General Extended Envvars Info](#general-extended-envvars-info)
|
||||
* [Extract Extended Envvars](#extract-extended-envvars)
|
||||
* [Generate Extended Envvar Docs](#generate-extended-envvar-docs)
|
||||
* [Backporting](#backporting)
|
||||
|
||||
## Introduction
|
||||
|
||||
`docs/helpers` contains small go programs creating docs by extracting information from the code. The `main.go` program is manually started with `make docs-generate` or via the CI. It calls the other required programs and has three main responsibilities:
|
||||
|
||||
- Generate docs for envvars in config structs including deprecations if there are any.
|
||||
- Extract and generate docs for `extended` envvars that are not mentioned in config structs (aka "rogue" envvars).
|
||||
- Extract and generate docs for `global` envvars which occur in multiple services.
|
||||
|
||||
## Output Generated
|
||||
|
||||
- The generated yaml files can be found at: `docs/services/_includes` when running locally respectively in the `docs branch` after the CI has finished.
|
||||
- The generated adoc files can be found at: `docs/services/_includes/adoc` when running locally respectively in the `docs branch` after the CI has finished.
|
||||
- The file name for global envvars is named: `global_configvars.adoc`.
|
||||
- The file name for extended envvars is named: `extended_configvars.adoc`.
|
||||
|
||||
## Admin Doc Process
|
||||
|
||||
Whenever a build from the [ocis admin](https://github.com/owncloud/docs-ocis) or any other related documentation is triggered, the files generated here are included into the build process and added in a proper manner defined by the admin documentation. The updated documentation will then show up on the [web](https://doc.owncloud.com/ocis/next/).
|
||||
|
||||
## Branching
|
||||
|
||||
The following is valid for envvars and yaml files related to the doc process:
|
||||
|
||||
* When filing a pull request in the ocis master branch relating to docs, CI runs `make docs-generate` and copies the result into the `docs` branch of ocis. This branch is then taken as base for owncloud.dev and as reference for the [admin docs](https://doc.owncloud.com/ocis/next/).
|
||||
* When running `make docs-generate` locally, the same output is created as above but it stays in the same branch where the make command was issued.
|
||||
|
||||
In both cases, `make docs-generate` removes files in the target folder `_includes` to avoid remnants. All content is recreated.
|
||||
|
||||
On a side note (unrelated to the `docs` branch), [deployment examples](https://github.com/owncloud/ocis/tree/master/deployments/examples) have their own branch related to an ocis stable version to keep the state consistent, which is necessary for the admin documentation.
|
||||
|
||||
## Service-Dependent Output
|
||||
|
||||
For each service available, a file named like `<service name>_configvars.adoc` is created containing a:
|
||||
|
||||
* table on top defining deprecated envvars - if applicable
|
||||
* table containing all envvars with their name, type, default value and description
|
||||
|
||||
The table with deprecations is always printed in the final adoc file even if there are none, but is rendered in the docs build process only if the `HasDeprecations` value is set. This value is automatically handed over via the adoc file. The template file can be found at `docs/templates/ADOC.tmpl`.
|
||||
|
||||
### Generate Envvar Docs for Config Structs
|
||||
|
||||
Generates docs from a template file, mainly extracting `"env"` and `"desc"` tags from the config structs.
|
||||
|
||||
Templates can be found in `docs/helpers` folder. (Same as this `README`.) Check `.tmpl` files
|
||||
|
||||
### Deprecation Process
|
||||
|
||||
For details on deprecation see the [deprecating-variables](https://github.com/owncloud/ocis/blob/master/docs/ocis/development/deprecating-variables.md) documentation.
|
||||
|
||||
## Global Envvars
|
||||
|
||||
Global envvars are gathered by checking if the envvar is available in more than one service. The table created is similar to the service-dependent envvar table but additionally contains a column with all service names where this envvar occurs. The output is rendered in list form where each item is clickable and automatically points to the corresponding service page. The template file can be found at `docs/templates/ADOC_global.tmpl`.
|
||||
|
||||
## Extended Envvars
|
||||
|
||||
### General Extended Envvars Info
|
||||
|
||||
"Extended" envvars are variables that need to be present *before* the core or services are starting up as they depend on the info provided like path for config files etc. Therefore they are _not_ bound to services like other envvars.
|
||||
|
||||
It can happen that extended envvars are found but do not need to be published as they are for internal use only. Those envvars can be defined to be ignored for further processing.
|
||||
|
||||
IMPORTANT:
|
||||
|
||||
- Once a extended envvar has been identified, it is added to the `extended_vars.yaml` file found in this folder but never changed or touched by the process. There is one exception with respect to single/double quote usage. While you can (and will) manually define a text like: `"'/var/lib/ocis'"`, quotes are transformed by the process in the .yaml file to: `'''/var/lib/ocis'''`. There is no need to change this back, as the final step transforms this correctly for the adoc table.
|
||||
|
||||
- Because extended envvars do not have the same structural setup as "normal" envvars (like type, description or defaults), this info needs to be provided manually once - even if found multiple times. Any change of this info will be noticed during the next CI run and published in the next admin docs build.
|
||||
|
||||
- Do not change the sort order of extended envvar blocks as they are automatically reordered alphabetically.
|
||||
|
||||
### Extract Extended Envvars
|
||||
|
||||
The grep command parses the code, looking for `os.Getenv` and passes these contents to a yaml file along with the following information:
|
||||
```golang
|
||||
// Variable contains all information about one rogue envvar
|
||||
type Variable struct {
|
||||
// These field structs are automatically filled:
|
||||
// RawName can be the name of the envvar or the name of its var
|
||||
RawName string `yaml:"rawname"`
|
||||
// Path to the envvar with linenumber
|
||||
Path string `yaml:"path"`
|
||||
// FoundInCode indicates if the variable is still found in the codebase.
|
||||
FoundInCode bool `yaml:"foundincode"`
|
||||
// Name is equal to RawName but will not be overwritten in consecutive runs
|
||||
Name string `yaml:"name"`
|
||||
|
||||
// These field structs need manual filling:
|
||||
// Type of the envvar
|
||||
Type string `yaml:"type"`
|
||||
// DefaultValue of the envvar
|
||||
DefaultValue string `yaml:"default_value"`
|
||||
// Description of what this envvar does
|
||||
Description string `yaml:"description"`
|
||||
// Do not export this envvar into the generated adoc table
|
||||
Ignore bool `yaml:"do_ignore"`
|
||||
|
||||
// For simplicity ignored for now:
|
||||
// DependendServices []Service `yaml:"dependend_services"`
|
||||
}
|
||||
```
|
||||
This yaml file can later be manually edited to add descriptions, default values, etc.
|
||||
|
||||
IMPORTANT: `RawName`, `Path` and `FoundInCode` are automatically filled by the program. DO NOT EDIT THESE VALUES MANUALLY.
|
||||
|
||||
### Generate Extended Envvar Docs
|
||||
|
||||
The process further picks up the `yaml` file generated in the `Extract Rogue Envvars` step and renders it to an adoc file (a table is created) using a go template. The template file for this step can be found at `docs/templates/ADOC_extended.tmpl`.
|
||||
|
||||
## Backporting
|
||||
|
||||
The ocis repo contains branches which are necessary for the documentation. The `docs` branch is related to changes in master, necessary for owncloud.dev and the admin docs referencing master content when it comes to envvars and yaml files.
|
||||
|
||||
When a new stable ocis release (branch) is published, like `stable-2.0`, an additional branch (including CI) is set up manually by the dev team for referencing docs content like `docs-stable-2.0` - related to envvars and yaml files only - and added to the CI.
|
||||
|
||||
In case it is necessary to transport a change from master to a stable branch like `docs-stable-2.0`, you must backport the original changes that will create that file to the `stable-2.0` branch. The CI will then take care of creating the results in the target `docs-stable-2.0`.
|
||||
|
||||
Cases for a backport can be a typo in an envvar description you want to have fixed in a stable branch too or a file was created after the stable branch was set up but needs to be available in that branch.
|
||||
@@ -2,7 +2,6 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@@ -10,11 +9,14 @@ import (
|
||||
"regexp"
|
||||
"strings"
|
||||
"text/template"
|
||||
"sort"
|
||||
|
||||
{{- range $key, $value := .}}
|
||||
pkg{{$key}} "{{$value}}"
|
||||
{{- end}})
|
||||
{{- end}}
|
||||
)
|
||||
|
||||
// ConfigField is the representation of one configuration field
|
||||
type ConfigField struct {
|
||||
EnvVars []string
|
||||
DefaultValue string
|
||||
@@ -24,6 +26,7 @@ type ConfigField struct {
|
||||
DeprecationLink string
|
||||
}
|
||||
|
||||
// DeprecationField holds information about deprecation
|
||||
type DeprecationField struct {
|
||||
DeprecationVersion string
|
||||
DeprecationInfo string
|
||||
@@ -31,6 +34,15 @@ type DeprecationField struct {
|
||||
RemovalVersion string
|
||||
}
|
||||
|
||||
// EnvVar holds information about one envvar
|
||||
type EnvVar struct {
|
||||
Name string
|
||||
DefaultValue string
|
||||
Type string
|
||||
Description string
|
||||
Services []string
|
||||
}
|
||||
|
||||
type templateData struct {
|
||||
ExtensionName string
|
||||
Fields []ConfigField
|
||||
@@ -39,53 +51,128 @@ type templateData struct {
|
||||
}
|
||||
|
||||
func main() {
|
||||
fmt.Println("Generating adoc documentation for environment variables:")
|
||||
content, err := ioutil.ReadFile("../../docs/templates/ADOC.tmpl")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
replacer := strings.NewReplacer(
|
||||
"github.com/owncloud/ocis/v2/services/", "",
|
||||
"/pkg/config/defaults", "",
|
||||
fmt.Println("Generating adoc documentation for environment variables:")
|
||||
adoc, err := os.ReadFile("../../docs/templates/ADOC.tmpl")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
dpr, err := os.ReadFile("../../docs/templates/ADOC_deprecation.tmpl")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
replacer := strings.NewReplacer(
|
||||
"github.com/owncloud/ocis/v2/services/", "",
|
||||
"/pkg/config/defaults", "",
|
||||
)
|
||||
var fields []ConfigField
|
||||
var deprecations []DeprecationField
|
||||
var targetFile *os.File
|
||||
tpl := template.Must(template.New("").Parse(string(content)))
|
||||
var (
|
||||
fields []ConfigField
|
||||
deprecations []DeprecationField
|
||||
adocFile *os.File
|
||||
dprFile *os.File
|
||||
)
|
||||
adoctpl := template.Must(template.New("").Parse(string(adoc)))
|
||||
dprtpl := template.Must(template.New("").Parse(string(dpr)))
|
||||
|
||||
m := map[string]interface{}{
|
||||
{{- range $key, $value := .}}
|
||||
"{{$value}}": *pkg{{$key}}.FullDefaultConfig(),
|
||||
{{- end }}
|
||||
}
|
||||
|
||||
targetFolder := "../../docs/services/_includes/adoc/"
|
||||
for pkg, conf := range m {
|
||||
fields, deprecations = GetAnnotatedVariables(conf)
|
||||
var hasDeprecations bool
|
||||
if len(deprecations) > 0 {
|
||||
hasDeprecations = true
|
||||
m := map[string]interface{}{
|
||||
{{- range $key, $value := .}}
|
||||
"{{$value}}": *pkg{{$key}}.FullDefaultConfig(),
|
||||
{{- end }}
|
||||
}
|
||||
|
||||
if len(fields) > 0 || len(deprecations) > 0 {
|
||||
fmt.Printf("... %s\n", pkg)
|
||||
targetFile, err = os.Create(filepath.Join(targetFolder, replacer.Replace(pkg) + "_configvars.adoc"))
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to create target file: %s", err)
|
||||
}
|
||||
defer targetFile.Close()
|
||||
targetFolder := "../../docs/services/_includes/adoc/"
|
||||
all := make(map[string]EnvVar)
|
||||
for pkg, conf := range m {
|
||||
service := replacer.Replace(pkg)
|
||||
fields, deprecations = GetAnnotatedVariables(conf)
|
||||
var hasDeprecations bool
|
||||
if len(deprecations) > 0 {
|
||||
hasDeprecations = true
|
||||
}
|
||||
|
||||
for _, f := range fields {
|
||||
for _, e := range f.EnvVars {
|
||||
if env, ok := all[e]; ok {
|
||||
env.Services = append(env.Services, service)
|
||||
sort.Slice(env.Services, func(i, j int) bool {
|
||||
return env.Services[i] < env.Services[j]
|
||||
})
|
||||
all[e] = env
|
||||
} else {
|
||||
all[e] = EnvVar{
|
||||
Name: e,
|
||||
Description: f.Description,
|
||||
Type: f.Type,
|
||||
DefaultValue: f.DefaultValue,
|
||||
Services: []string{service},
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if len(fields) > 0 || len(deprecations) > 0 {
|
||||
fmt.Printf("... %s\n", pkg)
|
||||
td := templateData{
|
||||
ExtensionName: replacer.Replace(pkg),
|
||||
ExtensionName: service,
|
||||
Fields: fields,
|
||||
Deprecations: deprecations,
|
||||
HasDeprecations: hasDeprecations ,
|
||||
}
|
||||
if err := tpl.Execute(targetFile, td); err != nil {
|
||||
adocFile, err = os.Create(filepath.Join(targetFolder, service + "_configvars.adoc"))
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to create target file: %s", err)
|
||||
}
|
||||
defer adocFile.Close()
|
||||
|
||||
if err := adoctpl.Execute(adocFile, td); err != nil {
|
||||
log.Fatalf("Failed to execute template: %s", err)
|
||||
}
|
||||
|
||||
dprFile, err = os.Create(filepath.Join(targetFolder, service + "_deprecation.adoc"))
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to create target file: %s", err)
|
||||
}
|
||||
defer dprFile.Close()
|
||||
|
||||
if err := dprtpl.Execute(dprFile, td); err != nil {
|
||||
log.Fatalf("Failed to execute template: %s", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// render global env vars
|
||||
tmplValues := make([]map[string]interface{}, 0)
|
||||
for _, env := range all {
|
||||
if len(env.Services) > 1 {
|
||||
tmplValues = append(tmplValues, map[string]interface{}{
|
||||
"Name": env.Name,
|
||||
"Services": env.Services,
|
||||
"Description": env.Description,
|
||||
"DefaultValue": env.DefaultValue,
|
||||
"Type": env.Type,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// sort
|
||||
sort.Slice(tmplValues, func(i, j int) bool {
|
||||
return tmplValues[i]["Name"].(string) < tmplValues[j]["Name"].(string)
|
||||
})
|
||||
|
||||
glc, err := os.ReadFile("../../docs/templates/ADOC_global.tmpl")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
gltpl := template.Must(template.New("").Parse(string(glc)))
|
||||
glfile, err := os.Create(filepath.Join(targetFolder, "global_configvars.adoc"))
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to create target file: %s", err)
|
||||
}
|
||||
|
||||
if err := gltpl.Execute(glfile, tmplValues); err != nil {
|
||||
log.Printf("Failed to execute template: %s", err)
|
||||
}
|
||||
|
||||
fmt.Println("done")
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"os/exec"
|
||||
@@ -18,7 +17,8 @@ var targets = map[string]string{
|
||||
"environment-variable-docs-generator.go.tmpl": "output/env/environment-variable-docs-generator.go",
|
||||
}
|
||||
|
||||
func main() {
|
||||
// RenderTemplates does something with templates
|
||||
func RenderTemplates() {
|
||||
fmt.Println("Getting relevant packages")
|
||||
paths, err := filepath.Glob("../../services/*/pkg/config/defaults/defaultconfig.go")
|
||||
if err != nil {
|
||||
@@ -33,15 +33,15 @@ func main() {
|
||||
}
|
||||
|
||||
for template, output := range targets {
|
||||
GenerateIntermediateCode(template, output, paths)
|
||||
RunIntermediateCode(output)
|
||||
generateIntermediateCode(template, output, paths)
|
||||
runIntermediateCode(output)
|
||||
}
|
||||
fmt.Println("Cleaning up")
|
||||
os.RemoveAll("output")
|
||||
}
|
||||
|
||||
func GenerateIntermediateCode(templatePath string, intermediateCodePath string, paths []string) {
|
||||
content, err := ioutil.ReadFile(templatePath)
|
||||
func generateIntermediateCode(templatePath string, intermediateCodePath string, paths []string) {
|
||||
content, err := os.ReadFile(templatePath)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
@@ -61,7 +61,7 @@ func GenerateIntermediateCode(templatePath string, intermediateCodePath string,
|
||||
}
|
||||
}
|
||||
|
||||
func RunIntermediateCode(intermediateCodePath string) {
|
||||
func runIntermediateCode(intermediateCodePath string) {
|
||||
fmt.Println("Running intermediate go code for " + intermediateCodePath)
|
||||
defaultPath := "~/.ocis"
|
||||
os.Setenv("OCIS_BASE_DATA_PATH", defaultPath)
|
||||
|
||||
@@ -3,7 +3,6 @@ package main
|
||||
import (
|
||||
"fmt"
|
||||
"html"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@@ -24,7 +23,7 @@ type ConfigField struct {
|
||||
|
||||
func main() {
|
||||
fmt.Println("Generating documentation for environment variables:")
|
||||
content, err := ioutil.ReadFile("../../docs/templates/CONFIGURATION.tmpl")
|
||||
content, err := os.ReadFile("../../docs/templates/CONFIGURATION.tmpl")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,177 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"sort"
|
||||
"strings"
|
||||
"text/template"
|
||||
|
||||
"gopkg.in/yaml.v2"
|
||||
)
|
||||
|
||||
const yamlSource = "extended_vars.yaml"
|
||||
|
||||
// ConfigVars is the main yaml source
|
||||
type ConfigVars struct {
|
||||
Variables []Variable `yaml:"variables"`
|
||||
}
|
||||
|
||||
// Variable contains all information about one rogue envvar
|
||||
type Variable struct {
|
||||
// These field structs are automatically filled:
|
||||
// RawName can be the name of the envvar or the name of its var
|
||||
RawName string `yaml:"rawname"`
|
||||
// Path to the envvar with linenumber
|
||||
Path string `yaml:"path"`
|
||||
// FoundInCode indicates if the variable is still found in the codebase. TODO: delete immediately?
|
||||
FoundInCode bool `yaml:"foundincode"`
|
||||
// Name is equal to RawName but will not be overwritten in consecutive runs
|
||||
Name string `yaml:"name"`
|
||||
|
||||
// These field structs need manual filling:
|
||||
// Type of the envvar
|
||||
Type string `yaml:"type"`
|
||||
// DefaultValue of the envvar
|
||||
DefaultValue string `yaml:"default_value"`
|
||||
// Description of what this envvar does
|
||||
Description string `yaml:"description"`
|
||||
// Ignore this envvar when creating docs?
|
||||
Ignore bool `yaml:"do_ignore"`
|
||||
|
||||
// For simplicity ignored for now:
|
||||
// DependendServices []Service `yaml:"dependend_services"`
|
||||
}
|
||||
|
||||
// GetRogueEnvs extracts the rogue envs from the code
|
||||
func GetRogueEnvs() {
|
||||
curdir, err := os.Getwd()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
fullYamlPath := filepath.Join(curdir, yamlSource)
|
||||
re := regexp.MustCompile(`os.Getenv\(([^\)]+)\)`)
|
||||
vars := &ConfigVars{}
|
||||
fmt.Printf("Reading existing variable definitions from %s\n", fullYamlPath)
|
||||
yfile, err := ioutil.ReadFile(fullYamlPath)
|
||||
if err == nil {
|
||||
err := yaml.Unmarshal(yfile, &vars)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
if err := os.Chdir("../../"); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
fmt.Println("Gathering variable definitions from source")
|
||||
out, err := exec.Command("sh", "-c", "grep -RHn os.Getenv | grep -v extendedEnv.go |grep \\.go").Output()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
lines := strings.Split(string(out), "\n")
|
||||
|
||||
// find current vars
|
||||
currentVars := make(map[string]Variable)
|
||||
for _, l := range lines {
|
||||
fmt.Printf("Parsing %s\n", l)
|
||||
r := strings.SplitN(l, ":\t", 2)
|
||||
if len(r) != 2 || r[0] == "" || r[1] == "" {
|
||||
continue
|
||||
}
|
||||
|
||||
res := re.FindAllSubmatch([]byte(r[1]), -1)
|
||||
if len(res) != 1 || len(res[0]) < 2 {
|
||||
fmt.Printf("Error envvar not matching pattern: %s", r[1])
|
||||
continue
|
||||
}
|
||||
|
||||
path := r[0]
|
||||
name := strings.Trim(string(res[0][1]), "\"")
|
||||
currentVars[path+name] = Variable{
|
||||
RawName: name,
|
||||
Path: path,
|
||||
FoundInCode: true,
|
||||
Name: name,
|
||||
}
|
||||
}
|
||||
|
||||
// adjust existing vars
|
||||
for i, v := range vars.Variables {
|
||||
_, ok := currentVars[v.Path+v.RawName]
|
||||
if !ok {
|
||||
vars.Variables[i].FoundInCode = false
|
||||
continue
|
||||
}
|
||||
|
||||
vars.Variables[i].FoundInCode = true
|
||||
delete(currentVars, v.Path+v.RawName)
|
||||
}
|
||||
|
||||
// add new envvars
|
||||
for _, v := range currentVars {
|
||||
vars.Variables = append(vars.Variables, v)
|
||||
}
|
||||
|
||||
less := func(i, j int) bool {
|
||||
return vars.Variables[i].Name < vars.Variables[j].Name
|
||||
}
|
||||
|
||||
sort.Slice(vars.Variables, less)
|
||||
|
||||
output, err := yaml.Marshal(vars)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
fmt.Printf("Writing new variable definitions to %s\n", fullYamlPath)
|
||||
err = ioutil.WriteFile(fullYamlPath, output, 0666)
|
||||
if err != nil {
|
||||
log.Fatalf("could not write %s", fullYamlPath)
|
||||
}
|
||||
if err := os.Chdir(curdir); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
// RenderGlobalVarsTemplate renders the global vars template
|
||||
func RenderGlobalVarsTemplate() {
|
||||
curdir, err := os.Getwd()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
fullYamlPath := filepath.Join(curdir, yamlSource)
|
||||
|
||||
content, err := ioutil.ReadFile("../../docs/templates/ADOC_extended.tmpl")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
targetFolder := "../../docs/services/_includes/adoc/"
|
||||
|
||||
vars := &ConfigVars{}
|
||||
fmt.Printf("Reading existing variable definitions from %s\n", fullYamlPath)
|
||||
yfile, err := ioutil.ReadFile(fullYamlPath)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
err = yaml.Unmarshal(yfile, &vars)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
targetFile, err := os.Create(filepath.Join(targetFolder, "extended_configvars.adoc"))
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to create target file: %s", err)
|
||||
}
|
||||
defer targetFile.Close()
|
||||
|
||||
tpl := template.Must(template.New("").Parse(string(content)))
|
||||
if err = tpl.Execute(targetFile, *vars); err != nil {
|
||||
log.Fatalf("Failed to execute template: %s", err)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
variables:
|
||||
- rawname: CS3_GATEWAY
|
||||
path: services/idp/pkg/backends/cs3/bootstrap/cs3.go:76
|
||||
foundincode: true
|
||||
name: CS3_GATEWAY
|
||||
type: ""
|
||||
default_value: ""
|
||||
description: ""
|
||||
do_ignore: true
|
||||
- rawname: CS3_MACHINE_AUTH_API_KEY
|
||||
path: services/idp/pkg/backends/cs3/bootstrap/cs3.go:77
|
||||
foundincode: true
|
||||
name: CS3_MACHINE_AUTH_API_KEY
|
||||
type: ""
|
||||
default_value: ""
|
||||
description: ""
|
||||
do_ignore: true
|
||||
- rawname: MICRO_LOG_LEVEL
|
||||
path: ocis-pkg/log/log.go:34
|
||||
foundincode: true
|
||||
name: MICRO_LOG_LEVEL
|
||||
type: string
|
||||
default_value: Error
|
||||
description: Set the log level for the internal go micro framework. Only change
|
||||
on supervision of ownCloud Support.
|
||||
do_ignore: false
|
||||
- rawname: MICRO_LOG_LEVEL
|
||||
path: ocis-pkg/log/log.go:30
|
||||
foundincode: true
|
||||
name: MICRO_LOG_LEVEL
|
||||
type: ""
|
||||
default_value: ""
|
||||
description: ""
|
||||
do_ignore: true
|
||||
- rawname: registryEnv
|
||||
path: ocis-pkg/registry/registry.go:44
|
||||
foundincode: true
|
||||
name: MICRO_REGISTRY
|
||||
type: string
|
||||
default_value: ""
|
||||
description: 'Go micro registry type to use. Supported types are: ''nats'', ''kubernetes'',
|
||||
''etcd'', ''consul'' and ''memory''. Will be selected automatically. Only change
|
||||
on supervision of ownCloud Support.'
|
||||
do_ignore: false
|
||||
- rawname: registryAddressEnv
|
||||
path: ocis-pkg/registry/registry.go:42
|
||||
foundincode: true
|
||||
name: MICRO_REGISTRY_ADDRESS
|
||||
type: string
|
||||
default_value: ""
|
||||
description: The bind address of the internal go micro framework. Only change on
|
||||
supervision of ownCloud Support.
|
||||
do_ignore: false
|
||||
- rawname: OCIS_BASE_DATA_PATH
|
||||
path: ocis-pkg/config/defaults/paths.go:23
|
||||
foundincode: true
|
||||
name: OCIS_BASE_DATA_PATH
|
||||
type: string
|
||||
default_value: '''/var/lib/ocis'' or ''$HOME/.ocis/'''
|
||||
description: The base directory location used by several services and for user data.
|
||||
Predefined to '/var/lib/ocis' for container images (inside the container) or '$HOME/.ocis/'
|
||||
for binary releases. Services can have, if available, an individual setting with
|
||||
an own environment variable.
|
||||
do_ignore: false
|
||||
- rawname: OCIS_CONFIG_DIR
|
||||
path: ocis-pkg/config/defaults/paths.go:56
|
||||
foundincode: true
|
||||
name: OCIS_CONFIG_DIR
|
||||
type: string
|
||||
default_value: '''/etc/ocis'' or ''$HOME/.ocis/config'''
|
||||
description: The default directory location for config files. Predefined to '/etc/ocis'
|
||||
for container images (inside the container) or '$HOME/.ocis/config' for binary
|
||||
releases.
|
||||
do_ignore: false
|
||||
- rawname: parts[0]
|
||||
path: ocis-pkg/config/envdecode/envdecode.go:382
|
||||
foundincode: true
|
||||
name: parts[0]
|
||||
type: ""
|
||||
default_value: ""
|
||||
description: false positive - code that extract envvars for config structs
|
||||
do_ignore: true
|
||||
@@ -0,0 +1,7 @@
|
||||
package main
|
||||
|
||||
func main() {
|
||||
RenderTemplates()
|
||||
GetRogueEnvs()
|
||||
RenderGlobalVarsTemplate()
|
||||
}
|
||||
@@ -89,15 +89,12 @@ make -C tests/acceptance/docker clean
|
||||
|
||||
## Testing with test suite natively installed
|
||||
|
||||
We are using the ownCloud 10 acceptance test suite against oCIS.
|
||||
We have two sets of tests:
|
||||
- `test-acceptance-from-core-api` set was transferred from [core](https://github.com/owncloud/core) repository
|
||||
The suite name of all tests transferred from the core starts with "core"
|
||||
|
||||
### Getting the tests
|
||||
- `test-acceptance-api` set was created for ocis. Mainly for testing spaces features
|
||||
|
||||
All you need to do to get the acceptance tests is check out the core repo:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/owncloud/core.git
|
||||
```
|
||||
|
||||
### Run ocis
|
||||
|
||||
@@ -106,47 +103,49 @@ Create an up-to-date ocis binary by [building oCIS]({{< ref "build" >}})
|
||||
To start ocis:
|
||||
|
||||
```bash
|
||||
IDM_ADMIN_PASSWORD=admin ocis/bin/ocis init --insecure true
|
||||
OCIS_INSECURE=true PROXY_ENABLE_BASIC_AUTH=true ocis/bin/ocis server
|
||||
IDM_ADMIN_PASSWORD=admin \
|
||||
ocis/bin/ocis init --insecure true
|
||||
|
||||
OCIS_INSECURE=true PROXY_ENABLE_BASIC_AUTH=true \
|
||||
ocis/bin/ocis server
|
||||
```
|
||||
|
||||
`PROXY_ENABLE_BASIC_AUTH` will allow the acceptance tests to make requests against the provisioning api (and other endpoints) using basic auth.
|
||||
|
||||
### Run the acceptance tests
|
||||
|
||||
First we will need to clone the testing app in owncloud which contains the skeleton files required for running the tests.
|
||||
In the ownCloud 10 core clone the testing app with the following command:
|
||||
### Run the test-acceptance-from-core-api tests
|
||||
|
||||
```bash
|
||||
git clone https://github.com/owncloud/testing apps/testing
|
||||
make test-acceptance-from-core-api \
|
||||
TEST_SERVER_URL=https://localhost:9200 \
|
||||
TEST_WITH_GRAPH_API=true \
|
||||
TEST_OCIS=true \
|
||||
```
|
||||
Note: This command only works for suites that start with core
|
||||
|
||||
Then run the api acceptance tests with the following command from the root of the ownCloud 10 core repository:
|
||||
### Run the test-acceptance-api tests
|
||||
|
||||
```bash
|
||||
make test-acceptance-api \
|
||||
TEST_SERVER_URL=https://localhost:9200 \
|
||||
TEST_WITH_GRAPH_API=true \
|
||||
PATH_TO_OCIS=/var/www/ocis \
|
||||
PATH_TO_CORE=. \
|
||||
TEST_OCIS=true \
|
||||
STORAGE_DRIVER=OCIS \
|
||||
SKELETON_DIR=apps/testing/data/apiSkeleton \
|
||||
BEHAT_FILTER_TAGS='~@notToImplementOnOCIS&&~@toImplementOnOCIS'
|
||||
```
|
||||
|
||||
Make sure to adjust the settings `TEST_SERVER_URL` and `PATH_TO_OCIS` according to your environment.
|
||||
Make sure to adjust the settings `TEST_SERVER_URL` according to your environment.
|
||||
|
||||
This will run all tests that are relevant to oCIS.
|
||||
|
||||
To run a single feature add `BEHAT_FEATURE=<feature file>`
|
||||
To run a single feature add `BEHAT_FEATURE=<feature file>`
|
||||
example: `BEHAT_SUITE=tests/acceptance/features/apiGraph/createUser.feature`
|
||||
To run a single test add `BEHAT_FEATURE=<file.feature:(line number)>`
|
||||
example: `BEHAT_SUITE=tests/acceptance/features/apiGraph/createUser.feature:12`
|
||||
To run a single suite add `BEHAT_SUITE=<test suite>`
|
||||
example: `BEHAT_SUITE=apiGraph`
|
||||
|
||||
To run tests with a different storage driver set `STORAGE_DRIVER` to the correct value. It can be set to `OCIS` or `OWNCLOUD` and uses `OWNCLOUD` as the default value.
|
||||
|
||||
### use existing tests for BDD
|
||||
|
||||
As a lot of scenarios are written for oC10, we can use those tests for Behaviour driven development in ocis.
|
||||
Every scenario that does not work in oCIS with "ocis" storage, is listed in `tests/acceptance/expected-failures-on-OCIS-storage.md` with a link to the related issue.
|
||||
As a lot of scenarios from `test-acceptance-from-core-api` are written for oC10, we can use those tests for Behaviour driven development in ocis.
|
||||
Every scenario that does not work in oCIS with "ocis" storage, is listed in `tests/acceptance/expected-failures-API-on-OCIS-storage.md` with a link to the related issue.
|
||||
|
||||
Those scenarios are run in the ordinary acceptance test pipeline in CI. The scenarios that fail are checked against the
|
||||
expected failures. If there are any differences then the CI pipeline fails.
|
||||
@@ -155,30 +154,24 @@ The tests are not currently run in CI with the OWNCLOUD or EOS storage drivers,
|
||||
|
||||
If you want to work on a specific issue
|
||||
|
||||
1. adjust the core commit id to the latest commit in core so that CI will run the latest test code and scenarios from core.
|
||||
For that change `CORE_COMMITID` in `.drone.env`:
|
||||
|
||||
# The test runner source for API tests
|
||||
CORE_COMMITID=38c91e5cf5fc4ffdc0536ba1d147a2a618ef83b5
|
||||
CORE_BRANCH=master
|
||||
|
||||
2. locally run each of the tests marked with that issue in the expected failures file.
|
||||
1. locally run each of the tests marked with that issue in the expected failures file.
|
||||
|
||||
E.g.:
|
||||
|
||||
```bash
|
||||
make test-acceptance-api \
|
||||
make test-acceptance-from-core-api \
|
||||
TEST_SERVER_URL=https://localhost:9200 \
|
||||
TEST_OCIS=true \
|
||||
TEST_WITH_GRAPH_API=true \
|
||||
STORAGE_DRIVER=OCIS \
|
||||
BEHAT_FEATURE='tests/acceptance/features/apiComments/comments.feature:123'
|
||||
BEHAT_FEATURE='tests/acceptance/features/coreApiVersions/fileVersions.feature:147'
|
||||
```
|
||||
|
||||
3. the tests will fail, try to understand how and why they are failing
|
||||
4. fix the code
|
||||
5. go back to 2. and repeat till the tests are passing.
|
||||
6. remove those tests from the expected failures file
|
||||
7. make a PR that has the fixed code, and the relevant lines removed from the expected failures file.
|
||||
2. the tests will fail, try to understand how and why they are failing
|
||||
3. fix the code
|
||||
4. go back to 1. and repeat till the tests are passing.
|
||||
5. remove those tests from the expected failures file
|
||||
6. make a PR that has the fixed code, and the relevant lines removed from the expected failures file.
|
||||
|
||||
## Running tests for parallel deployment
|
||||
|
||||
|
||||
Vendored
+1
@@ -6,6 +6,7 @@ ifeval::[{show-deprecation} == true]
|
||||
|
||||
[[deprecation-note]]
|
||||
[caption=]
|
||||
.Deprecation notes for the {{ .ExtensionName }} service
|
||||
[width="100%",cols="~,~,~,~",options="header"]
|
||||
|===
|
||||
| Deprecation Info
|
||||
|
||||
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
:show-deprecation: {{ .HasDeprecations }}
|
||||
|
||||
Vendored
+27
@@ -0,0 +1,27 @@
|
||||
// collected through docs/helpers/extendedEnv.go
|
||||
|
||||
[caption=]
|
||||
.Environment variables with extended scope not included in a service
|
||||
[width="100%",cols="~,~,~,~",options="header"]
|
||||
|===
|
||||
| Name
|
||||
| Type
|
||||
| Default Value
|
||||
| Description
|
||||
|
||||
{{- range .Variables}}
|
||||
|
||||
{{- if .Ignore }}
|
||||
{{ continue }}
|
||||
{{- end }}
|
||||
|
||||
a| `{{- .Name }}` +
|
||||
a| [subs=-attributes]
|
||||
++{{ .Type }} ++
|
||||
a| [subs=-attributes]
|
||||
++{{.DefaultValue}} ++
|
||||
a| [subs=-attributes]
|
||||
++{{.Description}} ++
|
||||
|
||||
{{- end }}
|
||||
|===
|
||||
Vendored
+33
@@ -0,0 +1,33 @@
|
||||
// collected through docs/helpers/adoc-generator.go.tmpl
|
||||
|
||||
[.landscape]
|
||||
[caption=]
|
||||
.Environment variables with global scope available in multiple services
|
||||
[width="100%",cols="30%,25%,~,~,~",options="header"]
|
||||
|===
|
||||
| Name
|
||||
| Services
|
||||
| Type
|
||||
| Default Value
|
||||
| Description
|
||||
|
||||
{{ range . }}
|
||||
|
||||
a| `{{ .Name }}`
|
||||
|
||||
a| [subs=attributes+]
|
||||
{{- range .Services}}
|
||||
* xref:{s-path}/{{ . }}.adoc[{{ . }}] +
|
||||
{{- end }}
|
||||
|
||||
a| [subs=-attributes]
|
||||
++{{ .Type }} ++
|
||||
|
||||
a| [subs=-attributes]
|
||||
++{{ .DefaultValue }} ++
|
||||
|
||||
a| [subs=-attributes]
|
||||
{{ .Description }}
|
||||
|
||||
{{- end }}
|
||||
|===
|
||||
@@ -73,7 +73,7 @@ type Config struct {
|
||||
TransferSecret string `yaml:"transfer_secret" env:"STORAGE_TRANSFER_SECRET"`
|
||||
SystemUserID string `yaml:"system_user_id" env:"OCIS_SYSTEM_USER_ID" desc:"ID of the oCIS storage-system system user. Admins need to set the ID for the storage-system system user in this config option which is then used to reference the user. Any reasonable long string is possible, preferably this would be an UUIDv4 format."`
|
||||
SystemUserAPIKey string `yaml:"system_user_api_key" env:"OCIS_SYSTEM_USER_API_KEY" desc:"API key for the storage-system system user."`
|
||||
AdminUserID string `yaml:"admin_user_id" env:"OCIS_ADMIN_USER_ID" desc:"ID of a user, that should receive admin privileges."`
|
||||
AdminUserID string `yaml:"admin_user_id" env:"OCIS_ADMIN_USER_ID" desc:"ID of a user, that should receive admin privileges. Consider that the UUID can be encoded in some LDAP deployment configurations like in .ldif files. These need to be decoded beforehand."`
|
||||
Runtime Runtime `yaml:"runtime"`
|
||||
|
||||
AppProvider *appProvider.Config `yaml:"app_provider"`
|
||||
|
||||
@@ -75,5 +75,5 @@ type Commons struct {
|
||||
TransferSecret string `mask:"password" yaml:"transfer_secret,omitempty" env:"REVA_TRANSFER_SECRET"`
|
||||
SystemUserID string `yaml:"system_user_id" env:"OCIS_SYSTEM_USER_ID" desc:"ID of the oCIS storage-system system user. Admins need to set the ID for the storage-system system user in this config option which is then used to reference the user. Any reasonable long string is possible, preferably this would be an UUIDv4 format."`
|
||||
SystemUserAPIKey string `mask:"password" yaml:"system_user_api_key" env:"SYSTEM_USER_API_KEY"`
|
||||
AdminUserID string `yaml:"admin_user_id" env:"OCIS_ADMIN_USER_ID" desc:"ID of a user, that should receive admin privileges."`
|
||||
AdminUserID string `yaml:"admin_user_id" env:"OCIS_ADMIN_USER_ID" desc:"ID of a user, that should receive admin privileges. Consider that the UUID can be encoded in some LDAP deployment configurations like in .ldif files. These need to be decoded beforehand."`
|
||||
}
|
||||
@@ -69,7 +69,7 @@ type JSONProvider struct {
|
||||
|
||||
type LDAPProvider struct {
|
||||
URI string `yaml:"uri" env:"LDAP_URI;AUTH_BASIC_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;AUTH_BASIC_LDAP_CACERT" desc:"Path/File name for the root CA certificate (in PEM format) used to validate TLS server certificates of the LDAP service."`
|
||||
CACert string `yaml:"ca_cert" env:"LDAP_CACERT;AUTH_BASIC_LDAP_CACERT" desc:"Path/File name for the root CA certificate (in PEM format) used to validate TLS server certificates of the LDAP service. If not defined, the root directory derives from $OCIS_BASE_DATA_PATH:/idm."`
|
||||
Insecure bool `yaml:"insecure" env:"LDAP_INSECURE;AUTH_BASIC_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;AUTH_BASIC_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;AUTH_BASIC_LDAP_BIND_PASSWORD" desc:"Password to use for authenticating the 'bind_dn'."`
|
||||
|
||||
@@ -117,12 +117,12 @@ type DataGateway struct {
|
||||
}
|
||||
|
||||
type OCS struct {
|
||||
Prefix string `yaml:"prefix" env:"FRONTEND_OCS_PREFIX" desc:"Path prefix for the OCS service"`
|
||||
SharePrefix string `yaml:"share_prefix" env:"FRONTEND_OCS_SHARE_PREFIX" desc:"Path prefix for shares."`
|
||||
Prefix string `yaml:"prefix" env:"FRONTEND_OCS_PREFIX" desc:"URL path prefix for the OCS service. Note that the string must not start with '/'."`
|
||||
SharePrefix string `yaml:"share_prefix" env:"FRONTEND_OCS_SHARE_PREFIX" desc:"Path prefix for shares as part of an ocis resource. Note that the path must start with '/'."`
|
||||
HomeNamespace string `yaml:"home_namespace" env:"FRONTEND_OCS_HOME_NAMESPACE" desc:"Homespace namespace identifier."`
|
||||
AdditionalInfoAttribute string `yaml:"additional_info_attribute" env:"FRONTEND_OCS_ADDITIONAL_INFO_ATTRIBUTE" desc:"Additional information attribute for the user like {{.Mail}}."`
|
||||
ResourceInfoCacheTTL int `yaml:"resource_info_cache_ttl" env:"FRONTEND_OCS_RESOURCE_INFO_CACHE_TTL" desc:"Max TTL in seconds for the resource info cache. 0 disables the cache."`
|
||||
ResourceInfoCacheType string `yaml:"resource_info_cache_type" env:"FRONTEND_OCS_RESOURCE_INFO_CACHE_TYPE" desc:"Resource info cache type. Supported values are 'memory' and 'redis'."`
|
||||
ResourceInfoCacheType string `yaml:"resource_info_cache_type" env:"FRONTEND_OCS_RESOURCE_INFO_CACHE_TYPE" desc:"The type of the resource info cache. Supported values are 'memory' and 'redis'."`
|
||||
ResourceInfoCaches ResourceInfoCaches `yaml:"resource_info_caches,omitempty"` // only used for redis
|
||||
CacheWarmupDriver string `yaml:"cache_warmup_driver,omitempty"` // not supported by the oCIS product, therefore not part of docs
|
||||
CacheWarmupDrivers CacheWarmupDrivers `yaml:"cache_warmup_drivers,omitempty"` // not supported by the oCIS product, therefore not part of docs
|
||||
@@ -136,9 +136,9 @@ type ResourceInfoCaches struct {
|
||||
|
||||
// RedisDriver holds redis configuration
|
||||
type RedisDriver struct {
|
||||
Address string `yaml:"address" env:"FRONTEND_OCS_RESOURCE_INFO_CACHE_REDIS_ADDR" desc:"Redis service address"`
|
||||
Username string `yaml:"username" env:"FRONTEND_OCS_RESOURCE_INFO_CACHE_REDIS_USERNAME" desc:"Redis username"`
|
||||
Password string `yaml:"password" env:"FRONTEND_OCS_RESOURCE_INFO_CACHE_REDIS_PASSWORD" desc:"Redis password"`
|
||||
Address string `yaml:"address" env:"FRONTEND_OCS_RESOURCE_INFO_CACHE_REDIS_ADDR" desc:"A comma separated list of addresses to access the configured store. This has no effect when the 'memory' store is configured. Note that the behaviour how addresses are used is dependent on the library of the configured store."`
|
||||
Username string `yaml:"username" env:"FRONTEND_OCS_RESOURCE_INFO_CACHE_REDIS_USERNAME" desc:"The username to access the redis cache."`
|
||||
Password string `yaml:"password" env:"FRONTEND_OCS_RESOURCE_INFO_CACHE_REDIS_PASSWORD" desc:"The password to access the redis cache."`
|
||||
}
|
||||
|
||||
type CacheWarmupDrivers struct {
|
||||
|
||||
@@ -83,7 +83,7 @@ type StorageRegistry struct {
|
||||
Driver string `yaml:"driver"` //TODO: configure via env?
|
||||
Rules []string `yaml:"rules"` //TODO: configure via env?
|
||||
JSON string `yaml:"json"` //TODO: configure via env?
|
||||
StorageUsersMountID string `yaml:"storage_users_mount_id" env:"GATEWAY_STORAGE_USERS_MOUNT_ID" desc:"Mount ID of this storage. This ID needs to be unique."`
|
||||
StorageUsersMountID string `yaml:"storage_users_mount_id" env:"GATEWAY_STORAGE_USERS_MOUNT_ID" desc:"Mount ID of this storage. Admins can set the ID for the storage in this config option manually which is then used to reference the storage. Any reasonable long string is possible, preferably this would be an UUIDv4 format."`
|
||||
}
|
||||
|
||||
// Cache holds cache config
|
||||
|
||||
@@ -39,7 +39,7 @@ type Spaces struct {
|
||||
|
||||
type LDAP struct {
|
||||
URI string `yaml:"uri" env:"LDAP_URI;GRAPH_LDAP_URI" desc:"URI of the LDAP Server to connect to. Supported URI schemes are 'ldaps://' and 'ldap://'"`
|
||||
CACert string `yaml:"cacert" env:"LDAP_CACERT;GRAPH_LDAP_CACERT" desc:"Path/File name for the root CA certificate (in PEM format) used to validate TLS server certificates of the LDAP service."`
|
||||
CACert string `yaml:"cacert" env:"LDAP_CACERT;GRAPH_LDAP_CACERT" desc:"Path/File name for the root CA certificate (in PEM format) used to validate TLS server certificates of the LDAP service. If not defined, the root directory derives from $OCIS_BASE_DATA_PATH:/idm."`
|
||||
Insecure bool `yaml:"insecure" env:"LDAP_INSECURE;GRAPH_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;GRAPH_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;GRAPH_LDAP_BIND_PASSWORD" desc:"Password to use for authenticating the 'bind_dn'."`
|
||||
|
||||
@@ -68,7 +68,7 @@ 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/File name for the root CA certificate (in PEM format) used to validate TLS server certificates of the LDAP service."`
|
||||
CACert string `yaml:"ca_cert" env:"LDAP_CACERT;GROUPS_LDAP_CACERT" desc:"Path/File name for the root CA certificate (in PEM format) used to validate TLS server certificates of the LDAP service. If not defined, the root directory derives from $OCIS_BASE_DATA_PATH:/idm."`
|
||||
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'."`
|
||||
|
||||
@@ -20,16 +20,16 @@ type Config struct {
|
||||
CreateDemoUsers bool `yaml:"create_demo_users" env:"IDM_CREATE_DEMO_USERS;ACCOUNTS_DEMO_USERS_AND_GROUPS" desc:"Flag to enable or disable the creation of the demo users."`
|
||||
|
||||
ServiceUserPasswords ServiceUserPasswords `yaml:"service_user_passwords"`
|
||||
AdminUserID string `yaml:"admin_user_id" env:"OCIS_ADMIN_USER_ID;IDM_ADMIN_USER_ID" desc:"ID of the user that should receive admin privileges."`
|
||||
AdminUserID string `yaml:"admin_user_id" env:"OCIS_ADMIN_USER_ID;IDM_ADMIN_USER_ID" desc:"ID of the user that should receive admin privileges. Consider that the UUID can be encoded in some LDAP deployment configurations like in .ldif files. These need to be decoded beforehand."`
|
||||
|
||||
Context context.Context `yaml:"-"`
|
||||
}
|
||||
|
||||
type Settings struct {
|
||||
LDAPSAddr string `yaml:"ldaps_addr" env:"IDM_LDAPS_ADDR" desc:"Listen address for the LDAPS listener (ip-addr:port)."`
|
||||
Cert string `yaml:"cert" env:"IDM_LDAPS_CERT" desc:"File name of the TLS server certificate for the LDAPS listener."`
|
||||
Key string `yaml:"key" env:"IDM_LDAPS_KEY" desc:"File name for the TLS certificate key for the server certificate."`
|
||||
DatabasePath string `yaml:"database" env:"IDM_DATABASE_PATH" desc:"Full path to the IDM backend database."`
|
||||
Cert string `yaml:"cert" env:"IDM_LDAPS_CERT" desc:"File name of the TLS server certificate for the LDAPS listener. If not defined, the root directory derives from $OCIS_BASE_DATA_PATH:/idm."`
|
||||
Key string `yaml:"key" env:"IDM_LDAPS_KEY" desc:"File name for the TLS certificate key for the server certificate. If not defined, the root directory derives from $OCIS_BASE_DATA_PATH:/idm."`
|
||||
DatabasePath string `yaml:"database" env:"IDM_DATABASE_PATH" desc:"Full path to the IDM backend database. If not defined, the root directory derives from $OCIS_BASE_DATA_PATH:/idm."`
|
||||
}
|
||||
|
||||
type ServiceUserPasswords struct {
|
||||
|
||||
@@ -33,7 +33,7 @@ type Config struct {
|
||||
// Ldap defines the available LDAP configuration.
|
||||
type Ldap struct {
|
||||
URI string `yaml:"uri" env:"LDAP_URI;IDP_LDAP_URI" desc:"Url of the LDAP service to use as IDP."`
|
||||
TLSCACert string `yaml:"cacert" env:"LDAP_CACERT;IDP_LDAP_TLS_CACERT" desc:"Path/File name for the root CA certificate (in PEM format) used to validate TLS server certificates of the LDAP service."`
|
||||
TLSCACert string `yaml:"cacert" env:"LDAP_CACERT;IDP_LDAP_TLS_CACERT" desc:"Path/File name for the root CA certificate (in PEM format) used to validate TLS server certificates of the LDAP service. If not defined, the root directory derives from $OCIS_BASE_DATA_PATH:/idp."`
|
||||
|
||||
BindDN string `yaml:"bind_dn" env:"LDAP_BIND_DN;IDP_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;IDP_LDAP_BIND_PASSWORD" desc:"Password to use for authenticating the 'bind_dn'."`
|
||||
@@ -90,7 +90,7 @@ type Settings struct {
|
||||
AllowClientGuests bool `yaml:"allow_client_guests" env:"IDP_ALLOW_CLIENT_GUESTS" desc:"Allow guest clients to access oCIS."`
|
||||
AllowDynamicClientRegistration bool `yaml:"allow_dynamic_client_registration" env:"IDP_ALLOW_DYNAMIC_CLIENT_REGISTRATION" desc:"Allow dynamic client registration."`
|
||||
|
||||
EncryptionSecretFile string `yaml:"encrypt_secret_file" env:"IDP_ENCRYPTION_SECRET_FILE" desc:"Path to the encryption secret file, if unset, a new certificate will be autogenerated upon each restart, thus invalidating all existing sessions."`
|
||||
EncryptionSecretFile string `yaml:"encrypt_secret_file" env:"IDP_ENCRYPTION_SECRET_FILE" desc:"Path to the encryption secret file, if unset, a new certificate will be autogenerated upon each restart, thus invalidating all existing sessions. If not defined, the root directory derives from $OCIS_BASE_DATA_PATH:/idp."`
|
||||
|
||||
Listen string
|
||||
|
||||
@@ -105,7 +105,7 @@ type Settings struct {
|
||||
|
||||
SigningKid string `yaml:"signing_kid" env:"IDP_SIGNING_KID" desc:"Value of the KID (Key ID) field which is used in created tokens to uniquely identify the signing-private-key."`
|
||||
SigningMethod string `yaml:"signing_method" env:"IDP_SIGNING_METHOD" desc:"Signing method of IDP requests like 'PS256'"`
|
||||
SigningPrivateKeyFiles []string `yaml:"signing_private_key_files" env:"IDP_SIGNING_PRIVATE_KEY_FILES" desc:"Private key files for signing IDP requests."`
|
||||
SigningPrivateKeyFiles []string `yaml:"signing_private_key_files" env:"IDP_SIGNING_PRIVATE_KEY_FILES" desc:"Private key files for signing IDP requests. If not defined, the root directory derives from $OCIS_BASE_DATA_PATH:/idp."`
|
||||
ValidationKeysPath string `yaml:"validation_keys_path" env:"IDP_VALIDATION_KEYS_PATH" desc:"Path to validation keys for IDP requests."`
|
||||
|
||||
CookieBackendURI string
|
||||
|
||||
@@ -5,7 +5,7 @@ type HTTP struct {
|
||||
Addr string `yaml:"addr" env:"IDP_HTTP_ADDR" desc:"The bind address of the HTTP service."`
|
||||
Root string `yaml:"root" env:"IDP_HTTP_ROOT" desc:"Subdirectory that serves as the root for this HTTP service."`
|
||||
Namespace string `yaml:"-"`
|
||||
TLSCert string `yaml:"tls_cert" env:"IDP_TRANSPORT_TLS_CERT" desc:"Path/File name of the TLS server certificate (in PEM format) for the IDP service."`
|
||||
TLSKey string `yaml:"tls_key" env:"IDP_TRANSPORT_TLS_KEY" desc:"Path/File name for the TLS certificate key (in PEM format) for the server certificate to use for the IDP service."`
|
||||
TLS bool `yaml:"tls" env:"IDP_TLS" desc:"Enable/Disable HTTPS for the IDP service."`
|
||||
TLSCert string `yaml:"tls_cert" env:"IDP_TRANSPORT_TLS_CERT" desc:"Path/File name of the TLS server certificate (in PEM format) for the IDP service. If not defined, the root directory derives from $OCIS_BASE_DATA_PATH:/idp."`
|
||||
TLSKey string `yaml:"tls_key" env:"IDP_TRANSPORT_TLS_KEY" desc:"Path/File name for the TLS certificate key (in PEM format) for the server certificate to use for the IDP service. If not defined, the root directory derives from $OCIS_BASE_DATA_PATH:/idp."`
|
||||
TLS bool `yaml:"tls" env:"IDP_TLS" desc:"Disable or Enable HTTPS for the communication between the Proxy service and the IDP service. If set to 'true', the key and cert files need to be configured and present."`
|
||||
}
|
||||
@@ -25,9 +25,9 @@ type Nats struct {
|
||||
Host string `yaml:"host" env:"NATS_NATS_HOST" desc:"Bind address."`
|
||||
Port int `yaml:"port" env:"NATS_NATS_PORT" desc:"Bind port."`
|
||||
ClusterID string `yaml:"clusterid" env:"NATS_NATS_CLUSTER_ID" desc:"ID of the NATS cluster."`
|
||||
StoreDir string `yaml:"store_dir" env:"NATS_NATS_STORE_DIR" desc:"The directory where the filesystem storage will store NATS JetStream data. If not definied, the root directory derives from $OCIS_BASE_DATA_PATH:/nats."`
|
||||
TLSCert string `yaml:"tls_cert" env:"NATS_TLS_CERT" desc:"Path/File name of the TLS server certificate (in PEM format) for the NATS listener."`
|
||||
TLSKey string `yaml:"tls_key" env:"NATS_TLS_KEY" desc:"Path/File name for the TLS certificate key (in PEM format) for the NATS listener."`
|
||||
StoreDir string `yaml:"store_dir" env:"NATS_NATS_STORE_DIR" desc:"The directory where the filesystem storage will store NATS JetStream data. If not defined, the root directory derives from $OCIS_BASE_DATA_PATH:/nats."`
|
||||
TLSCert string `yaml:"tls_cert" env:"NATS_TLS_CERT" desc:"Path/File name of the TLS server certificate (in PEM format) for the NATS listener. If not defined, the root directory derives from $OCIS_BASE_DATA_PATH:/nats."`
|
||||
TLSKey string `yaml:"tls_key" env:"NATS_TLS_KEY" desc:"Path/File name for the TLS certificate key (in PEM format) for the NATS listener. If not defined, the root directory derives from $OCIS_BASE_DATA_PATH:/nats."`
|
||||
TLSSkipVerifyClientCert bool `yaml:"tls_skip_verify_client_cert" env:"OCIS_INSECURE;NATS_TLS_SKIP_VERIFY_CLIENT_CERT" desc:"Whether the NATS server should skip the client certificate verification during the TLS handshake."`
|
||||
EnableTLS bool `yaml:"enable_tls" env:"OCIS_EVENTS_ENABLE_TLS;NATS_EVENTS_ENABLE_TLS" desc:"Enable TLS for the connection to the events broker. The events broker is the ocis service which receives and delivers events between the services.."`
|
||||
}
|
||||
@@ -27,7 +27,7 @@ type Config struct {
|
||||
PolicySelector *PolicySelector `yaml:"policy_selector"`
|
||||
PreSignedURL PreSignedURL `yaml:"pre_signed_url"`
|
||||
AccountBackend string `yaml:"account_backend" env:"PROXY_ACCOUNT_BACKEND_TYPE" desc:"Account backend the PROXY service should use. Currently only 'cs3' is possible here."`
|
||||
UserOIDCClaim string `yaml:"user_oidc_claim" env:"PROXY_USER_OIDC_CLAIM" desc:"The name of an OpenID Connect claim that should be used for resolving users with the account backend. Currently defaults to 'email'."`
|
||||
UserOIDCClaim string `yaml:"user_oidc_claim" env:"PROXY_USER_OIDC_CLAIM" desc:"The name of an OpenID Connect claim that is used for resolving users with the account backend. The value of the claim must hold a per user unique, stable and non re-assignable identifier. The availability of claims depends on your Identity Provider. There are common claims available for most Identity providers like 'email' or 'preferred_user' but you can also add your own claim."`
|
||||
UserCS3Claim string `yaml:"user_cs3_claim" env:"PROXY_USER_CS3_CLAIM" desc:"The name of a CS3 user attribute (claim) that should be mapped to the 'user_oidc_claim'. Supported values are 'username', 'mail' and 'userid'."`
|
||||
MachineAuthAPIKey string `mask:"password" yaml:"machine_auth_api_key" env:"OCIS_MACHINE_AUTH_API_KEY;PROXY_MACHINE_AUTH_API_KEY" desc:"Machine auth API key used to validate internal requests necessary to access resources from other services."`
|
||||
AutoprovisionAccounts bool `yaml:"auto_provision_accounts" env:"PROXY_AUTOPROVISION_ACCOUNTS" desc:"Set this to 'true' to automatically provision users that do not yet exist in the users service on-demand upon first sign-in. To use this a write-enabled libregraph user backend needs to be setup an running."`
|
||||
|
||||
@@ -5,7 +5,7 @@ type HTTP struct {
|
||||
Addr string `yaml:"addr" env:"PROXY_HTTP_ADDR" desc:"The bind address of the HTTP service."`
|
||||
Root string `yaml:"root" env:"PROXY_HTTP_ROOT" desc:"Subdirectory that serves as the root for this HTTP service."`
|
||||
Namespace string `yaml:"-"`
|
||||
TLSCert string `yaml:"tls_cert" env:"PROXY_TRANSPORT_TLS_CERT" desc:"Path/File name of the TLS server certificate (in PEM format) for the external http services."`
|
||||
TLSKey string `yaml:"tls_key" env:"PROXY_TRANSPORT_TLS_KEY" desc:"Path/File name for the TLS certificate key (in PEM format) for the server certificate to use for the external http services."`
|
||||
TLSCert string `yaml:"tls_cert" env:"PROXY_TRANSPORT_TLS_CERT" desc:"Path/File name of the TLS server certificate (in PEM format) for the external http services. If not defined, the root directory derives from $OCIS_BASE_DATA_PATH:/proxy."`
|
||||
TLSKey string `yaml:"tls_key" env:"PROXY_TRANSPORT_TLS_KEY" desc:"Path/File name for the TLS certificate key (in PEM format) for the server certificate to use for the external http services. If not defined, the root directory derives from $OCIS_BASE_DATA_PATH:/proxy."`
|
||||
TLS bool `yaml:"tls" env:"PROXY_TLS" desc:"Enable/Disable HTTPS for the external HTTP services."`
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
# Search Service
|
||||
|
||||
The search service is responsible for metadata and content extraction, stores that data as index and makes it searchable. The following clarifies the extraction terms _metadata_ and _content_:
|
||||
|
||||
* Metadata: all data that _describes_ the file like `Name`, `Size`, `MimeType`, `Tags` and `Mtime`.
|
||||
* Content: all data that _relates to content_ of the file like `words`, `geo data`, `exif data` etc.
|
||||
|
||||
## General Considerations
|
||||
|
||||
* To use the search service, an event system needs to be configured for all services like NATS, which is shipped and preconfigured.
|
||||
* The search service consumes events and does not block other tasks.
|
||||
* When looking for content extraction, [Apache Tika - a content analysis toolkit](https://tika.apache.org) can be used but needs to be installed separately.
|
||||
|
||||
Extractions are stored as index via the search service. Consider that indexing requires adequate storage capacity - and the space requirement will grow. To avoid filling up the filesystem with the index and rendering Infinite Scale unusable, the index should reside on its own filesystem.
|
||||
|
||||
You can change the path to where search maintains its data in case the filesystem gets close to full and you need to relocate the data. Stop the service, move the data, reconfigure the path in the environment variable and restart the service.
|
||||
|
||||
When using content extraction, more resources and time are needed, because the content of the file needs to be analyzed. This is especially true for big and multiple concurrent files.
|
||||
|
||||
The search service runs out of the box with the shipped default `basic` configuration. No further configuration is needed, except when using content extraction.
|
||||
|
||||
Note that as of now, the search service can not be scaled. Consider using a dedicated hardware for this service in case more resources are needed.
|
||||
|
||||
## Search engines
|
||||
|
||||
By default, the search service is shipped with [bleve](https://github.com/blevesearch/bleve) as its primary search engine. The available engines can be extended by implementing the [Engine](pkg/engine/engine.go) interface and making that engine available.
|
||||
|
||||
## Extraction Engines
|
||||
|
||||
The search service provides the following extraction engines and their results are used as index for searching:
|
||||
|
||||
* The embedded `basic` configuration provides metadata extraction which is always on.
|
||||
* The `tika` configuration, which _additionally_ provides content extraction, if installed and configured.
|
||||
|
||||
## Content Extraction
|
||||
|
||||
The search service is able to manage and retrieve many types of information. For this purpose the following content extractors are included:
|
||||
|
||||
### Basic Extractor
|
||||
|
||||
This extractor is the most simple one and just uses the resource information provided by Infinite Scale. It does not do any further analysis. The following fields are included in the index: `Name`, `Size`, `MimeType`, `Tags`, `Mtime`.
|
||||
|
||||
### Tika Extractor
|
||||
|
||||
This extractor is more advanced compared to the [Basic extractor](#basic-extractor). The main difference is that this extractor is able to search file contents.
|
||||
However, [Apache Tika](https://tika.apache.org/) is required for this task. Read the [Getting Started with Apache Tika](https://tika.apache.org/2.6.0/gettingstarted.html) guide on how to install and run Tika or use a ready to run [Tika container](https://hub.docker.com/r/apache/tika).
|
||||
|
||||
As soon as Tika is installed and accessible, the search service must be configured for the use with Tika. The following settings must be set:
|
||||
|
||||
* `SEARCH_EXTRACTOR_TYPE=tika`
|
||||
* `SEARCH_EXTRACTOR_TIKA_TIKA_URL=http://YOUR-TIKA.URL`
|
||||
|
||||
When the search service can reach Tika, it begins to read out the content on demand. Note that files must be downloaded during the process, which can lead to delays with larger documents.
|
||||
|
||||
When using the Tika container and docker-compose, consider the following:
|
||||
|
||||
* See the [ocis_wopi](https://github.com/owncloud/ocis/tree/master/deployments/examples/ocis_wopi) example.
|
||||
* Containers for the linked service are reachable at a hostname identical to the alias or the service name if no alias was specified.
|
||||
|
||||
## Search Functionality
|
||||
|
||||
The search service consists of two main parts which are file `indexing` and file `search`.
|
||||
|
||||
### Indexing
|
||||
|
||||
Every time a resource changes its state, a corresponding event is triggered. Based on the event, the search service processes the file and adds the result to its index. There are a few more steps between accepting the file and updating the index.
|
||||
|
||||
### Search
|
||||
|
||||
A query via the search service will return results based on the index created.
|
||||
|
||||
### State Changes which Trigger Indexing
|
||||
|
||||
The following state changes in the life cycle of a file can trigger the creation of an index or an update:
|
||||
|
||||
#### Resource Trashed
|
||||
|
||||
The service checks its index to see if the file has been processed. If an index entry exists, the index will be marked as deleted. In consequence, the file won't appear in search requests anymore. The index entry stays intact and could be restored via [Resource Restored](#resource-restored).
|
||||
|
||||
#### Resource Deleted
|
||||
|
||||
The service checks its index to see if the file has been processed. If an index entry exists, the index will be finally deleted. In consequence, the file won't appear in search requests anymore.
|
||||
|
||||
#### Resource Restored
|
||||
|
||||
This step is the counterpart of [Resource Trashed](#resource-trashed). When a file is deleted, is isn't removed from the index, instead the service just marks it as deleted. This mark is removed when the file has been restored, and it shows up in search results again.
|
||||
|
||||
#### Resource Moved
|
||||
|
||||
This comes into play whenever a file or folder is renamed or moved. The search index then updates the resource location path or starts indexing if no index has been created so far for all items affected. See [Notes](#notes) for an example.
|
||||
|
||||
#### Folder Created
|
||||
|
||||
The creation of a folder always triggers indexing. The search service extracts all necessary information and stores it in the search index
|
||||
|
||||
#### File Created
|
||||
|
||||
This case is similar to [Folder created](#folder-created) with the difference that a file can contain far more valuable information. This gets interesting but time-consuming when data content needs to be analyzed and indexed. Content extraction is part of the search service if configured.
|
||||
|
||||
#### File Version Restored
|
||||
|
||||
Since Infinite Scale is capable of storing multiple versions of the same file, the search service also needs to take care of those versions. When a file version is restored, the service starts to extract all needed information, creates the index and makes the file discoverable.
|
||||
|
||||
#### Resource Tag Added
|
||||
|
||||
Whenever a resource gets a new tag, the service takes care of it and makes that resource discoverable by the tag.
|
||||
|
||||
#### Resource Tag Removed
|
||||
|
||||
This is the counterpart of [Resource tag added](#resource-tag-added). It takes care that a tag gets unassigned from the referenced resource.
|
||||
|
||||
#### File Uploaded - Synchronous
|
||||
|
||||
This case only triggers indexing if `async post processing` is disabled. If so, the service starts to extract all needed file information, stores it in the index and makes it discoverable.
|
||||
|
||||
#### File Uploaded - Asynchronous
|
||||
|
||||
This is exactly the same as [File uploaded - synchronous](#file-uploaded---synchronous) with the only difference that it is used for asynchronous uploads.
|
||||
|
||||
## Manually Trigger Re-Indexing a Space
|
||||
|
||||
The service includes a command-line interface to trigger re-indexing a space:
|
||||
|
||||
```shell
|
||||
ocis search index --space $SPACE_ID --user $USER_ID
|
||||
```
|
||||
|
||||
Note that not names but IDs are necessary and that the specified user ID needs access to the space to be indexed.
|
||||
|
||||
## Notes
|
||||
|
||||
The indexing process tries to be self-healing in some situations.
|
||||
|
||||
In the following example, let's assume a file tree `foo/bar/baz` exists.
|
||||
If the folder `bar` gets renamed to `new-bar`, the path to `baz` is no longer `foo/bar/baz` but `foo/new-bar/baz`.
|
||||
The search service checks the change and either just updates the path in the index or creates a new index for all items affected if none was present.
|
||||
@@ -25,7 +25,7 @@ type Config struct {
|
||||
DataPath string `yaml:"data_path" env:"SETTINGS_DATA_PATH" desc:"The directory where the filesystem storage will store ocis settings. If not definied, the root directory derives from $OCIS_BASE_DATA_PATH:/settings."`
|
||||
Metadata Metadata `yaml:"metadata_config"`
|
||||
|
||||
AdminUserID string `yaml:"admin_user_id" env:"OCIS_ADMIN_USER_ID;SETTINGS_ADMIN_USER_ID" desc:"ID of the user that should receive admin privileges."`
|
||||
AdminUserID string `yaml:"admin_user_id" env:"OCIS_ADMIN_USER_ID;SETTINGS_ADMIN_USER_ID" desc:"ID of the user that should receive admin privileges. Consider that the UUID can be encoded in some LDAP deployment configurations like in .ldif files. These need to be decoded beforehand."`
|
||||
|
||||
Asset Asset `yaml:"asset"`
|
||||
TokenManager *TokenManager `yaml:"token_manager"`
|
||||
|
||||
@@ -71,7 +71,7 @@ type UserSharingDrivers struct {
|
||||
}
|
||||
|
||||
type UserSharingJSONDriver struct {
|
||||
File string `yaml:"file" env:"SHARING_USER_JSON_FILE" desc:"Path to the JSON file where shares will be persisted."`
|
||||
File string `yaml:"file" env:"SHARING_USER_JSON_FILE" desc:"Path to the JSON file where shares will be persisted. If not defined, the root directory derives from $OCIS_BASE_DATA_PATH:/storage."`
|
||||
}
|
||||
|
||||
type UserSharingSQLDriver struct {
|
||||
@@ -120,7 +120,7 @@ type PublicSharingDrivers struct {
|
||||
}
|
||||
|
||||
type PublicSharingJSONDriver struct {
|
||||
File string `yaml:"file" env:"SHARING_PUBLIC_JSON_FILE" desc:"Path to the JSON file where public share meta-data will be stored. This JSON file contains the information about public shares that have been created."`
|
||||
File string `yaml:"file" env:"SHARING_PUBLIC_JSON_FILE" desc:"Path to the JSON file where public share meta-data will be stored. This JSON file contains the information about public shares that have been created. If not defined, the root directory derives from $OCIS_BASE_DATA_PATH:/storage."`
|
||||
}
|
||||
|
||||
type PublicSharingSQLDriver struct {
|
||||
|
||||
@@ -58,5 +58,5 @@ type GRPCConfig struct {
|
||||
}
|
||||
|
||||
type StorageProvider struct {
|
||||
MountID string `yaml:"mount_id" env:"STORAGE_PUBLICLINK_STORAGE_PROVIDER_MOUNT_ID" desc:"Mount ID of this storage."`
|
||||
MountID string `yaml:"mount_id" env:"STORAGE_PUBLICLINK_STORAGE_PROVIDER_MOUNT_ID" desc:"Mount ID of this storage. Admins can set the ID for the storage in this config option manually which is then used to reference the storage. Any reasonable long string is possible, preferably this would be an UUIDv4 format."`
|
||||
}
|
||||
@@ -74,7 +74,7 @@ type Drivers struct {
|
||||
|
||||
type OCISDriver struct {
|
||||
// Root is the absolute path to the location of the data
|
||||
Root string `yaml:"root" env:"STORAGE_SYSTEM_OCIS_ROOT" desc:"Path for the directory where the STORAGE-SYSTEM service stores it's persistent data."`
|
||||
Root string `yaml:"root" env:"STORAGE_SYSTEM_OCIS_ROOT" desc:"Path for the directory where the STORAGE-SYSTEM service stores it's persistent data. If not defined, the root directory derives from $OCIS_BASE_DATA_PATH:/storage."`
|
||||
|
||||
MaxAcquireLockCycles int `yaml:"max_acquire_lock_cycles" env:"STORAGE_SYSTEM_OCIS_MAX_ACQUIRE_LOCK_CYCLES" desc:"When trying to lock files, ocis will try this amount of times to acquire the lock before failing. After each try it will wait for an increasing amount of time. Values of 0 or below will be ignored and the default value of 20 will be used."`
|
||||
LockCycleDurationFactor int `yaml:"lock_cycle_duration_factor" env:"STORAGE_SYSTEM_OCIS_LOCK_CYCLE_DURATION_FACTOR" desc:"When trying to lock files, ocis will multiply the cycle with this factor and use it as a millisecond timeout. Values of 0 or below will be ignored and the default value of 30 will be used."`
|
||||
|
||||
@@ -21,7 +21,7 @@ type Config struct {
|
||||
|
||||
SkipUserGroupsInToken bool `yaml:"skip_user_groups_in_token" env:"STORAGE_USERS_SKIP_USER_GROUPS_IN_TOKEN" desc:"Disables the loading of user's group memberships from the reva access token."`
|
||||
|
||||
Driver string `yaml:"driver" env:"STORAGE_USERS_DRIVER" desc:"The storage driver which should be used by the service"`
|
||||
Driver string `yaml:"driver" env:"STORAGE_USERS_DRIVER" desc:"The storage driver which should be used by the service. Defaults to 'ocis', Supported values are: 'ocis', 's3ng' and 'owncloudsql'. The 'ocis' driver stores all data (blob and meta data) in an POSIX compliant volume. The 's3ng' driver stores metadata in a POSIX compliant volume and uploads blobs to the s3 bucket."`
|
||||
Drivers Drivers `yaml:"drivers"`
|
||||
DataServerURL string `yaml:"data_server_url" env:"STORAGE_USERS_DATA_SERVER_URL" desc:"URL of the data server, needs to be reachable by the data gateway provided by the frontend service or the user if directly exposed."`
|
||||
Events Events `yaml:"events"`
|
||||
@@ -29,7 +29,7 @@ type Config struct {
|
||||
MountID string `yaml:"mount_id" env:"STORAGE_USERS_MOUNT_ID" desc:"Mount ID of this storage."`
|
||||
ExposeDataServer bool `yaml:"expose_data_server" env:"STORAGE_USERS_EXPOSE_DATA_SERVER" desc:"Exposes the data server directly to users and bypasses the data gateway. Ensure that the data server address is reachable by users."`
|
||||
ReadOnly bool `yaml:"readonly" env:"STORAGE_USERS_READ_ONLY" desc:"Set this storage to be read-only."`
|
||||
UploadExpiration int64 `yaml:"upload_expiration" env:"STORAGE_USERS_UPLOAD_EXPIRATION" desc:"Duration after which uploads will expire."`
|
||||
UploadExpiration int64 `yaml:"upload_expiration" env:"STORAGE_USERS_UPLOAD_EXPIRATION" desc:"Duration in seconds after which uploads will expire."`
|
||||
|
||||
Supervised bool `yaml:"-"`
|
||||
Context context.Context `yaml:"-"`
|
||||
@@ -85,9 +85,9 @@ type Drivers struct {
|
||||
|
||||
type OCISDriver struct {
|
||||
// Root is the absolute path to the location of the data
|
||||
Root string `yaml:"root" env:"STORAGE_USERS_OCIS_ROOT" desc:"The directory where the filesystem storage will store user files. If not definied, the root directory derives from $OCIS_BASE_DATA_PATH:/storage/users."`
|
||||
Root string `yaml:"root" env:"STORAGE_USERS_OCIS_ROOT" desc:"The directory where the filesystem storage will store blobs and metadata. If not defined, the root directory derives from $OCIS_BASE_DATA_PATH:/storage/users."`
|
||||
UserLayout string `yaml:"user_layout" env:"STORAGE_USERS_OCIS_USER_LAYOUT" desc:"Template string for the user storage layout in the user directory."`
|
||||
PermissionsEndpoint string `yaml:"permissions_endpoint" env:"STORAGE_USERS_PERMISSION_ENDPOINT,STORAGE_USERS_OCIS_PERMISSIONS_ENDPOINT" desc:"Endpoint of the permissions service."`
|
||||
PermissionsEndpoint string `yaml:"permissions_endpoint" env:"STORAGE_USERS_PERMISSION_ENDPOINT,STORAGE_USERS_OCIS_PERMISSIONS_ENDPOINT" desc:"Endpoint of the permissions service. The endpoints can differ for 'ocis' and 's3ng'."`
|
||||
// PersonalSpaceAliasTemplate contains the template used to construct
|
||||
// the personal space alias, eg: `"{{.SpaceType}}/{{.User.Username | lower}}"`
|
||||
PersonalSpaceAliasTemplate string `yaml:"personalspacealias_template" env:"STORAGE_USERS_OCIS_PERSONAL_SPACE_ALIAS_TEMPLATE" desc:"Template string to construct personal space aliases."`
|
||||
@@ -102,9 +102,9 @@ type OCISDriver struct {
|
||||
|
||||
type S3NGDriver struct {
|
||||
// Root is the absolute path to the location of the data
|
||||
Root string `yaml:"root" env:"STORAGE_USERS_S3NG_ROOT" desc:"The directory where the filesystem storage will store user files. If not definied, the root directory derives from $OCIS_BASE_DATA_PATH:/storage/users."`
|
||||
Root string `yaml:"root" env:"STORAGE_USERS_S3NG_ROOT" desc:"The directory where the filesystem storage will store metadata for blobs. If not defined, the root directory derives from $OCIS_BASE_DATA_PATH:/storage/users."`
|
||||
UserLayout string `yaml:"user_layout" env:"STORAGE_USERS_S3NG_USER_LAYOUT" desc:"Template string for the user storage layout in the user directory."`
|
||||
PermissionsEndpoint string `yaml:"permissions_endpoint" env:"STORAGE_USERS_PERMISSION_ENDPOINT;STORAGE_USERS_S3NG_PERMISSIONS_ENDPOINT" desc:"Endpoint of the permissions service."`
|
||||
PermissionsEndpoint string `yaml:"permissions_endpoint" env:"STORAGE_USERS_PERMISSION_ENDPOINT;STORAGE_USERS_S3NG_PERMISSIONS_ENDPOINT" desc:"Endpoint of the permissions service. The endpoints can differ for 'ocis' and 's3ng'."`
|
||||
Region string `yaml:"region" env:"STORAGE_USERS_S3NG_REGION" desc:"Region of the S3 bucket."`
|
||||
AccessKey string `yaml:"access_key" env:"STORAGE_USERS_S3NG_ACCESS_KEY" desc:"Access key for the S3 bucket."`
|
||||
SecretKey string `yaml:"secret_key" env:"STORAGE_USERS_S3NG_SECRET_KEY" desc:"Secret key for the S3 bucket."`
|
||||
@@ -124,11 +124,11 @@ type S3NGDriver struct {
|
||||
|
||||
type OwnCloudSQLDriver struct {
|
||||
// Root is the absolute path to the location of the data
|
||||
Root string `yaml:"root" env:"STORAGE_USERS_OWNCLOUDSQL_DATADIR" desc:"The directory where the filesystem storage will store SQL migration data. If not definied, the root directory derives from $OCIS_BASE_DATA_PATH:/storage/owncloud."`
|
||||
Root string `yaml:"root" env:"STORAGE_USERS_OWNCLOUDSQL_DATADIR" desc:"The directory where the filesystem storage will store SQL migration data. If not defined, the root directory derives from $OCIS_BASE_DATA_PATH:/storage/owncloud."`
|
||||
//ShareFolder defines the name of the folder jailing all shares
|
||||
ShareFolder string `yaml:"share_folder" env:"STORAGE_USERS_OWNCLOUDSQL_SHARE_FOLDER" desc:"Name of the folder jailing all shares."`
|
||||
UserLayout string `yaml:"user_layout" env:"STORAGE_USERS_OWNCLOUDSQL_LAYOUT" desc:"Path layout to use to navigate into a users folder in an owncloud data directory"`
|
||||
UploadInfoDir string `yaml:"upload_info_dir" env:"STORAGE_USERS_OWNCLOUDSQL_UPLOADINFO_DIR" desc:"Path to a directory, where uploads will be stored temporarily."`
|
||||
UploadInfoDir string `yaml:"upload_info_dir" env:"STORAGE_USERS_OWNCLOUDSQL_UPLOADINFO_DIR" desc:"The directory where the filesystem will store uploads temporarily. If not defined, the root directory derives from $OCIS_BASE_DATA_PATH:/storage/uploadinfo."`
|
||||
DBUsername string `yaml:"db_username" env:"STORAGE_USERS_OWNCLOUDSQL_DB_USERNAME" desc:"Username for the database."`
|
||||
DBPassword string `yaml:"db_password" env:"STORAGE_USERS_OWNCLOUDSQL_DB_PASSWORD" desc:"Password for the database."`
|
||||
DBHost string `yaml:"db_host" env:"STORAGE_USERS_OWNCLOUDSQL_DB_HOST" desc:"Hostname or IP of the database server."`
|
||||
|
||||
@@ -20,7 +20,7 @@ type Config struct {
|
||||
|
||||
GRPCClientTLS *shared.GRPCClientTLS `yaml:"grpc_client_tls"`
|
||||
|
||||
Datapath string `yaml:"data_path" env:"STORE_DATA_PATH" desc:"The directory where the filesystem storage will store ocis settings. If not definied, the root directory derives from $OCIS_BASE_DATA_PATH:/store."`
|
||||
Datapath string `yaml:"data_path" env:"STORE_DATA_PATH" desc:"The directory where the filesystem storage will store ocis settings. If not defined, the root directory derives from $OCIS_BASE_DATA_PATH:/store."`
|
||||
|
||||
Context context.Context `yaml:"-"`
|
||||
}
|
||||
@@ -28,7 +28,7 @@ type Config struct {
|
||||
|
||||
// FileSystemStorage defines the available filesystem storage configuration.
|
||||
type FileSystemStorage struct {
|
||||
RootDirectory string `yaml:"root_directory" env:"THUMBNAILS_FILESYSTEMSTORAGE_ROOT" desc:"The directory where the filesystem storage will store the thumbnails. If not definied, the root directory derives from $OCIS_BASE_DATA_PATH:/thumbnails."`
|
||||
RootDirectory string `yaml:"root_directory" env:"THUMBNAILS_FILESYSTEMSTORAGE_ROOT" desc:"The directory where the filesystem storage will store the thumbnails. If not defined, the root directory derives from $OCIS_BASE_DATA_PATH:/thumbnails."`
|
||||
}
|
||||
|
||||
// Thumbnail defines the available thumbnail related configuration.
|
||||
|
||||
@@ -71,7 +71,7 @@ type JSONDriver struct {
|
||||
}
|
||||
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/File name for the root CA certificate (in PEM format) used to validate TLS server certificates of the LDAP service."`
|
||||
CACert string `yaml:"ca_cert" env:"LDAP_CACERT;USERS_LDAP_CACERT" desc:"Path/File name for the root CA certificate (in PEM format) used to validate TLS server certificates of the LDAP service. If not defined, the root directory derives from $OCIS_BASE_DATA_PATH:/idm."`
|
||||
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'."`
|
||||
|
||||
@@ -47,7 +47,7 @@ type OIDC struct {
|
||||
Authority string `json:"authority,omitempty" yaml:"authority" env:"OCIS_URL;OCIS_OIDC_ISSUER;WEB_OIDC_AUTHORITY" desc:"URL of the OIDC issuer. It defaults to URL of the builtin IDP."`
|
||||
ClientID string `json:"client_id,omitempty" yaml:"client_id" env:"WEB_OIDC_CLIENT_ID" desc:"OIDC client ID, which ownCloud Web uses. This client needs to be set up in your IDP."`
|
||||
ResponseType string `json:"response_type,omitempty" yaml:"response_type" env:"WEB_OIDC_RESPONSE_TYPE" desc:"OIDC response type to use for authentication."`
|
||||
Scope string `json:"scope,omitempty" yaml:"scope" env:"WEB_OIDC_SCOPE" desc:"OIDC scopes to request during authentication."`
|
||||
Scope string `json:"scope,omitempty" yaml:"scope" env:"WEB_OIDC_SCOPE" desc:"OIDC scopes to request during authentication to authorize access to user details. Defaults to 'openid profile email'. Values are separated by blank. More example values but not limited to are 'address' or 'phone' etc."`
|
||||
}
|
||||
|
||||
// Application defines an application for the Web app switcher.
|
||||
|
||||
@@ -0,0 +1,200 @@
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* ownCloud
|
||||
*
|
||||
* @author Artur Neumann <artur@jankaritech.com>
|
||||
* @copyright Copyright (c) 2018 Artur Neumann artur@jankaritech.com
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License,
|
||||
* as published by the Free Software Foundation;
|
||||
* either version 3 of the License, or any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
*/
|
||||
namespace TestHelpers\Asserts;
|
||||
|
||||
use Exception;
|
||||
use SimpleXMLElement;
|
||||
use TestHelpers\DownloadHelper;
|
||||
use TestHelpers\SetupHelper;
|
||||
|
||||
/**
|
||||
* WebDAV related asserts
|
||||
*/
|
||||
class WebDav extends \PHPUnit\Framework\Assert {
|
||||
/**
|
||||
*
|
||||
* @param string|null $element exception|message|reason
|
||||
* @param string|null $expectedValue
|
||||
* @param array|null $responseXml
|
||||
* @param string|null $extraErrorText
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function assertDavResponseElementIs(
|
||||
?string $element,
|
||||
?string $expectedValue,
|
||||
?array $responseXml,
|
||||
?string $extraErrorText = ''
|
||||
):void {
|
||||
if ($extraErrorText !== '') {
|
||||
$extraErrorText = $extraErrorText . " ";
|
||||
}
|
||||
self::assertArrayHasKey(
|
||||
'value',
|
||||
$responseXml,
|
||||
$extraErrorText . "responseXml does not have key 'value'"
|
||||
);
|
||||
if ($element === "exception") {
|
||||
$result = $responseXml['value'][0]['value'];
|
||||
} elseif ($element === "message") {
|
||||
$result = $responseXml['value'][1]['value'];
|
||||
} elseif ($element === "reason") {
|
||||
$result = $responseXml['value'][3]['value'];
|
||||
}
|
||||
|
||||
self::assertEquals(
|
||||
$expectedValue,
|
||||
$result,
|
||||
__METHOD__ . " " . $extraErrorText . "Expected '$expectedValue' in element $element got '$result'"
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param SimpleXMLElement $responseXmlObject
|
||||
* @param array|null $expectedShareTypes
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function assertResponseContainsShareTypes(
|
||||
SimpleXMLElement $responseXmlObject,
|
||||
?array $expectedShareTypes
|
||||
):void {
|
||||
foreach ($expectedShareTypes as $row) {
|
||||
$xmlPart = $responseXmlObject->xpath(
|
||||
"//d:prop/oc:share-types/oc:share-type[.=" . $row[0] . "]"
|
||||
);
|
||||
self::assertNotEmpty(
|
||||
$xmlPart,
|
||||
"cannot find share-type '" . $row[0] . "'"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that the content of a remote and a local file is the same
|
||||
* or is different
|
||||
*
|
||||
* @param string|null $baseUrl
|
||||
* @param string|null $username
|
||||
* @param string|null $password
|
||||
* @param string|null $remoteFile
|
||||
* @param string|null $localFile
|
||||
* @param string|null $xRequestId
|
||||
* @param bool $shouldBeSame (default true) if true then check that the file contents are the same
|
||||
* otherwise check that the file contents are different
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function assertContentOfRemoteAndLocalFileIsSame(
|
||||
?string $baseUrl,
|
||||
?string $username,
|
||||
?string $password,
|
||||
?string $remoteFile,
|
||||
?string $localFile,
|
||||
?string $xRequestId = '',
|
||||
?bool $shouldBeSame = true
|
||||
):void {
|
||||
$result = DownloadHelper::download(
|
||||
$baseUrl,
|
||||
$username,
|
||||
$password,
|
||||
$remoteFile,
|
||||
$xRequestId
|
||||
);
|
||||
|
||||
$localContent = \file_get_contents($localFile);
|
||||
$downloadedContent = $result->getBody()->getContents();
|
||||
|
||||
if ($shouldBeSame) {
|
||||
self::assertSame(
|
||||
$localContent,
|
||||
$downloadedContent
|
||||
);
|
||||
} else {
|
||||
self::assertNotSame(
|
||||
$localContent,
|
||||
$downloadedContent
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that the content of a remote file (downloaded by DAV)
|
||||
* and a file in the skeleton folder of the system under test is the same
|
||||
* or is different
|
||||
*
|
||||
* @param string|null $baseUrl
|
||||
* @param string|null $username
|
||||
* @param string|null $password
|
||||
* @param string|null $adminUsername
|
||||
* @param string|null $adminPassword
|
||||
* @param string|null $remoteFile
|
||||
* @param string|null $fileInSkeletonFolder
|
||||
* @param string|null $xRequestId
|
||||
* @param bool $shouldBeSame (default true) if true then check that the file contents are the same
|
||||
* otherwise check that the file contents are different
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function assertContentOfDAVFileAndSkeletonFileOnSUT(
|
||||
?string $baseUrl,
|
||||
?string $username,
|
||||
?string $password,
|
||||
?string $adminUsername,
|
||||
?string $adminPassword,
|
||||
?string $remoteFile,
|
||||
?string $fileInSkeletonFolder,
|
||||
?string $xRequestId = '',
|
||||
?bool $shouldBeSame = true
|
||||
):void {
|
||||
$result = DownloadHelper::download(
|
||||
$baseUrl,
|
||||
$username,
|
||||
$password,
|
||||
$remoteFile,
|
||||
$xRequestId
|
||||
);
|
||||
$downloadedContent = $result->getBody()->getContents();
|
||||
|
||||
$localContent = SetupHelper::readSkeletonFile(
|
||||
$fileInSkeletonFolder,
|
||||
$xRequestId,
|
||||
$baseUrl,
|
||||
$adminUsername,
|
||||
$adminPassword
|
||||
);
|
||||
|
||||
if ($shouldBeSame) {
|
||||
self::assertSame(
|
||||
$localContent,
|
||||
$downloadedContent
|
||||
);
|
||||
} else {
|
||||
self::assertNotSame(
|
||||
$localContent,
|
||||
$downloadedContent
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,14 +26,61 @@ class GraphHelper {
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getUUIDv4Regex(): string {
|
||||
return '[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-4[0-9A-Fa-f]{3}-[89ABab][0-9A-Fa-f]{3}-[0-9A-Fa-f]{12}';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $id
|
||||
*
|
||||
* @return int (1 = true | 0 = false)
|
||||
* @return bool
|
||||
*/
|
||||
public static function isUUIDv4(string $id): int {
|
||||
$regex = '/^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i';
|
||||
return preg_match($regex, $id);
|
||||
public static function isUUIDv4(string $id): bool {
|
||||
$regex = "/^" . self::getUUIDv4Regex() . "$/i";
|
||||
return (bool)preg_match($regex, $id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $spaceId
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function isSpaceId(string $spaceId): bool {
|
||||
$regex = "/^" . self::getUUIDv4Regex() . '\\$' . self::getUUIDv4Regex() . "$/i";
|
||||
return (bool)preg_match($regex, $spaceId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public static function getSpaceIdRegex(): string {
|
||||
return self::getUUIDv4Regex() . '\\\$' . self::getUUIDv4Regex();
|
||||
}
|
||||
|
||||
/**
|
||||
* Key name can consist of @@@
|
||||
* This function separate such key and return its actual value from actual drive response which can be used for assertion
|
||||
*
|
||||
* @param string $keyName
|
||||
* @param array $actualDriveInformation
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function separateAndGetValueForKey(string $keyName, array $actualDriveInformation): string {
|
||||
// break the segment with @@@ to find the actual value from the actual drive information
|
||||
$separatedKey = explode("@@@", $keyName);
|
||||
// this stores the actual value of each key from drive information response used for assertion
|
||||
$actualKeyValue = $actualDriveInformation;
|
||||
|
||||
foreach ($separatedKey as $key) {
|
||||
$actualKeyValue = $actualKeyValue[$key];
|
||||
}
|
||||
|
||||
return $actualKeyValue;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -42,7 +89,7 @@ class GraphHelper {
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private static function getFullUrl(string $baseUrl, string $path): string {
|
||||
public static function getFullUrl(string $baseUrl, string $path): string {
|
||||
$fullUrl = $baseUrl;
|
||||
if (\substr($fullUrl, -1) !== '/') {
|
||||
$fullUrl .= '/';
|
||||
@@ -131,6 +178,7 @@ class GraphHelper {
|
||||
* @param string|null $password
|
||||
* @param string|null $email
|
||||
* @param string|null $displayName
|
||||
* @param bool|true $accountEnabled
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws GuzzleException
|
||||
@@ -144,13 +192,15 @@ class GraphHelper {
|
||||
?string $userName = null,
|
||||
?string $password = null,
|
||||
?string $email = null,
|
||||
?string $displayName = null
|
||||
?string $displayName = null,
|
||||
?bool $accountEnabled = true
|
||||
): ResponseInterface {
|
||||
$payload = self::preparePatchUserPayload(
|
||||
$userName,
|
||||
$password,
|
||||
$email,
|
||||
$displayName
|
||||
$displayName,
|
||||
$accountEnabled
|
||||
);
|
||||
$url = self::getFullUrl($baseUrl, 'users/' . $userId);
|
||||
return HttpRequestHelper::sendRequest(
|
||||
@@ -242,6 +292,58 @@ class GraphHelper {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $baseUrl
|
||||
* @param string $xRequestId
|
||||
* @param string $byUser
|
||||
* @param string $userPassword
|
||||
* @param string|null $user
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public static function getUserWithDriveInformation(
|
||||
string $baseUrl,
|
||||
string $xRequestId,
|
||||
string $byUser,
|
||||
string $userPassword,
|
||||
?string $user = null
|
||||
): ResponseInterface {
|
||||
$url = self::getFullUrl($baseUrl, 'users/' . $user . '?%24select=&%24expand=drive');
|
||||
return HttpRequestHelper::get(
|
||||
$url,
|
||||
$xRequestId,
|
||||
$byUser,
|
||||
$userPassword,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $baseUrl
|
||||
* @param string $xRequestId
|
||||
* @param string $byUser
|
||||
* @param string $userPassword
|
||||
* @param string|null $user
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public static function getUserWithGroupInformation(
|
||||
string $baseUrl,
|
||||
string $xRequestId,
|
||||
string $byUser,
|
||||
string $userPassword,
|
||||
?string $user = null
|
||||
): ResponseInterface {
|
||||
$url = self::getFullUrl($baseUrl, 'users/' . $user . '?%24expand=memberOf');
|
||||
return HttpRequestHelper::get(
|
||||
$url,
|
||||
$xRequestId,
|
||||
$byUser,
|
||||
$userPassword,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $baseUrl
|
||||
* @param string $xRequestId
|
||||
@@ -354,6 +456,33 @@ class GraphHelper {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $baseUrl
|
||||
* @param string $xRequestId
|
||||
* @param string $adminUser
|
||||
* @param string $adminPassword
|
||||
* @param string $groupName
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public static function getGroup(
|
||||
string $baseUrl,
|
||||
string $xRequestId,
|
||||
string $adminUser,
|
||||
string $adminPassword,
|
||||
string $groupName
|
||||
): ResponseInterface {
|
||||
$url = self::getFullUrl($baseUrl, 'groups/' . $groupName);
|
||||
return HttpRequestHelper::get(
|
||||
$url,
|
||||
$xRequestId,
|
||||
$adminUser,
|
||||
$adminPassword,
|
||||
self::getRequestHeaders()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $baseUrl
|
||||
* @param string $xRequestId
|
||||
@@ -381,13 +510,14 @@ class GraphHelper {
|
||||
}
|
||||
|
||||
/**
|
||||
* add multiple users to a group at once
|
||||
*
|
||||
* @param string $baseUrl
|
||||
* @param string $xRequestId
|
||||
* @param string $adminUser
|
||||
* @param string $adminPassword
|
||||
* @param string $groupId
|
||||
* @param array $users expects users array with user ids
|
||||
* [ [ 'id' => 'some_id' ], ]
|
||||
* @param array $userIds
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws GuzzleException
|
||||
@@ -398,18 +528,53 @@ class GraphHelper {
|
||||
string $adminUser,
|
||||
string $adminPassword,
|
||||
string $groupId,
|
||||
array $users
|
||||
array $userIds
|
||||
): ResponseInterface {
|
||||
$url = self::getFullUrl($baseUrl, 'groups/' . $groupId . '/users');
|
||||
$payload = [
|
||||
"members@odata.bind" => []
|
||||
];
|
||||
foreach ($users as $user) {
|
||||
$payload[0][] = self::getFullUrl($baseUrl, 'users/' . $user["id"]);
|
||||
$url = self::getFullUrl($baseUrl, 'groups/' . $groupId);
|
||||
$payload = [ "members@odata.bind" => [] ];
|
||||
foreach ($userIds as $userId) {
|
||||
$payload["members@odata.bind"][] = self::getFullUrl($baseUrl, 'users/' . $userId);
|
||||
}
|
||||
return HttpRequestHelper::post(
|
||||
return HttpRequestHelper::sendRequest(
|
||||
$url,
|
||||
$xRequestId,
|
||||
'PATCH',
|
||||
$adminUser,
|
||||
$adminPassword,
|
||||
self::getRequestHeaders(),
|
||||
\json_encode($payload)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* tries to add a group to a group
|
||||
*
|
||||
* @param string $baseUrl
|
||||
* @param string $xRequestId
|
||||
* @param string $adminUser
|
||||
* @param string $adminPassword
|
||||
* @param string $groupId
|
||||
* @param string $groupIdToAdd
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public static function addGroupToGroup(
|
||||
string $baseUrl,
|
||||
string $xRequestId,
|
||||
string $adminUser,
|
||||
string $adminPassword,
|
||||
string $groupId,
|
||||
string $groupIdToAdd
|
||||
): ResponseInterface {
|
||||
$url = self::getFullUrl($baseUrl, 'groups/' . $groupId);
|
||||
$payload = [
|
||||
"@odata.id" => self::getFullUrl($baseUrl, 'groups/' . $groupIdToAdd)
|
||||
];
|
||||
return HttpRequestHelper::sendRequest(
|
||||
$url,
|
||||
$xRequestId,
|
||||
'PATCH',
|
||||
$adminUser,
|
||||
$adminPassword,
|
||||
self::getRequestHeaders(),
|
||||
@@ -504,6 +669,37 @@ class GraphHelper {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* returns single group information along with its member information when groupId is provided
|
||||
* else return all group information along with its member information
|
||||
*
|
||||
* @param string $baseUrl
|
||||
* @param string $xRequestId
|
||||
* @param string $adminUser
|
||||
* @param string $adminPassword
|
||||
* @param string|null $groupId
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public static function getSingleOrAllGroupsAlongWithMembers(
|
||||
string $baseUrl,
|
||||
string $xRequestId,
|
||||
string $adminUser,
|
||||
string $adminPassword,
|
||||
?string $groupId = null
|
||||
): ResponseInterface {
|
||||
// we can expand to get list of members for a single group with groupId and also expand to get all groups with all its members
|
||||
$endPath = ($groupId) ? '/' . $groupId . '?$expand=members' : '?$expand=members';
|
||||
$url = self::getFullUrl($baseUrl, 'groups' . $endPath);
|
||||
return HttpRequestHelper::get(
|
||||
$url,
|
||||
$xRequestId,
|
||||
$adminUser,
|
||||
$adminPassword
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* returns json encoded payload for user creating request
|
||||
*
|
||||
@@ -523,7 +719,10 @@ class GraphHelper {
|
||||
$payload['onPremisesSamAccountName'] = $userName;
|
||||
$payload['passwordProfile'] = ['password' => $password];
|
||||
$payload['displayName'] = $displayName ?? $userName;
|
||||
$payload['mail'] = $email ?? $userName . '@example.com';
|
||||
if (!empty($email)) {
|
||||
$payload['mail'] = $email ?? $userName . '@example.com';
|
||||
}
|
||||
$payload['accountEnabled'] = true;
|
||||
return \json_encode($payload);
|
||||
}
|
||||
|
||||
@@ -534,6 +733,7 @@ class GraphHelper {
|
||||
* @param string|null $password
|
||||
* @param string|null $email
|
||||
* @param string|null $displayName
|
||||
* @param bool|true $accountEnabled
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -541,21 +741,27 @@ class GraphHelper {
|
||||
?string $userName,
|
||||
?string $password,
|
||||
?string $email,
|
||||
?string $displayName
|
||||
?string $displayName,
|
||||
?bool $accountEnabled
|
||||
): string {
|
||||
$payload = [];
|
||||
if ($userName) {
|
||||
if ($userName !== null) {
|
||||
// comment on after fixing #5755 because now it crashes server
|
||||
// if (empty($userName)) {
|
||||
// $payload['onPremisesSamAccountName'] = ' ';
|
||||
// } else $payload['onPremisesSamAccountName'] = $userName;
|
||||
$payload['onPremisesSamAccountName'] = $userName;
|
||||
}
|
||||
if ($password) {
|
||||
if ($password !== null) {
|
||||
$payload['passwordProfile'] = ['password' => $password];
|
||||
}
|
||||
if ($displayName) {
|
||||
if ($displayName !== null) {
|
||||
$payload['displayName'] = $displayName;
|
||||
}
|
||||
if ($email) {
|
||||
if ($email !== null) {
|
||||
$payload['mail'] = $email;
|
||||
}
|
||||
$payload['accountEnabled'] = $accountEnabled;
|
||||
return \json_encode($payload);
|
||||
}
|
||||
|
||||
@@ -818,4 +1024,294 @@ class GraphHelper {
|
||||
\json_encode($payload)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $baseUrl
|
||||
* @param string $user
|
||||
* @param string $password
|
||||
* @param string $xRequestId
|
||||
* @param array $body
|
||||
* @param array $headers
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public static function getTags(
|
||||
string $baseUrl,
|
||||
string $user,
|
||||
string $password,
|
||||
string $xRequestId = '',
|
||||
array $body = [],
|
||||
array $headers = []
|
||||
): ResponseInterface {
|
||||
$url = self::getFullUrl($baseUrl, 'extensions/org.libregraph/tags');
|
||||
|
||||
return HttpRequestHelper::get($url, $xRequestId, $user, $password, $headers, $body);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $baseUrl
|
||||
* @param string $xRequestId
|
||||
* @param string $user
|
||||
* @param string $password
|
||||
* @param string $resourceId
|
||||
* @param array $tagName
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public static function createTags(
|
||||
string $baseUrl,
|
||||
string $xRequestId,
|
||||
string $user,
|
||||
string $password,
|
||||
string $resourceId,
|
||||
array $tagName
|
||||
): ResponseInterface {
|
||||
$url = self::getFullUrl($baseUrl, 'extensions/org.libregraph/tags');
|
||||
$payload['resourceId'] = $resourceId;
|
||||
$payload['tags'] = $tagName;
|
||||
|
||||
return HttpRequestHelper::sendRequest(
|
||||
$url,
|
||||
$xRequestId,
|
||||
"PUT",
|
||||
$user,
|
||||
$password,
|
||||
self::getRequestHeaders(),
|
||||
\json_encode($payload)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $baseUrl
|
||||
* @param string $xRequestId
|
||||
* @param string $user
|
||||
* @param string $password
|
||||
* @param string $resourceId
|
||||
* @param array $tagName
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public static function deleteTags(
|
||||
string $baseUrl,
|
||||
string $xRequestId,
|
||||
string $user,
|
||||
string $password,
|
||||
string $resourceId,
|
||||
array $tagName
|
||||
): ResponseInterface {
|
||||
$url = self::getFullUrl($baseUrl, 'extensions/org.libregraph/tags');
|
||||
$payload['resourceId'] = $resourceId;
|
||||
$payload['tags'] = $tagName;
|
||||
|
||||
return HttpRequestHelper::sendRequest(
|
||||
$url,
|
||||
$xRequestId,
|
||||
"DELETE",
|
||||
$user,
|
||||
$password,
|
||||
self::getRequestHeaders(),
|
||||
\json_encode($payload)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $baseUrl
|
||||
* @param string $xRequestId
|
||||
* @param string $user
|
||||
* @param string $password
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public static function getApplications(
|
||||
string $baseUrl,
|
||||
string $xRequestId,
|
||||
string $user,
|
||||
string $password
|
||||
): ResponseInterface {
|
||||
$url = self::getFullUrl($baseUrl, 'applications');
|
||||
return HttpRequestHelper::get(
|
||||
$url,
|
||||
$xRequestId,
|
||||
$user,
|
||||
$password,
|
||||
self::getRequestHeaders()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $baseUrl
|
||||
* @param string $xRequestId
|
||||
* @param string $user
|
||||
* @param string $password
|
||||
* @param string $groupId
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public static function getUsersWithFilterMemberOf(
|
||||
string $baseUrl,
|
||||
string $xRequestId,
|
||||
string $user,
|
||||
string $password,
|
||||
string $groupId
|
||||
): ResponseInterface {
|
||||
$url = self::getFullUrl($baseUrl, 'users' . '?$filter=memberOf/any(m:m/id ' . "eq '$groupId')");
|
||||
return HttpRequestHelper::get(
|
||||
$url,
|
||||
$xRequestId,
|
||||
$user,
|
||||
$password,
|
||||
self::getRequestHeaders()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $baseUrl
|
||||
* @param string $xRequestId
|
||||
* @param string $user
|
||||
* @param string $password
|
||||
* @param array $groupIdArray
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public static function getUsersOfTwoGroups(
|
||||
string $baseUrl,
|
||||
string $xRequestId,
|
||||
string $user,
|
||||
string $password,
|
||||
array $groupIdArray
|
||||
): ResponseInterface {
|
||||
$url = self::getFullUrl($baseUrl, 'users' . '?$filter=memberOf/any(m:m/id ' . "eq '$groupIdArray[0]') " . "and memberOf/any(m:m/id eq '$groupIdArray[1]')");
|
||||
return HttpRequestHelper::get(
|
||||
$url,
|
||||
$xRequestId,
|
||||
$user,
|
||||
$password,
|
||||
self::getRequestHeaders()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $baseUrl
|
||||
* @param string $xRequestId
|
||||
* @param string $user
|
||||
* @param string $password
|
||||
* @param string $roleId
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public static function getUsersWithFilterRoleAssignment(
|
||||
string $baseUrl,
|
||||
string $xRequestId,
|
||||
string $user,
|
||||
string $password,
|
||||
string $roleId
|
||||
): ResponseInterface {
|
||||
$url = self::getFullUrl($baseUrl, 'users' . '?$filter=appRoleAssignments/any(m:m/appRoleId ' . "eq '$roleId')");
|
||||
return HttpRequestHelper::get(
|
||||
$url,
|
||||
$xRequestId,
|
||||
$user,
|
||||
$password,
|
||||
self::getRequestHeaders()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $baseUrl
|
||||
* @param string $xRequestId
|
||||
* @param string $user
|
||||
* @param string $password
|
||||
* @param string $roleId
|
||||
* @param string $groupId
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public static function getUsersWithFilterRolesAssignmentAndMemberOf(
|
||||
string $baseUrl,
|
||||
string $xRequestId,
|
||||
string $user,
|
||||
string $password,
|
||||
string $roleId,
|
||||
string $groupId
|
||||
): ResponseInterface {
|
||||
$url = self::getFullUrl($baseUrl, 'users' . '?$filter=appRoleAssignments/any(m:m/appRoleId ' . "eq '$roleId') " . "and memberOf/any(m:m/id eq '$groupId')");
|
||||
return HttpRequestHelper::get(
|
||||
$url,
|
||||
$xRequestId,
|
||||
$user,
|
||||
$password,
|
||||
self::getRequestHeaders()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $baseUrl
|
||||
* @param string $xRequestId
|
||||
* @param string $user
|
||||
* @param string $password
|
||||
* @param string $appRoleId
|
||||
* @param string $applicationId
|
||||
* @param string $userId
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public static function assignRole(
|
||||
string $baseUrl,
|
||||
string $xRequestId,
|
||||
string $user,
|
||||
string $password,
|
||||
string $appRoleId,
|
||||
string $applicationId,
|
||||
string $userId
|
||||
): ResponseInterface {
|
||||
$url = self::getFullUrl($baseUrl, 'users/' . $userId . '/appRoleAssignments');
|
||||
$payload['principalId'] = $userId;
|
||||
$payload['appRoleId'] = $appRoleId;
|
||||
$payload['resourceId'] = $applicationId;
|
||||
return HttpRequestHelper::sendRequest(
|
||||
$url,
|
||||
$xRequestId,
|
||||
"POST",
|
||||
$user,
|
||||
$password,
|
||||
self::getRequestHeaders(),
|
||||
\json_encode($payload)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $baseUrl
|
||||
* @param string $xRequestId
|
||||
* @param string $user
|
||||
* @param string $password
|
||||
* @param string $userId
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public static function getAssignedRole(
|
||||
string $baseUrl,
|
||||
string $xRequestId,
|
||||
string $user,
|
||||
string $password,
|
||||
string $userId
|
||||
): ResponseInterface {
|
||||
$url = self::getFullUrl($baseUrl, 'users/' . $userId . '/appRoleAssignments');
|
||||
return HttpRequestHelper::get(
|
||||
$url,
|
||||
$xRequestId,
|
||||
$user,
|
||||
$password,
|
||||
self::getRequestHeaders()
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,673 @@
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* ownCloud
|
||||
*
|
||||
* @author Artur Neumann <artur@jankaritech.com>
|
||||
* @copyright Copyright (c) 2017 Artur Neumann artur@jankaritech.com
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License,
|
||||
* as published by the Free Software Foundation;
|
||||
* either version 3 of the License, or any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
*/
|
||||
|
||||
namespace TestHelpers;
|
||||
|
||||
use Exception;
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\Cookie\CookieJar;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
use GuzzleHttp\Exception\RequestException;
|
||||
use GuzzleHttp\Psr7\Request;
|
||||
use Psr\Http\Message\RequestInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Psr\Http\Message\StreamInterface;
|
||||
use SimpleXMLElement;
|
||||
use Sabre\Xml\LibXMLException;
|
||||
use Sabre\Xml\Reader;
|
||||
use GuzzleHttp\Pool;
|
||||
|
||||
/**
|
||||
* Helper for HTTP requests
|
||||
*/
|
||||
class HttpRequestHelper {
|
||||
public const HTTP_TOO_EARLY = 425;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private static $oCSelectorCookie = null;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public static function getOCSelectorCookie(): string {
|
||||
return self::$oCSelectorCookie;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $oCSelectorCookie "owncloud-selector=oc10;path=/;"
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function setOCSelectorCookie(string $oCSelectorCookie): void {
|
||||
self::$oCSelectorCookie = $oCSelectorCookie;
|
||||
}
|
||||
|
||||
/**
|
||||
* Some systems-under-test do async post-processing of operations like upload,
|
||||
* move etc. If a client does a request on the resource before the post-processing
|
||||
* is finished, then the server should return HTTP_TOO_EARLY "425". Clients are
|
||||
* expected to retry the request "some time later" (tm).
|
||||
*
|
||||
* On such systems, when HTTP_TOO_EARLY status is received, the test code will
|
||||
* retry the request at 1-second intervals until either some other HTTP status
|
||||
* is received or the retry-limit is reached.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public static function numRetriesOnHttpTooEarly():int {
|
||||
// Currently reva and oCIS may return HTTP_TOO_EARLY
|
||||
// So try up to 10 times before giving up.
|
||||
return 10;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string|null $url
|
||||
* @param string|null $xRequestId
|
||||
* @param string|null $method
|
||||
* @param string|null $user
|
||||
* @param string|null $password
|
||||
* @param array|null $headers ['X-MyHeader' => 'value']
|
||||
* @param mixed $body
|
||||
* @param array|null $config
|
||||
* @param CookieJar|null $cookies
|
||||
* @param bool $stream Set to true to stream a response rather
|
||||
* than download it all up-front.
|
||||
* @param int|null $timeout
|
||||
* @param Client|null $client
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public static function sendRequestOnce(
|
||||
?string $url,
|
||||
?string $xRequestId,
|
||||
?string $method = 'GET',
|
||||
?string $user = null,
|
||||
?string $password = null,
|
||||
?array $headers = null,
|
||||
$body = null,
|
||||
?array $config = null,
|
||||
?CookieJar $cookies = null,
|
||||
bool $stream = false,
|
||||
?int $timeout = 0,
|
||||
?Client $client = null
|
||||
):ResponseInterface {
|
||||
if ($client === null) {
|
||||
$client = self::createClient(
|
||||
$user,
|
||||
$password,
|
||||
$config,
|
||||
$cookies,
|
||||
$stream,
|
||||
$timeout
|
||||
);
|
||||
}
|
||||
/**
|
||||
* @var RequestInterface $request
|
||||
*/
|
||||
$request = self::createRequest(
|
||||
$url,
|
||||
$xRequestId,
|
||||
$method,
|
||||
$headers,
|
||||
$body
|
||||
);
|
||||
|
||||
if ((\getenv('DEBUG_ACCEPTANCE_REQUESTS') !== false) || (\getenv('DEBUG_ACCEPTANCE_API_CALLS') !== false)) {
|
||||
$debugRequests = true;
|
||||
} else {
|
||||
$debugRequests = false;
|
||||
}
|
||||
|
||||
if ($debugRequests) {
|
||||
self::debugRequest($request, $user, $password);
|
||||
}
|
||||
|
||||
// The exceptions that might happen here include:
|
||||
// ConnectException - in that case there is no response. Don't catch the exception.
|
||||
// RequestException - if there is something in the response then pass it back.
|
||||
// otherwise re-throw the exception.
|
||||
// GuzzleException - something else unexpected happened. Don't catch the exception.
|
||||
try {
|
||||
$response = $client->send($request);
|
||||
} catch (RequestException $ex) {
|
||||
$response = $ex->getResponse();
|
||||
|
||||
//if the response was null for some reason do not return it but re-throw
|
||||
if ($response === null) {
|
||||
throw $ex;
|
||||
}
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string|null $url
|
||||
* @param string|null $xRequestId
|
||||
* @param string|null $method
|
||||
* @param string|null $user
|
||||
* @param string|null $password
|
||||
* @param array|null $headers ['X-MyHeader' => 'value']
|
||||
* @param mixed $body
|
||||
* @param array|null $config
|
||||
* @param CookieJar|null $cookies
|
||||
* @param bool $stream Set to true to stream a response rather
|
||||
* than download it all up-front.
|
||||
* @param int|null $timeout
|
||||
* @param Client|null $client
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public static function sendRequest(
|
||||
?string $url,
|
||||
?string $xRequestId,
|
||||
?string $method = 'GET',
|
||||
?string $user = null,
|
||||
?string $password = null,
|
||||
?array $headers = null,
|
||||
$body = null,
|
||||
?array $config = null,
|
||||
?CookieJar $cookies = null,
|
||||
bool $stream = false,
|
||||
?int $timeout = 0,
|
||||
?Client $client = null
|
||||
):ResponseInterface {
|
||||
if ((\getenv('DEBUG_ACCEPTANCE_RESPONSES') !== false) || (\getenv('DEBUG_ACCEPTANCE_API_CALLS') !== false)) {
|
||||
$debugResponses = true;
|
||||
} else {
|
||||
$debugResponses = false;
|
||||
}
|
||||
|
||||
$sendRetryLimit = self::numRetriesOnHttpTooEarly();
|
||||
$sendCount = 0;
|
||||
$sendExceptionHappened = false;
|
||||
|
||||
do {
|
||||
$response = self::sendRequestOnce(
|
||||
$url,
|
||||
$xRequestId,
|
||||
$method,
|
||||
$user,
|
||||
$password,
|
||||
$headers,
|
||||
$body,
|
||||
$config,
|
||||
$cookies,
|
||||
$stream,
|
||||
$timeout,
|
||||
$client
|
||||
);
|
||||
|
||||
if ($response->getStatusCode() >= 400 && $response->getStatusCode() !== self::HTTP_TOO_EARLY) {
|
||||
$sendExceptionHappened = true;
|
||||
}
|
||||
|
||||
if ($debugResponses) {
|
||||
self::debugResponse($response);
|
||||
}
|
||||
$sendCount = $sendCount + 1;
|
||||
$loopAgain = !$sendExceptionHappened && ($response->getStatusCode() === self::HTTP_TOO_EARLY) && ($sendCount <= $sendRetryLimit);
|
||||
if ($loopAgain) {
|
||||
// we need to repeat the send request, because we got HTTP_TOO_EARLY
|
||||
// wait 1 second before sending again, to give the server some time
|
||||
// to finish whatever post-processing it might be doing.
|
||||
\sleep(1);
|
||||
}
|
||||
} while ($loopAgain);
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Print details about the request.
|
||||
*
|
||||
* @param RequestInterface|null $request
|
||||
* @param string|null $user
|
||||
* @param string|null $password
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private static function debugRequest(?RequestInterface $request, ?string $user, ?string $password):void {
|
||||
print("### AUTH: $user:$password\n");
|
||||
print("### REQUEST: " . $request->getMethod() . " " . $request->getUri() . "\n");
|
||||
self::printHeaders($request->getHeaders());
|
||||
self::printBody($request->getBody());
|
||||
print("\n### END REQUEST\n");
|
||||
}
|
||||
|
||||
/**
|
||||
* Print details about the response.
|
||||
*
|
||||
* @param ResponseInterface|null $response
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private static function debugResponse(?ResponseInterface $response):void {
|
||||
print("### RESPONSE\n");
|
||||
print("Status: " . $response->getStatusCode() . "\n");
|
||||
self::printHeaders($response->getHeaders());
|
||||
self::printBody($response->getBody());
|
||||
print("\n### END RESPONSE\n");
|
||||
}
|
||||
|
||||
/**
|
||||
* Print details about the headers.
|
||||
*
|
||||
* @param array|null $headers
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private static function printHeaders(?array $headers):void {
|
||||
if ($headers) {
|
||||
print("Headers:\n");
|
||||
foreach ($headers as $header => $value) {
|
||||
if (\is_array($value)) {
|
||||
print($header . ": " . \implode(', ', $value) . "\n");
|
||||
} else {
|
||||
print($header . ": " . $value . "\n");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
print("Headers: none\n");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Print details about the body.
|
||||
*
|
||||
* @param StreamInterface|null $body
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private static function printBody(?StreamInterface $body):void {
|
||||
print("Body:\n");
|
||||
\var_dump($body->getContents());
|
||||
// Rewind the stream so that later code can read from the start.
|
||||
$body->rewind();
|
||||
}
|
||||
|
||||
/**
|
||||
* Send the requests to the server in parallel.
|
||||
* This function takes an array of requests and an optional client.
|
||||
* It will send all the requests to the server using the Pool object in guzzle.
|
||||
*
|
||||
* @param array|null $requests
|
||||
* @param Client|null $client
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function sendBatchRequest(
|
||||
?array $requests,
|
||||
?Client $client
|
||||
):array {
|
||||
$results = Pool::batch($client, $requests);
|
||||
return $results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a Guzzle Client
|
||||
* This creates a client object that can be used later to send a request object(s)
|
||||
*
|
||||
* @param string|null $user
|
||||
* @param string|null $password
|
||||
* @param array|null $config
|
||||
* @param CookieJar|null $cookies
|
||||
* @param bool $stream Set to true to stream a response rather
|
||||
* than download it all up-front.
|
||||
* @param int|null $timeout
|
||||
*
|
||||
* @return Client
|
||||
*/
|
||||
public static function createClient(
|
||||
?string $user = null,
|
||||
?string $password = null,
|
||||
?array $config = null,
|
||||
?CookieJar $cookies = null,
|
||||
?bool $stream = false,
|
||||
?int $timeout = 0
|
||||
):Client {
|
||||
$options = [];
|
||||
if ($user !== null) {
|
||||
$options['auth'] = [$user, $password];
|
||||
}
|
||||
if ($config !== null) {
|
||||
$options['config'] = $config;
|
||||
}
|
||||
if ($cookies !== null) {
|
||||
$options['cookies'] = $cookies;
|
||||
}
|
||||
$options['stream'] = $stream;
|
||||
$options['verify'] = false;
|
||||
$options['timeout'] = $timeout;
|
||||
$client = new Client($options);
|
||||
return $client;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an http request based on given parameters.
|
||||
* This creates a RequestInterface object that can be used with a client to send a request.
|
||||
* This enables us to create multiple requests in advance so that we can send them to the server at once in parallel.
|
||||
*
|
||||
* @param string|null $url
|
||||
* @param string|null $xRequestId
|
||||
* @param string|null $method
|
||||
* @param array|null $headers ['X-MyHeader' => 'value']
|
||||
* @param string|array $body either the actual string to send in the body,
|
||||
* or an array of key-value pairs to be converted
|
||||
* into a body with http_build_query.
|
||||
*
|
||||
* @return RequestInterface
|
||||
*/
|
||||
public static function createRequest(
|
||||
?string $url,
|
||||
?string $xRequestId = '',
|
||||
?string $method = 'GET',
|
||||
?array $headers = null,
|
||||
$body = null
|
||||
):RequestInterface {
|
||||
if ($headers === null) {
|
||||
$headers = [];
|
||||
}
|
||||
if ($xRequestId !== '') {
|
||||
$headers['X-Request-ID'] = $xRequestId;
|
||||
}
|
||||
if (\is_array($body)) {
|
||||
// when creating the client, it is possible to set 'form_params' and
|
||||
// the Client constructor sorts out doing this http_build_query stuff.
|
||||
// But 'new Request' does not have the flexibility to do that.
|
||||
// So we need to do it here.
|
||||
$body = \http_build_query($body, '', '&');
|
||||
$headers['Content-Type'] = 'application/x-www-form-urlencoded';
|
||||
}
|
||||
|
||||
if (OcisHelper::isTestingParallelDeployment()) {
|
||||
// oCIS cannot handle '/apps/testing' endpoints
|
||||
// so those requests must be redirected to oC10 server
|
||||
// change server to oC10 if the request url has `/apps/testing`
|
||||
if (strpos($url, "/apps/testing") !== false) {
|
||||
$oCISServerUrl = \getenv('TEST_SERVER_URL');
|
||||
$oC10ServerUrl = \getenv('TEST_OC10_URL');
|
||||
$url = str_replace($oCISServerUrl, $oC10ServerUrl, $url);
|
||||
} else {
|
||||
// set 'owncloud-server' selector cookie for oCIS requests
|
||||
$headers['Cookie'] = self::getOCSelectorCookie();
|
||||
}
|
||||
}
|
||||
|
||||
$request = new Request(
|
||||
$method,
|
||||
$url,
|
||||
$headers,
|
||||
$body
|
||||
);
|
||||
return $request;
|
||||
}
|
||||
|
||||
/**
|
||||
* same as HttpRequestHelper::sendRequest() but with "GET" as method
|
||||
*
|
||||
* @param string|null $url
|
||||
* @param string|null $xRequestId
|
||||
* @param string|null $user
|
||||
* @param string|null $password
|
||||
* @param array|null $headers ['X-MyHeader' => 'value']
|
||||
* @param mixed $body
|
||||
* @param array|null $config
|
||||
* @param CookieJar|null $cookies
|
||||
* @param boolean $stream
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws GuzzleException
|
||||
* @see HttpRequestHelper::sendRequest()
|
||||
*/
|
||||
public static function get(
|
||||
?string $url,
|
||||
?string $xRequestId,
|
||||
?string $user = null,
|
||||
?string $password = null,
|
||||
?array $headers = null,
|
||||
$body = null,
|
||||
?array $config = null,
|
||||
?CookieJar $cookies = null,
|
||||
?bool $stream = false
|
||||
):ResponseInterface {
|
||||
return self::sendRequest(
|
||||
$url,
|
||||
$xRequestId,
|
||||
'GET',
|
||||
$user,
|
||||
$password,
|
||||
$headers,
|
||||
$body,
|
||||
$config,
|
||||
$cookies,
|
||||
$stream
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* same as HttpRequestHelper::sendRequest() but with "POST" as method
|
||||
*
|
||||
* @param string|null $url
|
||||
* @param string|null $xRequestId
|
||||
* @param string|null $user
|
||||
* @param string|null $password
|
||||
* @param array|null $headers ['X-MyHeader' => 'value']
|
||||
* @param mixed $body
|
||||
* @param array|null $config
|
||||
* @param CookieJar|null $cookies
|
||||
* @param boolean $stream
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws GuzzleException
|
||||
* @see HttpRequestHelper::sendRequest()
|
||||
*/
|
||||
public static function post(
|
||||
?string $url,
|
||||
?string $xRequestId,
|
||||
?string $user = null,
|
||||
?string $password = null,
|
||||
?array $headers = null,
|
||||
$body = null,
|
||||
?array $config = null,
|
||||
?CookieJar $cookies = null,
|
||||
?bool $stream = false
|
||||
):ResponseInterface {
|
||||
return self::sendRequest(
|
||||
$url,
|
||||
$xRequestId,
|
||||
'POST',
|
||||
$user,
|
||||
$password,
|
||||
$headers,
|
||||
$body,
|
||||
$config,
|
||||
$cookies,
|
||||
$stream
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* same as HttpRequestHelper::sendRequest() but with "PUT" as method
|
||||
*
|
||||
* @param string|null $url
|
||||
* @param string|null $xRequestId
|
||||
* @param string|null $user
|
||||
* @param string|null $password
|
||||
* @param array|null $headers ['X-MyHeader' => 'value']
|
||||
* @param mixed $body
|
||||
* @param array|null $config
|
||||
* @param CookieJar|null $cookies
|
||||
* @param boolean $stream
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws GuzzleException
|
||||
* @see HttpRequestHelper::sendRequest()
|
||||
*/
|
||||
public static function put(
|
||||
?string $url,
|
||||
?string $xRequestId,
|
||||
?string $user = null,
|
||||
?string $password = null,
|
||||
?array $headers = null,
|
||||
$body = null,
|
||||
?array $config = null,
|
||||
?CookieJar $cookies = null,
|
||||
?bool $stream = false
|
||||
):ResponseInterface {
|
||||
return self::sendRequest(
|
||||
$url,
|
||||
$xRequestId,
|
||||
'PUT',
|
||||
$user,
|
||||
$password,
|
||||
$headers,
|
||||
$body,
|
||||
$config,
|
||||
$cookies,
|
||||
$stream
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* same as HttpRequestHelper::sendRequest() but with "DELETE" as method
|
||||
*
|
||||
* @param string|null $url
|
||||
* @param string|null $xRequestId
|
||||
* @param string|null $user
|
||||
* @param string|null $password
|
||||
* @param array|null $headers ['X-MyHeader' => 'value']
|
||||
* @param mixed $body
|
||||
* @param array|null $config
|
||||
* @param CookieJar|null $cookies
|
||||
* @param boolean $stream
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws GuzzleException
|
||||
* @see HttpRequestHelper::sendRequest()
|
||||
*
|
||||
*/
|
||||
public static function delete(
|
||||
?string $url,
|
||||
?string $xRequestId,
|
||||
?string $user = null,
|
||||
?string $password = null,
|
||||
?array $headers = null,
|
||||
$body = null,
|
||||
?array $config = null,
|
||||
?CookieJar $cookies = null,
|
||||
?bool $stream = false
|
||||
):ResponseInterface {
|
||||
return self::sendRequest(
|
||||
$url,
|
||||
$xRequestId,
|
||||
'DELETE',
|
||||
$user,
|
||||
$password,
|
||||
$headers,
|
||||
$body,
|
||||
$config,
|
||||
$cookies,
|
||||
$stream
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the response as XML and returns a SimpleXMLElement with these
|
||||
* registered namespaces:
|
||||
* | prefix | namespace |
|
||||
* | d | DAV: |
|
||||
* | oc | http://owncloud.org/ns |
|
||||
* | ocs | http://open-collaboration-services.org/ns |
|
||||
*
|
||||
* @param ResponseInterface $response
|
||||
* @param string|null $exceptionText text to put at the front of exception messages
|
||||
*
|
||||
* @return SimpleXMLElement
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function getResponseXml(ResponseInterface $response, ?string $exceptionText = ''):SimpleXMLElement {
|
||||
// rewind just to make sure we can re-parse it in case it was parsed already...
|
||||
$response->getBody()->rewind();
|
||||
$contents = $response->getBody()->getContents();
|
||||
try {
|
||||
$responseXmlObject = new SimpleXMLElement($contents);
|
||||
$responseXmlObject->registerXPathNamespace(
|
||||
'ocs',
|
||||
'http://open-collaboration-services.org/ns'
|
||||
);
|
||||
$responseXmlObject->registerXPathNamespace(
|
||||
'oc',
|
||||
'http://owncloud.org/ns'
|
||||
);
|
||||
$responseXmlObject->registerXPathNamespace(
|
||||
'd',
|
||||
'DAV:'
|
||||
);
|
||||
return $responseXmlObject;
|
||||
} catch (Exception $e) {
|
||||
if ($exceptionText !== '') {
|
||||
$exceptionText = $exceptionText . ' ';
|
||||
}
|
||||
if ($contents === '') {
|
||||
throw new Exception($exceptionText . "Received empty response where XML was expected");
|
||||
}
|
||||
$message = $exceptionText . "Exception parsing response body: \"" . $contents . "\"";
|
||||
throw new Exception($message, 0, $e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* parses the body content of $response and returns an array representing the XML
|
||||
* This function returns an array with the following three elements:
|
||||
* * name - The root element name.
|
||||
* * value - The value for the root element.
|
||||
* * attributes - An array of attributes.
|
||||
*
|
||||
* @param ResponseInterface $response
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function parseResponseAsXml(ResponseInterface $response):array {
|
||||
$body = $response->getBody()->getContents();
|
||||
$parsedResponse = [];
|
||||
if ($body && \substr($body, 0, 1) === '<') {
|
||||
try {
|
||||
$reader = new Reader();
|
||||
$reader->xml($body);
|
||||
$parsedResponse = $reader->parse();
|
||||
} catch (LibXMLException $e) {
|
||||
// Sometimes the body can be a real page of HTML and text.
|
||||
// So it may not be a complete ordinary piece of XML.
|
||||
// The XML parse might fail with an exception message like:
|
||||
// Opening and ending tag mismatch: link line 31 and head.
|
||||
}
|
||||
}
|
||||
return $parsedResponse;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,343 @@
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* ownCloud
|
||||
*
|
||||
* @author Artur Neumann <artur@jankaritech.com>
|
||||
* @copyright Copyright (c) 2020 Artur Neumann artur@jankaritech.com
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License,
|
||||
* as published by the Free Software Foundation;
|
||||
* either version 3 of the License, or any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
*/
|
||||
|
||||
namespace TestHelpers;
|
||||
|
||||
use Exception;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
|
||||
/**
|
||||
* Class OcisHelper
|
||||
*
|
||||
* Helper functions that are needed to run tests on OCIS
|
||||
*
|
||||
* @package TestHelpers
|
||||
*/
|
||||
class OcisHelper {
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public static function isTestingOnReva():bool {
|
||||
return (\getenv("TEST_REVA") === "true");
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public static function isTestingParallelDeployment(): bool {
|
||||
return (\getenv("TEST_PARALLEL_DEPLOYMENT") === "true");
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public static function isTestingWithGraphApi(): bool {
|
||||
return \getenv('TEST_WITH_GRAPH_API') === 'true';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool|string false if no command given or the command as string
|
||||
*/
|
||||
public static function getDeleteUserDataCommand() {
|
||||
$cmd = \getenv("DELETE_USER_DATA_CMD");
|
||||
if ($cmd === false || \trim($cmd) === "") {
|
||||
return false;
|
||||
}
|
||||
return $cmd;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function getStorageDriver():string {
|
||||
$storageDriver = (\getenv("STORAGE_DRIVER"));
|
||||
if ($storageDriver === false) {
|
||||
return "OWNCLOUD";
|
||||
}
|
||||
$storageDriver = \strtoupper($storageDriver);
|
||||
if ($storageDriver !== "OCIS" && $storageDriver !== "EOS" && $storageDriver !== "OWNCLOUD" && $storageDriver !== "S3NG") {
|
||||
throw new Exception(
|
||||
"Invalid storage driver. " .
|
||||
"STORAGE_DRIVER must be OCIS|EOS|OWNCLOUD|S3NG"
|
||||
);
|
||||
}
|
||||
return $storageDriver;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $user
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function deleteRevaUserData(?string $user = ""):void {
|
||||
$deleteCmd = self::getDeleteUserDataCommand();
|
||||
if ($deleteCmd === false) {
|
||||
if (self::getStorageDriver() === "OWNCLOUD") {
|
||||
self::recurseRmdir(self::getOcisRevaDataRoot() . $user);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (self::getStorageDriver() === "EOS") {
|
||||
$deleteCmd = \str_replace(
|
||||
"%s",
|
||||
$user[0] . '/' . $user,
|
||||
$deleteCmd
|
||||
);
|
||||
} else {
|
||||
$deleteCmd = \sprintf($deleteCmd, $user);
|
||||
}
|
||||
\exec($deleteCmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper for Recursive Copy of file/folder
|
||||
* For more info check this out https://gist.github.com/gserrano/4c9648ec9eb293b9377b
|
||||
*
|
||||
* @param string|null $source
|
||||
* @param string|null $destination
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function recurseCopy(?string $source, ?string $destination):void {
|
||||
$dir = \opendir($source);
|
||||
@\mkdir($destination);
|
||||
while (($file = \readdir($dir)) !== false) {
|
||||
if (($file != '.') && ($file != '..')) {
|
||||
if (\is_dir($source . '/' . $file)) {
|
||||
self::recurseCopy($source . '/' . $file, $destination . '/' . $file);
|
||||
} else {
|
||||
\copy($source . '/' . $file, $destination . '/' . $file);
|
||||
}
|
||||
}
|
||||
}
|
||||
\closedir($dir);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper for Recursive Upload of file/folder
|
||||
*
|
||||
* @param string|null $baseUrl
|
||||
* @param string|null $source
|
||||
* @param string|null $userId
|
||||
* @param string|null $password
|
||||
* @param string|null $xRequestId
|
||||
* @param string|null $destination
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function recurseUpload(
|
||||
?string $baseUrl,
|
||||
?string $source,
|
||||
?string $userId,
|
||||
?string $password,
|
||||
?string $xRequestId = '',
|
||||
?string $destination = ''
|
||||
):void {
|
||||
if ($destination !== '') {
|
||||
$response = WebDavHelper::makeDavRequest(
|
||||
$baseUrl,
|
||||
$userId,
|
||||
$password,
|
||||
"MKCOL",
|
||||
$destination,
|
||||
[],
|
||||
$xRequestId
|
||||
);
|
||||
if ($response->getStatusCode() !== 201) {
|
||||
throw new Exception("Could not create folder destination" . $response->getBody()->getContents());
|
||||
}
|
||||
}
|
||||
|
||||
$dir = \opendir($source);
|
||||
while (($file = \readdir($dir)) !== false) {
|
||||
if (($file != '.') && ($file != '..')) {
|
||||
$sourcePath = $source . '/' . $file;
|
||||
$destinationPath = $destination . '/' . $file;
|
||||
if (\is_dir($sourcePath)) {
|
||||
self::recurseUpload(
|
||||
$baseUrl,
|
||||
$sourcePath,
|
||||
$userId,
|
||||
$password,
|
||||
$xRequestId,
|
||||
$destinationPath
|
||||
);
|
||||
} else {
|
||||
$response = UploadHelper::upload(
|
||||
$baseUrl,
|
||||
$userId,
|
||||
$password,
|
||||
$sourcePath,
|
||||
$destinationPath,
|
||||
$xRequestId
|
||||
);
|
||||
$responseStatus = $response->getStatusCode();
|
||||
if ($responseStatus !== 201) {
|
||||
throw new Exception(
|
||||
"Could not upload skeleton file $sourcePath to $destinationPath for user '$userId' status '$responseStatus' response body: '"
|
||||
. $response->getBody()->getContents() . "'"
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
\closedir($dir);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public static function getLdapPort():int {
|
||||
$port = \getenv("REVA_LDAP_PORT");
|
||||
return $port ? (int)$port : 636;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public static function useSsl():bool {
|
||||
$useSsl = \getenv("REVA_LDAP_USESSL");
|
||||
if ($useSsl === false) {
|
||||
return (self::getLdapPort() === 636);
|
||||
} else {
|
||||
return $useSsl === "true";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public static function getBaseDN():string {
|
||||
$dn = \getenv("REVA_LDAP_BASE_DN");
|
||||
return $dn ? $dn : "dc=owncloud,dc=com";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public static function getGroupsOU():string {
|
||||
$ou = \getenv("REVA_LDAP_GROUPS_OU");
|
||||
return $ou ? $ou : "TestGroups";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public static function getUsersOU():string {
|
||||
$ou = \getenv("REVA_LDAP_USERS_OU");
|
||||
return $ou ? $ou : "TestUsers";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public static function getGroupSchema():string {
|
||||
$schema = \getenv("REVA_LDAP_GROUP_SCHEMA");
|
||||
return $schema ? $schema : "rfc2307";
|
||||
}
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public static function getHostname():string {
|
||||
$hostname = \getenv("REVA_LDAP_HOSTNAME");
|
||||
return $hostname ? $hostname : "localhost";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public static function getBindDN():string {
|
||||
$dn = \getenv("REVA_LDAP_BIND_DN");
|
||||
return $dn ? $dn : "cn=admin,dc=owncloud,dc=com";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public static function getBindPassword():string {
|
||||
$pw = \getenv("REVA_LDAP_BIND_PASSWORD");
|
||||
return $pw ? $pw : "";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
private static function getOcisRevaDataRoot():string {
|
||||
$root = \getenv("OCIS_REVA_DATA_ROOT");
|
||||
if ($root === false || $root === "") {
|
||||
$root = "/var/tmp/ocis/owncloud/";
|
||||
}
|
||||
if (!\file_exists($root)) {
|
||||
echo "WARNING: reva data root folder ($root) does not exist\n";
|
||||
}
|
||||
return $root;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $dir
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private static function recurseRmdir(?string $dir):bool {
|
||||
if (\file_exists($dir) === true) {
|
||||
$files = \array_diff(\scandir($dir), ['.', '..']);
|
||||
foreach ($files as $file) {
|
||||
if (\is_dir("$dir/$file")) {
|
||||
self::recurseRmdir("$dir/$file");
|
||||
} else {
|
||||
\unlink("$dir/$file");
|
||||
}
|
||||
}
|
||||
return \rmdir($dir);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* On Eos storage backend when the user data is cleared after test run
|
||||
* Running another test immediately fails. So Send this request to create user home directory
|
||||
*
|
||||
* @param string|null $baseUrl
|
||||
* @param string|null $user
|
||||
* @param string|null $password
|
||||
* @param string|null $xRequestId
|
||||
*
|
||||
* @return void
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public static function createEOSStorageHome(
|
||||
?string $baseUrl,
|
||||
?string $user,
|
||||
?string $password,
|
||||
?string $xRequestId = ''
|
||||
):void {
|
||||
HttpRequestHelper::get(
|
||||
$baseUrl . "/ocs/v2.php/apps/notifications/api/v1/notifications",
|
||||
$xRequestId,
|
||||
$user,
|
||||
$password
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* ownCloud
|
||||
*
|
||||
* @author Artur Neumann <artur@jankaritech.com>
|
||||
* @copyright Copyright (c) 2017 Artur Neumann artur@jankaritech.com
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License,
|
||||
* as published by the Free Software Foundation;
|
||||
* either version 3 of the License, or any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
*/
|
||||
namespace TestHelpers;
|
||||
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
use Psr\Http\Message\RequestInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
/**
|
||||
* Helper to make requests to the OCS API
|
||||
*
|
||||
* @author Artur Neumann <artur@jankaritech.com>
|
||||
*
|
||||
*/
|
||||
class OcsApiHelper {
|
||||
/**
|
||||
* @param string|null $baseUrl
|
||||
* @param string|null $user if set to null no authentication header will be sent
|
||||
* @param string|null $password
|
||||
* @param string|null $method HTTP Method
|
||||
* @param string|null $path
|
||||
* @param string|null $xRequestId
|
||||
* @param mixed $body array of key, value pairs e.g ['value' => 'yes']
|
||||
* @param int|null $ocsApiVersion (1|2) default 2
|
||||
* @param array|null $headers
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public static function sendRequest(
|
||||
?string $baseUrl,
|
||||
?string $user,
|
||||
?string $password,
|
||||
?string $method,
|
||||
?string $path,
|
||||
?string $xRequestId = '',
|
||||
$body = [],
|
||||
?int $ocsApiVersion = 2,
|
||||
?array $headers = []
|
||||
):ResponseInterface {
|
||||
$fullUrl = $baseUrl;
|
||||
if (\substr($fullUrl, -1) !== '/') {
|
||||
$fullUrl .= '/';
|
||||
}
|
||||
$fullUrl .= "ocs/v{$ocsApiVersion}.php" . $path;
|
||||
$headers['OCS-APIREQUEST'] = true;
|
||||
return HttpRequestHelper::sendRequest($fullUrl, $xRequestId, $method, $user, $password, $headers, $body);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string|null $baseUrl
|
||||
* @param string|null $method HTTP Method
|
||||
* @param string|null $path
|
||||
* @param string|null $xRequestId
|
||||
* @param mixed $body array of key, value pairs e.g ['value' => 'yes']
|
||||
* @param int|null $ocsApiVersion (1|2) default 2
|
||||
* @param array|null $headers
|
||||
*
|
||||
* @return RequestInterface
|
||||
*/
|
||||
public static function createOcsRequest(
|
||||
?string $baseUrl,
|
||||
?string $method,
|
||||
?string $path,
|
||||
?string $xRequestId = '',
|
||||
$body = [],
|
||||
?int $ocsApiVersion = 2,
|
||||
?array $headers = []
|
||||
):RequestInterface {
|
||||
$fullUrl = $baseUrl;
|
||||
if (\substr($fullUrl, -1) !== '/') {
|
||||
$fullUrl .= '/';
|
||||
}
|
||||
$fullUrl .= "ocs/v{$ocsApiVersion}.php" . $path;
|
||||
return HttpRequestHelper::createRequest(
|
||||
$fullUrl,
|
||||
$xRequestId,
|
||||
$method,
|
||||
$headers,
|
||||
$body
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,486 @@
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* ownCloud
|
||||
*
|
||||
* @author Artur Neumann <artur@jankaritech.com>
|
||||
* @copyright Copyright (c) 2017 Artur Neumann artur@jankaritech.com
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License,
|
||||
* as published by the Free Software Foundation;
|
||||
* either version 3 of the License, or any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
*/
|
||||
namespace TestHelpers;
|
||||
|
||||
use Behat\Testwork\Hook\Scope\HookScope;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
use GuzzleHttp\Exception\ServerException;
|
||||
use Exception;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use SimpleXMLElement;
|
||||
|
||||
/**
|
||||
* Helper to setup UI / Integration tests
|
||||
*
|
||||
* @author Artur Neumann <artur@jankaritech.com>
|
||||
*
|
||||
*/
|
||||
class SetupHelper extends \PHPUnit\Framework\Assert {
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private static $ocPath = null;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private static $baseUrl = null;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private static $adminUsername = null;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private static $adminPassword = null;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param HookScope $scope
|
||||
*
|
||||
* @return array of suite context parameters
|
||||
*/
|
||||
public static function getSuiteParameters(HookScope $scope):array {
|
||||
return $scope->getEnvironment()->getSuite()
|
||||
->getSettings() ['context'] ['parameters'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Fixup OC path so that it always starts with a "/" and does not end with
|
||||
* a "/".
|
||||
*
|
||||
* @param string|null $ocPath
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private static function normaliseOcPath(?string $ocPath):string {
|
||||
return '/' . \trim($ocPath, '/');
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string|null $adminUsername
|
||||
* @param string|null $adminPassword
|
||||
* @param string|null $baseUrl
|
||||
* @param string|null $ocPath
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function init(
|
||||
?string $adminUsername,
|
||||
?string $adminPassword,
|
||||
?string $baseUrl,
|
||||
?string $ocPath
|
||||
): void {
|
||||
foreach (\func_get_args() as $variableToCheck) {
|
||||
if (!\is_string($variableToCheck)) {
|
||||
throw new \InvalidArgumentException(
|
||||
"mandatory argument missing or wrong type ($variableToCheck => "
|
||||
. \gettype($variableToCheck) . ")"
|
||||
);
|
||||
}
|
||||
}
|
||||
self::$adminUsername = $adminUsername;
|
||||
self::$adminPassword = $adminPassword;
|
||||
self::$baseUrl = \rtrim($baseUrl, '/');
|
||||
self::$ocPath = self::normaliseOcPath($ocPath);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string|null $baseUrl
|
||||
* @param string|null $adminUsername
|
||||
* @param string|null $adminPassword
|
||||
* @param string|null $xRequestId
|
||||
*
|
||||
* @return SimpleXMLElement
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public static function getSysInfo(
|
||||
?string $baseUrl,
|
||||
?string $adminUsername,
|
||||
?string $adminPassword,
|
||||
?string $xRequestId = ''
|
||||
):SimpleXMLElement {
|
||||
$result = OcsApiHelper::sendRequest(
|
||||
$baseUrl,
|
||||
$adminUsername,
|
||||
$adminPassword,
|
||||
"GET",
|
||||
"/apps/testing/api/v1/sysinfo",
|
||||
$xRequestId
|
||||
);
|
||||
if ($result->getStatusCode() !== 200) {
|
||||
throw new \Exception(
|
||||
"could not get sysinfo " . $result->getReasonPhrase()
|
||||
);
|
||||
}
|
||||
return HttpRequestHelper::getResponseXml($result, __METHOD__)->data;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string|null $baseUrl
|
||||
* @param string|null $adminUsername
|
||||
* @param string|null $adminPassword
|
||||
* @param string|null $xRequestId
|
||||
*
|
||||
* @return string
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public static function getServerRoot(
|
||||
?string $baseUrl,
|
||||
?string $adminUsername,
|
||||
?string $adminPassword,
|
||||
?string $xRequestId = ''
|
||||
):string {
|
||||
$sysInfo = self::getSysInfo(
|
||||
$baseUrl,
|
||||
$adminUsername,
|
||||
$adminPassword,
|
||||
$xRequestId
|
||||
);
|
||||
// server_root is a SimpleXMLElement object that "wraps" a string.
|
||||
/// We want the bare string.
|
||||
return (string) $sysInfo->server_root;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $adminUsername
|
||||
* @param string|null $callerName
|
||||
*
|
||||
* @return string
|
||||
* @throws Exception
|
||||
*/
|
||||
private static function checkAdminUsername(?string $adminUsername, ?string $callerName):?string {
|
||||
if (self::$adminUsername === null
|
||||
&& $adminUsername === null
|
||||
) {
|
||||
throw new Exception(
|
||||
"$callerName called without adminUsername - pass the username or call SetupHelper::init"
|
||||
);
|
||||
}
|
||||
if ($adminUsername === null) {
|
||||
$adminUsername = self::$adminUsername;
|
||||
}
|
||||
return $adminUsername;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $adminPassword
|
||||
* @param string|null $callerName
|
||||
*
|
||||
* @return string
|
||||
* @throws Exception
|
||||
*/
|
||||
private static function checkAdminPassword(?string $adminPassword, ?string $callerName):string {
|
||||
if (self::$adminPassword === null
|
||||
&& $adminPassword === null
|
||||
) {
|
||||
throw new Exception(
|
||||
"$callerName called without adminPassword - pass the password or call SetupHelper::init"
|
||||
);
|
||||
}
|
||||
if ($adminPassword === null) {
|
||||
$adminPassword = self::$adminPassword;
|
||||
}
|
||||
return $adminPassword;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $baseUrl
|
||||
* @param string|null $callerName
|
||||
*
|
||||
* @return string
|
||||
* @throws Exception
|
||||
*/
|
||||
private static function checkBaseUrl(?string $baseUrl, ?string $callerName):?string {
|
||||
if (self::$baseUrl === null
|
||||
&& $baseUrl === null
|
||||
) {
|
||||
throw new Exception(
|
||||
"$callerName called without baseUrl - pass the baseUrl or call SetupHelper::init"
|
||||
);
|
||||
}
|
||||
if ($baseUrl === null) {
|
||||
$baseUrl = self::$baseUrl;
|
||||
}
|
||||
return $baseUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string|null $dirPathFromServerRoot e.g. 'apps2/myapp/appinfo'
|
||||
* @param string|null $xRequestId
|
||||
* @param string|null $baseUrl
|
||||
* @param string|null $adminUsername
|
||||
* @param string|null $adminPassword
|
||||
*
|
||||
* @return void
|
||||
* @throws GuzzleException
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function mkDirOnServer(
|
||||
?string $dirPathFromServerRoot,
|
||||
?string $xRequestId = '',
|
||||
?string $baseUrl = null,
|
||||
?string $adminUsername = null,
|
||||
?string $adminPassword = null
|
||||
):void {
|
||||
$baseUrl = self::checkBaseUrl($baseUrl, "mkDirOnServer");
|
||||
$adminUsername = self::checkAdminUsername($adminUsername, "mkDirOnServer");
|
||||
$adminPassword = self::checkAdminPassword($adminPassword, "mkDirOnServer");
|
||||
$result = OcsApiHelper::sendRequest(
|
||||
$baseUrl,
|
||||
$adminUsername,
|
||||
$adminPassword,
|
||||
"POST",
|
||||
"/apps/testing/api/v1/dir",
|
||||
$xRequestId,
|
||||
['dir' => $dirPathFromServerRoot]
|
||||
);
|
||||
|
||||
if ($result->getStatusCode() !== 200) {
|
||||
throw new \Exception(
|
||||
"could not create directory $dirPathFromServerRoot " . $result->getReasonPhrase()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string|null $dirPathFromServerRoot e.g. 'apps2/myapp/appinfo'
|
||||
* @param string|null $xRequestId
|
||||
* @param string|null $baseUrl
|
||||
* @param string|null $adminUsername
|
||||
* @param string|null $adminPassword
|
||||
*
|
||||
* @return void
|
||||
* @throws GuzzleException
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function rmDirOnServer(
|
||||
?string $dirPathFromServerRoot,
|
||||
?string $xRequestId = '',
|
||||
?string $baseUrl = null,
|
||||
?string $adminUsername = null,
|
||||
?string $adminPassword = null
|
||||
):void {
|
||||
$baseUrl = self::checkBaseUrl($baseUrl, "rmDirOnServer");
|
||||
$adminUsername = self::checkAdminUsername($adminUsername, "rmDirOnServer");
|
||||
$adminPassword = self::checkAdminPassword($adminPassword, "rmDirOnServer");
|
||||
$result = OcsApiHelper::sendRequest(
|
||||
$baseUrl,
|
||||
$adminUsername,
|
||||
$adminPassword,
|
||||
"DELETE",
|
||||
"/apps/testing/api/v1/dir",
|
||||
$xRequestId,
|
||||
['dir' => $dirPathFromServerRoot]
|
||||
);
|
||||
|
||||
if ($result->getStatusCode() !== 200) {
|
||||
throw new \Exception(
|
||||
"could not delete directory $dirPathFromServerRoot " . $result->getReasonPhrase()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string|null $filePathFromServerRoot e.g. 'app2/myapp/appinfo/info.xml'
|
||||
* @param string|null $content
|
||||
* @param string|null $xRequestId
|
||||
* @param string|null $baseUrl
|
||||
* @param string|null $adminUsername
|
||||
* @param string|null $adminPassword
|
||||
*
|
||||
* @return void
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public static function createFileOnServer(
|
||||
?string $filePathFromServerRoot,
|
||||
?string $content,
|
||||
?string $xRequestId = '',
|
||||
?string $baseUrl = null,
|
||||
?string $adminUsername = null,
|
||||
?string $adminPassword = null
|
||||
):void {
|
||||
$baseUrl = self::checkBaseUrl($baseUrl, "createFileOnServer");
|
||||
$adminUsername = self::checkAdminUsername($adminUsername, "createFileOnServer");
|
||||
$adminPassword = self::checkAdminPassword($adminPassword, "createFileOnServer");
|
||||
$result = OcsApiHelper::sendRequest(
|
||||
$baseUrl,
|
||||
$adminUsername,
|
||||
$adminPassword,
|
||||
"POST",
|
||||
"/apps/testing/api/v1/file",
|
||||
$xRequestId,
|
||||
[
|
||||
'file' => $filePathFromServerRoot,
|
||||
'content' => $content
|
||||
]
|
||||
);
|
||||
|
||||
if ($result->getStatusCode() !== 200) {
|
||||
throw new \Exception(
|
||||
"could not create file $filePathFromServerRoot " . $result->getReasonPhrase()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string|null $filePathFromServerRoot e.g. 'app2/myapp/appinfo/info.xml'
|
||||
* @param string|null $xRequestId
|
||||
* @param string|null $baseUrl
|
||||
* @param string|null $adminUsername
|
||||
* @param string|null $adminPassword
|
||||
*
|
||||
* @return void
|
||||
* @throws GuzzleException
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function deleteFileOnServer(
|
||||
?string $filePathFromServerRoot,
|
||||
?string $xRequestId = '',
|
||||
?string $baseUrl = null,
|
||||
?string $adminUsername = null,
|
||||
?string $adminPassword = null
|
||||
):void {
|
||||
$baseUrl = self::checkBaseUrl($baseUrl, "deleteFileOnServer");
|
||||
$adminUsername = self::checkAdminUsername($adminUsername, "deleteFileOnServer");
|
||||
$adminPassword = self::checkAdminPassword($adminPassword, "deleteFileOnServer");
|
||||
$result = OcsApiHelper::sendRequest(
|
||||
$baseUrl,
|
||||
$adminUsername,
|
||||
$adminPassword,
|
||||
"DELETE",
|
||||
"/apps/testing/api/v1/file",
|
||||
$xRequestId,
|
||||
[
|
||||
'file' => $filePathFromServerRoot
|
||||
]
|
||||
);
|
||||
|
||||
if ($result->getStatusCode() !== 200) {
|
||||
throw new \Exception(
|
||||
"could not delete file $filePathFromServerRoot " . $result->getReasonPhrase()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $fileInCore e.g. 'app2/myapp/appinfo/info.xml'
|
||||
* @param string|null $xRequestId
|
||||
* @param string|null $baseUrl
|
||||
* @param string|null $adminUsername
|
||||
* @param string|null $adminPassword
|
||||
*
|
||||
* @return string
|
||||
* @throws GuzzleException
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function readFileFromServer(
|
||||
?string $fileInCore,
|
||||
?string $xRequestId = '',
|
||||
?string $baseUrl = null,
|
||||
?string $adminUsername = null,
|
||||
?string $adminPassword = null
|
||||
):string {
|
||||
$baseUrl = self::checkBaseUrl($baseUrl, "readFile");
|
||||
$adminUsername = self::checkAdminUsername(
|
||||
$adminUsername,
|
||||
"readFile"
|
||||
);
|
||||
$adminPassword = self::checkAdminPassword(
|
||||
$adminPassword,
|
||||
"readFile"
|
||||
);
|
||||
|
||||
$response = OcsApiHelper::sendRequest(
|
||||
$baseUrl,
|
||||
$adminUsername,
|
||||
$adminPassword,
|
||||
'GET',
|
||||
"/apps/testing/api/v1/file?file={$fileInCore}",
|
||||
$xRequestId
|
||||
);
|
||||
self::assertSame(
|
||||
200,
|
||||
$response->getStatusCode(),
|
||||
"Failed to read the file {$fileInCore}"
|
||||
);
|
||||
$localContent = HttpRequestHelper::getResponseXml($response, __METHOD__);
|
||||
$localContent = (string)$localContent->data->element->contentUrlEncoded;
|
||||
return \urldecode($localContent);
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the content of a file in a skeleton folder
|
||||
*
|
||||
* @param string|null $fileInSkeletonFolder
|
||||
* @param string|null $xRequestId
|
||||
* @param string|null $baseUrl
|
||||
* @param string|null $adminUsername
|
||||
* @param string|null $adminPassword
|
||||
*
|
||||
* @return string content of the file
|
||||
* @throws GuzzleException
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function readSkeletonFile(
|
||||
?string $fileInSkeletonFolder,
|
||||
?string $xRequestId = '',
|
||||
?string $baseUrl = null,
|
||||
?string $adminUsername = null,
|
||||
?string $adminPassword = null
|
||||
):string {
|
||||
$baseUrl = self::checkBaseUrl($baseUrl, "readSkeletonFile");
|
||||
$adminUsername = self::checkAdminUsername(
|
||||
$adminUsername,
|
||||
"readSkeletonFile"
|
||||
);
|
||||
$adminPassword = self::checkAdminPassword(
|
||||
$adminPassword,
|
||||
"readSkeletonFile"
|
||||
);
|
||||
|
||||
$fileInSkeletonFolder = \rawurlencode("/$fileInSkeletonFolder");
|
||||
$response = OcsApiHelper::sendRequest(
|
||||
$baseUrl,
|
||||
$adminUsername,
|
||||
$adminPassword,
|
||||
'GET',
|
||||
"/apps/testing/api/v1/file?file={$fileInSkeletonFolder}&absolute=true",
|
||||
$xRequestId
|
||||
);
|
||||
self::assertSame(
|
||||
200,
|
||||
$response->getStatusCode(),
|
||||
"Failed to read the file {$fileInSkeletonFolder}"
|
||||
);
|
||||
$localContent = HttpRequestHelper::getResponseXml($response, __METHOD__);
|
||||
$localContent = (string)$localContent->data->element->contentUrlEncoded;
|
||||
$localContent = \urldecode($localContent);
|
||||
return $localContent;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,261 @@
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* ownCloud
|
||||
*
|
||||
* @author Artur Neumann <artur@jankaritech.com>
|
||||
* @copyright Copyright (c) 2017 Artur Neumann artur@jankaritech.com
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License,
|
||||
* as published by the Free Software Foundation;
|
||||
* either version 3 of the License, or any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
*/
|
||||
namespace TestHelpers;
|
||||
|
||||
use Exception;
|
||||
use InvalidArgumentException;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use SimpleXMLElement;
|
||||
|
||||
/**
|
||||
* manage Shares via OCS API
|
||||
*
|
||||
* @author Artur Neumann <artur@jankaritech.com>
|
||||
*
|
||||
*/
|
||||
class SharingHelper {
|
||||
public const PERMISSION_TYPES = [
|
||||
'read' => 1,
|
||||
'update' => 2,
|
||||
'create' => 4,
|
||||
'delete' => 8,
|
||||
'share' => 16,
|
||||
];
|
||||
|
||||
public const SHARE_TYPES = [
|
||||
'user' => 0,
|
||||
'group' => 1,
|
||||
'public_link' => 3,
|
||||
'federated' => 6,
|
||||
];
|
||||
|
||||
public const SHARE_STATES = [
|
||||
'accepted' => 0,
|
||||
'pending' => 1,
|
||||
'rejected' => 2,
|
||||
'declined' => 2, // declined is a synonym for rejected
|
||||
];
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $baseUrl baseURL of the ownCloud installation without /ocs.
|
||||
* @param string $user user that creates the share.
|
||||
* @param string $password password of the user that creates the share.
|
||||
* @param string $path The path to the file or folder which should be shared.
|
||||
* @param string|int $shareType The type of the share. This can be one of:
|
||||
* 0 = user, 1 = group, 3 = public (link),
|
||||
* 6 = federated (cloud share).
|
||||
* Pass either the number or the keyword.
|
||||
* @param string $xRequestId
|
||||
* @param string|null $shareWith The user or group id with which the file should
|
||||
* be shared.
|
||||
* @param boolean|null $publicUpload Whether to allow public upload to a public
|
||||
* shared folder.
|
||||
* @param string|null $sharePassword The password to protect the public link
|
||||
* share with.
|
||||
* @param string|int|string[]|int[]|null $permissions The permissions to set on the share.
|
||||
* 1 = read; 2 = update; 4 = create;
|
||||
* 8 = delete; 16 = share
|
||||
* (default: 31, for public shares: 1)
|
||||
* Pass either the (total) number or array of numbers,
|
||||
* or any of the above keywords or array of keywords.
|
||||
* @param string|null $linkName A (human-readable) name for the share,
|
||||
* which can be up to 64 characters in length.
|
||||
* @param string|null $expireDate An expire date for public link shares.
|
||||
* This argument expects a date string
|
||||
* in the format 'YYYY-MM-DD'.
|
||||
* @param int $ocsApiVersion
|
||||
* @param int $sharingApiVersion
|
||||
* @param string $sharingApp
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public static function createShare(
|
||||
string $baseUrl,
|
||||
string $user,
|
||||
string $password,
|
||||
string $path,
|
||||
$shareType,
|
||||
string $xRequestId = '',
|
||||
?string $shareWith = null,
|
||||
?bool $publicUpload = false,
|
||||
string $sharePassword = null,
|
||||
$permissions = null,
|
||||
?string $linkName = null,
|
||||
?string $expireDate = null,
|
||||
int $ocsApiVersion = 1,
|
||||
int $sharingApiVersion = 1,
|
||||
string $sharingApp = 'files_sharing'
|
||||
): ResponseInterface {
|
||||
$fd = [];
|
||||
foreach ([$path, $baseUrl, $user, $password] as $variableToCheck) {
|
||||
if (!\is_string($variableToCheck)) {
|
||||
throw new InvalidArgumentException(
|
||||
"mandatory argument missing or wrong type ($variableToCheck => "
|
||||
. \gettype($variableToCheck) . ")"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if ($permissions !== null) {
|
||||
$fd['permissions'] = self::getPermissionSum($permissions);
|
||||
}
|
||||
|
||||
if (!\in_array($ocsApiVersion, [1, 2], true)) {
|
||||
throw new InvalidArgumentException(
|
||||
"invalid ocsApiVersion ($ocsApiVersion)"
|
||||
);
|
||||
}
|
||||
if (!\in_array($sharingApiVersion, [1, 2], true)) {
|
||||
throw new InvalidArgumentException(
|
||||
"invalid sharingApiVersion ($sharingApiVersion)"
|
||||
);
|
||||
}
|
||||
|
||||
$fullUrl = $baseUrl;
|
||||
if (\substr($fullUrl, -1) !== '/') {
|
||||
$fullUrl .= '/';
|
||||
}
|
||||
$fullUrl .= "ocs/v{$ocsApiVersion}.php/apps/{$sharingApp}/api/v{$sharingApiVersion}/shares";
|
||||
|
||||
$fd['path'] = $path;
|
||||
$fd['shareType'] = self::getShareType($shareType);
|
||||
|
||||
if ($shareWith !== null) {
|
||||
$fd['shareWith'] = $shareWith;
|
||||
}
|
||||
if ($publicUpload !== null) {
|
||||
$fd['publicUpload'] = (bool) $publicUpload;
|
||||
}
|
||||
if ($sharePassword !== null) {
|
||||
$fd['password'] = $sharePassword;
|
||||
}
|
||||
if ($linkName !== null) {
|
||||
$fd['name'] = $linkName;
|
||||
}
|
||||
if ($expireDate !== null) {
|
||||
$fd['expireDate'] = $expireDate;
|
||||
}
|
||||
$headers = ['OCS-APIREQUEST' => 'true'];
|
||||
|
||||
return HttpRequestHelper::post(
|
||||
$fullUrl,
|
||||
$xRequestId,
|
||||
$user,
|
||||
$password,
|
||||
$headers,
|
||||
$fd
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* calculates the permission sum (int) from given permissions
|
||||
* permissions can be passed in as int, string or array of int or string
|
||||
* 'read' => 1
|
||||
* 'update' => 2
|
||||
* 'create' => 4
|
||||
* 'delete' => 8
|
||||
* 'share' => 16
|
||||
*
|
||||
* @param string[]|string|int|int[] $permissions
|
||||
*
|
||||
* @return int
|
||||
* @throws InvalidArgumentException
|
||||
*
|
||||
*/
|
||||
public static function getPermissionSum($permissions):int {
|
||||
if (\is_numeric($permissions)) {
|
||||
// Allow any permission number so that test scenarios can
|
||||
// specifically test invalid permission values
|
||||
return (int) $permissions;
|
||||
}
|
||||
if (!\is_array($permissions)) {
|
||||
$permissions = [$permissions];
|
||||
}
|
||||
$permissionSum = 0;
|
||||
foreach ($permissions as $permission) {
|
||||
if (\array_key_exists($permission, self::PERMISSION_TYPES)) {
|
||||
$permissionSum += self::PERMISSION_TYPES[$permission];
|
||||
} elseif (\in_array($permission, self::PERMISSION_TYPES, true)) {
|
||||
$permissionSum += (int) $permission;
|
||||
} else {
|
||||
throw new InvalidArgumentException(
|
||||
"invalid permission type ($permission)"
|
||||
);
|
||||
}
|
||||
}
|
||||
if ($permissionSum < 1 || $permissionSum > 31) {
|
||||
throw new InvalidArgumentException(
|
||||
"invalid permission total ($permissionSum)"
|
||||
);
|
||||
}
|
||||
return $permissionSum;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the share type number corresponding to the share type keyword
|
||||
*
|
||||
* @param string|int $shareType a keyword from SHARE_TYPES or a share type number
|
||||
*
|
||||
* @return int
|
||||
* @throws InvalidArgumentException
|
||||
*
|
||||
*/
|
||||
public static function getShareType($shareType):int {
|
||||
if (\array_key_exists($shareType, self::SHARE_TYPES)) {
|
||||
return self::SHARE_TYPES[$shareType];
|
||||
} else {
|
||||
if (\ctype_digit($shareType)) {
|
||||
$shareType = (int) $shareType;
|
||||
}
|
||||
$key = \array_search($shareType, self::SHARE_TYPES, true);
|
||||
if ($key !== false) {
|
||||
return self::SHARE_TYPES[$key];
|
||||
}
|
||||
throw new InvalidArgumentException(
|
||||
"invalid share type ($shareType)"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param SimpleXMLElement $responseXmlObject
|
||||
* @param string $errorMessage
|
||||
*
|
||||
* @return string
|
||||
* @throws Exception
|
||||
*
|
||||
*/
|
||||
public static function getLastShareIdFromResponse(
|
||||
SimpleXMLElement $responseXmlObject,
|
||||
string $errorMessage = "cannot find share id in response"
|
||||
):string {
|
||||
$xmlPart = $responseXmlObject->xpath("//data/element[last()]/id");
|
||||
|
||||
if (!\is_array($xmlPart) || (\count($xmlPart) === 0)) {
|
||||
throw new Exception($errorMessage);
|
||||
}
|
||||
return $xmlPart[0]->__toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
/**
|
||||
* @author Sagar Gurung <sagar@jankatitech.com>
|
||||
*
|
||||
*/
|
||||
namespace TestHelpers;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* Class SpaceNotFoundException
|
||||
* Exception when space id for a user is not found
|
||||
*/
|
||||
class SpaceNotFoundException extends Exception {
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* ownCloud
|
||||
*
|
||||
* @author Talank Baral <talank@jankaritech.com>
|
||||
* @copyright Copyright (c) 2021 Talank Baral talank@jankaritech.com
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License,
|
||||
* as published by the Free Software Foundation;
|
||||
* either version 3 of the License, or any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
*/
|
||||
|
||||
namespace TestHelpers;
|
||||
|
||||
/**
|
||||
* Class TranslationHelper
|
||||
*
|
||||
* Helper functions that are needed to run tests on different languages
|
||||
*
|
||||
* @package TestHelpers
|
||||
*/
|
||||
class TranslationHelper {
|
||||
/**
|
||||
* @param string|null $language
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public static function getLanguage(?string $language): ?string {
|
||||
if (!isset($language)) {
|
||||
if (\getenv('OC_LANGUAGE') !== false) {
|
||||
$language = \getenv('OC_LANGUAGE');
|
||||
}
|
||||
}
|
||||
return $language;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,318 @@
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* ownCloud
|
||||
*
|
||||
* @author Artur Neumann <artur@jankaritech.com>
|
||||
* @copyright Copyright (c) 2017 Artur Neumann artur@jankaritech.com
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License,
|
||||
* as published by the Free Software Foundation;
|
||||
* either version 3 of the License, or any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
*/
|
||||
namespace TestHelpers;
|
||||
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
/**
|
||||
* Helper for Uploads
|
||||
*
|
||||
* @author Artur Neumann <artur@jankaritech.com>
|
||||
*
|
||||
*/
|
||||
class UploadHelper extends \PHPUnit\Framework\Assert {
|
||||
/**
|
||||
*
|
||||
* @param string|null $baseUrl URL of owncloud
|
||||
* e.g. http://localhost:8080
|
||||
* should include the subfolder
|
||||
* if owncloud runs in a subfolder
|
||||
* e.g. http://localhost:8080/owncloud-core
|
||||
* @param string|null $user
|
||||
* @param string|null $password
|
||||
* @param string|null $source
|
||||
* @param string|null $destination
|
||||
* @param string|null $xRequestId
|
||||
* @param array|null $headers
|
||||
* @param int|null $davPathVersionToUse (1|2)
|
||||
* @param int|null $chunkingVersion (1|2|null)
|
||||
* if set to null chunking will not be used
|
||||
* @param int|null $noOfChunks how many chunks do we want to upload
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public static function upload(
|
||||
?string $baseUrl,
|
||||
?string $user,
|
||||
?string $password,
|
||||
?string $source,
|
||||
?string $destination,
|
||||
?string $xRequestId = '',
|
||||
?array $headers = [],
|
||||
?int $davPathVersionToUse = 1,
|
||||
?int $chunkingVersion = null,
|
||||
?int $noOfChunks = 1
|
||||
): ResponseInterface {
|
||||
//simple upload with no chunking
|
||||
if ($chunkingVersion === null) {
|
||||
$data = \file_get_contents($source);
|
||||
return WebDavHelper::makeDavRequest(
|
||||
$baseUrl,
|
||||
$user,
|
||||
$password,
|
||||
"PUT",
|
||||
$destination,
|
||||
$headers,
|
||||
$xRequestId,
|
||||
$data,
|
||||
$davPathVersionToUse
|
||||
);
|
||||
} else {
|
||||
//prepare chunking
|
||||
$chunks = self::chunkFile($source, $noOfChunks);
|
||||
$chunkingId = 'chunking-' . (string)\rand(1000, 9999);
|
||||
$v2ChunksDestination = '/uploads/' . $user . '/' . $chunkingId;
|
||||
}
|
||||
|
||||
//prepare chunking version specific stuff
|
||||
if ($chunkingVersion === 1) {
|
||||
$headers['OC-Chunked'] = '1';
|
||||
} elseif ($chunkingVersion === 2) {
|
||||
$result = WebDavHelper::makeDavRequest(
|
||||
$baseUrl,
|
||||
$user,
|
||||
$password,
|
||||
'MKCOL',
|
||||
$v2ChunksDestination,
|
||||
$headers,
|
||||
$xRequestId,
|
||||
null,
|
||||
$davPathVersionToUse,
|
||||
"uploads"
|
||||
);
|
||||
if ($result->getStatusCode() >= 400) {
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
//upload chunks
|
||||
foreach ($chunks as $index => $chunk) {
|
||||
if ($chunkingVersion === 1) {
|
||||
$filename = $destination . "-" . $chunkingId . "-" .
|
||||
\count($chunks) . '-' . ( string ) $index;
|
||||
$davRequestType = "files";
|
||||
} elseif ($chunkingVersion === 2) {
|
||||
$filename = $v2ChunksDestination . '/' . (string)($index);
|
||||
$davRequestType = "uploads";
|
||||
}
|
||||
$result = WebDavHelper::makeDavRequest(
|
||||
$baseUrl,
|
||||
$user,
|
||||
$password,
|
||||
"PUT",
|
||||
$filename,
|
||||
$headers,
|
||||
$xRequestId,
|
||||
$chunk,
|
||||
$davPathVersionToUse,
|
||||
$davRequestType
|
||||
);
|
||||
if ($result->getStatusCode() >= 400) {
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
//finish upload for new chunking
|
||||
if ($chunkingVersion === 2) {
|
||||
$source = $v2ChunksDestination . '/.file';
|
||||
$headers['Destination'] = $baseUrl . "/" .
|
||||
WebDavHelper::getDavPath($user, $davPathVersionToUse) .
|
||||
$destination;
|
||||
$result = WebDavHelper::makeDavRequest(
|
||||
$baseUrl,
|
||||
$user,
|
||||
$password,
|
||||
'MOVE',
|
||||
$source,
|
||||
$headers,
|
||||
$xRequestId,
|
||||
null,
|
||||
$davPathVersionToUse,
|
||||
"uploads"
|
||||
);
|
||||
if ($result->getStatusCode() >= 400) {
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Upload the same file multiple times with different mechanisms.
|
||||
*
|
||||
* @param string|null $baseUrl URL of owncloud
|
||||
* @param string|null $user user who uploads
|
||||
* @param string|null $password
|
||||
* @param string|null $source source file path
|
||||
* @param string|null $destination destination path on the server
|
||||
* @param string|null $xRequestId
|
||||
* @param bool $overwriteMode when false creates separate files to test uploading brand new files,
|
||||
* when true it just overwrites the same file over and over again with the same name
|
||||
* @param string|null $exceptChunkingType empty string or "old" or "new"
|
||||
*
|
||||
* @return array of ResponseInterface
|
||||
*/
|
||||
public static function uploadWithAllMechanisms(
|
||||
?string $baseUrl,
|
||||
?string $user,
|
||||
?string $password,
|
||||
?string $source,
|
||||
?string $destination,
|
||||
?string $xRequestId = '',
|
||||
?bool $overwriteMode = false,
|
||||
?string $exceptChunkingType = ''
|
||||
):array {
|
||||
$responses = [];
|
||||
foreach ([1, 2] as $davPathVersion) {
|
||||
if ($davPathVersion === 1) {
|
||||
$davHuman = 'old';
|
||||
} else {
|
||||
$davHuman = 'new';
|
||||
}
|
||||
|
||||
switch ($exceptChunkingType) {
|
||||
case 'old':
|
||||
$exceptChunkingVersion = 1;
|
||||
break;
|
||||
case 'new':
|
||||
$exceptChunkingVersion = 2;
|
||||
break;
|
||||
default:
|
||||
$exceptChunkingVersion = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
foreach ([null, 1, 2] as $chunkingVersion) {
|
||||
if ($chunkingVersion === $exceptChunkingVersion) {
|
||||
continue;
|
||||
}
|
||||
$valid = WebDavHelper::isValidDavChunkingCombination(
|
||||
$davPathVersion,
|
||||
$chunkingVersion
|
||||
);
|
||||
if ($valid === false) {
|
||||
continue;
|
||||
}
|
||||
$finalDestination = $destination;
|
||||
if (!$overwriteMode && $chunkingVersion !== null) {
|
||||
$finalDestination .= "-{$davHuman}dav-{$davHuman}chunking";
|
||||
} elseif (!$overwriteMode && $chunkingVersion === null) {
|
||||
$finalDestination .= "-{$davHuman}dav-regular";
|
||||
}
|
||||
$responses[] = self::upload(
|
||||
$baseUrl,
|
||||
$user,
|
||||
$password,
|
||||
$source,
|
||||
$finalDestination,
|
||||
$xRequestId,
|
||||
[],
|
||||
$davPathVersion,
|
||||
$chunkingVersion,
|
||||
2
|
||||
);
|
||||
}
|
||||
}
|
||||
return $responses;
|
||||
}
|
||||
|
||||
/**
|
||||
* cut the file in multiple chunks
|
||||
* returns an array of chunks with the content of the file
|
||||
*
|
||||
* @param string|null $file
|
||||
* @param int|null $noOfChunks
|
||||
*
|
||||
* @return array $string
|
||||
*/
|
||||
public static function chunkFile(?string $file, ?int $noOfChunks = 1):array {
|
||||
$size = \filesize($file);
|
||||
$chunkSize = \ceil($size / $noOfChunks);
|
||||
$chunks = [];
|
||||
$fp = \fopen($file, 'r');
|
||||
while (!\feof($fp) && \ftell($fp) < $size) {
|
||||
$chunks[] = \fread($fp, (int)$chunkSize);
|
||||
}
|
||||
\fclose($fp);
|
||||
if (\count($chunks) === 0) {
|
||||
// chunk an empty file
|
||||
$chunks[] = '';
|
||||
}
|
||||
return $chunks;
|
||||
}
|
||||
|
||||
/**
|
||||
* creates a File with a specific size
|
||||
*
|
||||
* @param string|null $name full path of the file to create
|
||||
* @param int|null $size
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function createFileSpecificSize(?string $name, ?int $size):void {
|
||||
if (\file_exists($name)) {
|
||||
\unlink($name);
|
||||
}
|
||||
$file = \fopen($name, 'w');
|
||||
\fseek($file, \max($size - 1, 0), SEEK_CUR);
|
||||
if ($size) {
|
||||
\fwrite($file, 'a'); // write a dummy char at SIZE position
|
||||
}
|
||||
\fclose($file);
|
||||
self::assertEquals(
|
||||
1,
|
||||
\file_exists($name)
|
||||
);
|
||||
self::assertEquals(
|
||||
$size,
|
||||
\filesize($name)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* creates a File with a specific text content
|
||||
*
|
||||
* @param string|null $name full path of the file to create
|
||||
* @param string|null $text
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function createFileWithText(?string $name, ?string $text):void {
|
||||
$file = \fopen($name, 'w');
|
||||
\fwrite($file, $text);
|
||||
\fclose($file);
|
||||
self::assertEquals(
|
||||
1,
|
||||
\file_exists($name)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* get the path of a file from FilesForUpload directory
|
||||
*
|
||||
* @param string|null $name name of the file to upload
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getUploadFilesDir(?string $name):string {
|
||||
return \getenv("FILES_FOR_UPLOAD") . $name;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,375 @@
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* ownCloud
|
||||
*
|
||||
* @author Artur Neumann <artur@jankaritech.com>
|
||||
* @copyright Copyright (c) 2017 Artur Neumann artur@jankaritech.com
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License,
|
||||
* as published by the Free Software Foundation;
|
||||
* either version 3 of the License, or any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
*/
|
||||
namespace TestHelpers;
|
||||
|
||||
use Exception;
|
||||
use GuzzleHttp\Exception\ClientException;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
/**
|
||||
* Helper to administrate users (and groups) through the provisioning API
|
||||
*
|
||||
* @author Artur Neumann <artur@jankaritech.com>
|
||||
*
|
||||
*/
|
||||
class UserHelper {
|
||||
/**
|
||||
*
|
||||
* @param string|null $baseUrl
|
||||
* @param string $user
|
||||
* @param string $key
|
||||
* @param string $value
|
||||
* @param string $adminUser
|
||||
* @param string $adminPassword
|
||||
* @param string $xRequestId
|
||||
* @param int|null $ocsApiVersion
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public static function editUser(
|
||||
?string $baseUrl,
|
||||
string $user,
|
||||
string $key,
|
||||
string $value,
|
||||
string $adminUser,
|
||||
string $adminPassword,
|
||||
string $xRequestId = '',
|
||||
?int $ocsApiVersion = 2
|
||||
):ResponseInterface {
|
||||
return OcsApiHelper::sendRequest(
|
||||
$baseUrl,
|
||||
$adminUser,
|
||||
$adminPassword,
|
||||
"PUT",
|
||||
"/cloud/users/" . $user,
|
||||
$xRequestId,
|
||||
["key" => $key, "value" => $value],
|
||||
$ocsApiVersion
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send batch requests to edit the user.
|
||||
* This will send multiple requests in parallel to the server which will be faster in comparison to waiting for each request to complete.
|
||||
*
|
||||
* @param string|null $baseUrl
|
||||
* @param array|null $editData ['user' => '', 'key' => '', 'value' => '']
|
||||
* @param string|null $adminUser
|
||||
* @param string|null $adminPassword
|
||||
* @param string|null $xRequestId
|
||||
* @param int|null $ocsApiVersion
|
||||
*
|
||||
* @return array
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function editUserBatch(
|
||||
?string $baseUrl,
|
||||
?array $editData,
|
||||
?string $adminUser,
|
||||
?string $adminPassword,
|
||||
?string $xRequestId = '',
|
||||
?int $ocsApiVersion = 2
|
||||
):array {
|
||||
$requests = [];
|
||||
$client = HttpRequestHelper::createClient(
|
||||
$adminUser,
|
||||
$adminPassword
|
||||
);
|
||||
|
||||
foreach ($editData as $data) {
|
||||
$path = "/cloud/users/" . $data['user'];
|
||||
$body = ["key" => $data['key'], 'value' => $data["value"]];
|
||||
// Create the OCS API requests and push them to an array.
|
||||
\array_push(
|
||||
$requests,
|
||||
OcsApiHelper::createOcsRequest(
|
||||
$baseUrl,
|
||||
'PUT',
|
||||
$path,
|
||||
$xRequestId,
|
||||
$body
|
||||
)
|
||||
);
|
||||
}
|
||||
// Send the array of requests at once in parallel.
|
||||
$results = HttpRequestHelper::sendBatchRequest($requests, $client);
|
||||
|
||||
foreach ($results as $e) {
|
||||
if ($e instanceof ClientException) {
|
||||
$httpStatusCode = $e->getResponse()->getStatusCode();
|
||||
$reasonPhrase = $e->getResponse()->getReasonPhrase();
|
||||
throw new Exception(
|
||||
"Unexpected failure when editing a user: HTTP status $httpStatusCode HTTP reason $reasonPhrase"
|
||||
);
|
||||
}
|
||||
}
|
||||
return $results;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string|null $baseUrl
|
||||
* @param string|null $userName
|
||||
* @param string|null $adminUser
|
||||
* @param string|null $adminPassword
|
||||
* @param string|null $xRequestId
|
||||
* @param int|null $ocsApiVersion
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public static function getUser(
|
||||
?string $baseUrl,
|
||||
?string $userName,
|
||||
?string $adminUser,
|
||||
?string $adminPassword,
|
||||
?string $xRequestId = '',
|
||||
?int $ocsApiVersion = 2
|
||||
):ResponseInterface {
|
||||
return OcsApiHelper::sendRequest(
|
||||
$baseUrl,
|
||||
$adminUser,
|
||||
$adminPassword,
|
||||
"GET",
|
||||
"/cloud/users/" . $userName,
|
||||
$xRequestId,
|
||||
[],
|
||||
$ocsApiVersion
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string|null $baseUrl
|
||||
* @param string|null $userName
|
||||
* @param string|null $adminUser
|
||||
* @param string|null $adminPassword
|
||||
* @param string|null $xRequestId
|
||||
* @param int|null $ocsApiVersion
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public static function deleteUser(
|
||||
?string $baseUrl,
|
||||
?string $userName,
|
||||
?string $adminUser,
|
||||
?string $adminPassword,
|
||||
?string $xRequestId = '',
|
||||
?int $ocsApiVersion = 2
|
||||
):ResponseInterface {
|
||||
return OcsApiHelper::sendRequest(
|
||||
$baseUrl,
|
||||
$adminUser,
|
||||
$adminPassword,
|
||||
"DELETE",
|
||||
"/cloud/users/" . $userName,
|
||||
$xRequestId,
|
||||
[],
|
||||
$ocsApiVersion
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string|null $baseUrl
|
||||
* @param string|null $group
|
||||
* @param string|null $adminUser
|
||||
* @param string|null $adminPassword
|
||||
* @param string|null $xRequestId
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public static function createGroup(
|
||||
?string $baseUrl,
|
||||
?string $group,
|
||||
?string $adminUser,
|
||||
?string $adminPassword,
|
||||
?string $xRequestId = ''
|
||||
):ResponseInterface {
|
||||
return OcsApiHelper::sendRequest(
|
||||
$baseUrl,
|
||||
$adminUser,
|
||||
$adminPassword,
|
||||
"POST",
|
||||
"/cloud/groups",
|
||||
$xRequestId,
|
||||
['groupid' => $group]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string|null $baseUrl
|
||||
* @param string|null $group
|
||||
* @param string|null $adminUser
|
||||
* @param string|null $adminPassword
|
||||
* @param string|null $xRequestId
|
||||
* @param int|null $ocsApiVersion
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public static function deleteGroup(
|
||||
?string $baseUrl,
|
||||
?string $group,
|
||||
?string $adminUser,
|
||||
?string $adminPassword,
|
||||
?string $xRequestId = '',
|
||||
?int $ocsApiVersion = 2
|
||||
):ResponseInterface {
|
||||
$group = \rawurlencode($group);
|
||||
return OcsApiHelper::sendRequest(
|
||||
$baseUrl,
|
||||
$adminUser,
|
||||
$adminPassword,
|
||||
"DELETE",
|
||||
"/cloud/groups/" . $group,
|
||||
$xRequestId,
|
||||
[],
|
||||
$ocsApiVersion
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string|null $baseUrl
|
||||
* @param string|null $user
|
||||
* @param string|null $group
|
||||
* @param string|null $adminUser
|
||||
* @param string|null $adminPassword
|
||||
* @param string|null $xRequestId
|
||||
* @param int|null $ocsApiVersion (1|2)
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public static function addUserToGroup(
|
||||
?string $baseUrl,
|
||||
?string $user,
|
||||
?string $group,
|
||||
?string $adminUser,
|
||||
?string $adminPassword,
|
||||
?string $xRequestId = '',
|
||||
?int $ocsApiVersion = 2
|
||||
):ResponseInterface {
|
||||
return OcsApiHelper::sendRequest(
|
||||
$baseUrl,
|
||||
$adminUser,
|
||||
$adminPassword,
|
||||
"POST",
|
||||
"/cloud/users/" . $user . "/groups",
|
||||
$xRequestId,
|
||||
['groupid' => $group],
|
||||
$ocsApiVersion
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string|null $baseUrl
|
||||
* @param string|null $user
|
||||
* @param string|null $group
|
||||
* @param string|null $adminUser
|
||||
* @param string|null $adminPassword
|
||||
* @param string|null $xRequestId
|
||||
* @param int|null $ocsApiVersion (1|2)
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public static function removeUserFromGroup(
|
||||
?string $baseUrl,
|
||||
?string $user,
|
||||
?string $group,
|
||||
?string $adminUser,
|
||||
?string $adminPassword,
|
||||
?string $xRequestId,
|
||||
?int $ocsApiVersion = 2
|
||||
):ResponseInterface {
|
||||
return OcsApiHelper::sendRequest(
|
||||
$baseUrl,
|
||||
$adminUser,
|
||||
$adminPassword,
|
||||
"DELETE",
|
||||
"/cloud/users/" . $user . "/groups",
|
||||
$xRequestId,
|
||||
['groupid' => $group],
|
||||
$ocsApiVersion
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string|null $baseUrl
|
||||
* @param string|null $adminUser
|
||||
* @param string|null $adminPassword
|
||||
* @param string|null $xRequestId
|
||||
* @param string|null $search
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public static function getGroups(
|
||||
?string $baseUrl,
|
||||
?string $adminUser,
|
||||
?string $adminPassword,
|
||||
?string $xRequestId = '',
|
||||
?string $search =""
|
||||
):ResponseInterface {
|
||||
return OcsApiHelper::sendRequest(
|
||||
$baseUrl,
|
||||
$adminUser,
|
||||
$adminPassword,
|
||||
"GET",
|
||||
"/cloud/groups?search=" . $search,
|
||||
$xRequestId
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string|null $baseUrl
|
||||
* @param string|null $adminUser
|
||||
* @param string|null $adminPassword
|
||||
* @param string|null $xRequestId
|
||||
* @param string|null $search
|
||||
*
|
||||
* @return string[]
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function getGroupsAsArray(
|
||||
?string $baseUrl,
|
||||
?string $adminUser,
|
||||
?string $adminPassword,
|
||||
?string $xRequestId = '',
|
||||
?string $search = ""
|
||||
):array {
|
||||
$result = self::getGroups(
|
||||
$baseUrl,
|
||||
$adminUser,
|
||||
$adminPassword,
|
||||
$xRequestId,
|
||||
$search
|
||||
);
|
||||
$groups = HttpRequestHelper::getResponseXml($result, __METHOD__)->xpath(".//groups")[0];
|
||||
$return = [];
|
||||
foreach ($groups as $group) {
|
||||
$return[] = $group->__toString();
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,898 @@
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* ownCloud
|
||||
*
|
||||
* @author Artur Neumann <artur@jankaritech.com>
|
||||
* @copyright Copyright (c) 2017 Artur Neumann artur@jankaritech.com
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License,
|
||||
* as published by the Free Software Foundation;
|
||||
* either version 3 of the License, or any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
*/
|
||||
namespace TestHelpers;
|
||||
|
||||
use Exception;
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
use InvalidArgumentException;
|
||||
use PHPUnit\Framework\Assert;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Psr\Http\Message\StreamInterface;
|
||||
use DateTime;
|
||||
use TestHelpers\SpaceNotFoundException;
|
||||
|
||||
/**
|
||||
* Helper to make WebDav Requests
|
||||
*
|
||||
* @author Artur Neumann <artur@jankaritech.com>
|
||||
*
|
||||
*/
|
||||
class WebDavHelper {
|
||||
public const DAV_VERSION_OLD = 1;
|
||||
public const DAV_VERSION_NEW = 2;
|
||||
public const DAV_VERSION_SPACES = 3;
|
||||
public static $SPACE_ID_FROM_OCIS = '';
|
||||
|
||||
/**
|
||||
* @var array of users with their different spaces ids
|
||||
*/
|
||||
public static $spacesIdRef = [];
|
||||
|
||||
/**
|
||||
* clear space id reference for user
|
||||
*
|
||||
* @param string|null $user
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function removeSpaceIdReferenceForUser(
|
||||
?string $user
|
||||
):void {
|
||||
if (\array_key_exists($user, self::$spacesIdRef)) {
|
||||
unset(self::$spacesIdRef[$user]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the id of a file
|
||||
*
|
||||
* @param string|null $baseUrl
|
||||
* @param string|null $user
|
||||
* @param string|null $password
|
||||
* @param string|null $path
|
||||
* @param string|null $xRequestId
|
||||
* @param int|null $davPathVersionToUse
|
||||
*
|
||||
* @return string
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function getFileIdForPath(
|
||||
?string $baseUrl,
|
||||
?string $user,
|
||||
?string $password,
|
||||
?string $path,
|
||||
?string $xRequestId = '',
|
||||
?int $davPathVersionToUse = self::DAV_VERSION_NEW
|
||||
): string {
|
||||
$body
|
||||
= '<?xml version="1.0"?>
|
||||
<d:propfind xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns">
|
||||
<d:prop>
|
||||
<oc:fileid />
|
||||
</d:prop>
|
||||
</d:propfind>';
|
||||
$response = self::makeDavRequest(
|
||||
$baseUrl,
|
||||
$user,
|
||||
$password,
|
||||
"PROPFIND",
|
||||
$path,
|
||||
null,
|
||||
$xRequestId,
|
||||
$body,
|
||||
$davPathVersionToUse
|
||||
);
|
||||
\preg_match(
|
||||
'/\<oc:fileid\>([^\<]*)\<\/oc:fileid\>/',
|
||||
$response->getBody()->getContents(),
|
||||
$matches
|
||||
);
|
||||
|
||||
if (!isset($matches[1])) {
|
||||
throw new Exception("could not find fileId of $path");
|
||||
}
|
||||
|
||||
return $matches[1];
|
||||
}
|
||||
|
||||
/**
|
||||
* returns body for propfind
|
||||
*
|
||||
* @param array|null $properties
|
||||
*
|
||||
* @return string
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function getBodyForPropfind(?array $properties): string {
|
||||
$propertyBody = "";
|
||||
$extraNamespaces = "";
|
||||
foreach ($properties as $namespaceString => $property) {
|
||||
if (\is_int($namespaceString)) {
|
||||
//default namespace prefix if the property has no array key
|
||||
//also used if no prefix is given in the property value
|
||||
$namespacePrefix = "d";
|
||||
} else {
|
||||
//calculate the namespace prefix and namespace from the array key
|
||||
$matches = [];
|
||||
\preg_match("/^(.*)='(.*)'$/", $namespaceString, $matches);
|
||||
$nameSpace = $matches[2];
|
||||
$namespacePrefix = $matches[1];
|
||||
$extraNamespaces .= " xmlns:$namespacePrefix=\"$nameSpace\" ";
|
||||
}
|
||||
//if a namespace prefix is given in the property value use that
|
||||
if (\strpos($property, ":") !== false) {
|
||||
$propertyParts = \explode(":", $property);
|
||||
$namespacePrefix = $propertyParts[0];
|
||||
$property = $propertyParts[1];
|
||||
}
|
||||
$propertyBody .= "<$namespacePrefix:$property/>";
|
||||
}
|
||||
$body = "<?xml version=\"1.0\"?>
|
||||
<d:propfind
|
||||
xmlns:d=\"DAV:\"
|
||||
xmlns:oc=\"http://owncloud.org/ns\"
|
||||
xmlns:ocs=\"http://open-collaboration-services.org/ns\"
|
||||
$extraNamespaces>
|
||||
<d:prop>$propertyBody</d:prop>
|
||||
</d:propfind>";
|
||||
return $body;
|
||||
}
|
||||
|
||||
/**
|
||||
* sends a PROPFIND request
|
||||
* with these registered namespaces:
|
||||
* | prefix | namespace |
|
||||
* | d | DAV: |
|
||||
* | oc | http://owncloud.org/ns |
|
||||
* | ocs | http://open-collaboration-services.org/ns |
|
||||
*
|
||||
* @param string|null $baseUrl
|
||||
* @param string|null $user
|
||||
* @param string|null $password
|
||||
* @param string|null $path
|
||||
* @param string[] $properties
|
||||
* string can contain namespace prefix,
|
||||
* if no prefix is given 'd:' is used as prefix
|
||||
* if associated array is used then the key will be used as namespace
|
||||
* @param string|null $xRequestId
|
||||
* @param string|null $folderDepth
|
||||
* @param string|null $type
|
||||
* @param int|null $davPathVersionToUse
|
||||
* @param string|null $doDavRequestAsUser
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public static function propfind(
|
||||
?string $baseUrl,
|
||||
?string $user,
|
||||
?string $password,
|
||||
?string $path,
|
||||
?array $properties,
|
||||
?string $xRequestId = '',
|
||||
?string $folderDepth = '0',
|
||||
?string $type = "files",
|
||||
?int $davPathVersionToUse = self::DAV_VERSION_NEW,
|
||||
?string $doDavRequestAsUser = null
|
||||
):ResponseInterface {
|
||||
$body = self::getBodyForPropfind($properties);
|
||||
$folderDepth = (string) $folderDepth;
|
||||
if ($folderDepth !== '0' && $folderDepth !== '1' && $folderDepth !== 'infinity') {
|
||||
throw new InvalidArgumentException('Invalid depth value ' . $folderDepth);
|
||||
}
|
||||
$headers = ['Depth' => $folderDepth];
|
||||
return self::makeDavRequest(
|
||||
$baseUrl,
|
||||
$user,
|
||||
$password,
|
||||
"PROPFIND",
|
||||
$path,
|
||||
$headers,
|
||||
$xRequestId,
|
||||
$body,
|
||||
$davPathVersionToUse,
|
||||
$type,
|
||||
null,
|
||||
null,
|
||||
false,
|
||||
null,
|
||||
null,
|
||||
[],
|
||||
$doDavRequestAsUser
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string|null $baseUrl
|
||||
* @param string|null $user
|
||||
* @param string|null $password
|
||||
* @param string|null $path
|
||||
* @param string|null $propertyName
|
||||
* @param string|null $propertyValue
|
||||
* @param string|null $xRequestId
|
||||
* @param string|null $namespaceString string containing prefix and namespace
|
||||
* e.g "x1='http://whatever.org/ns'"
|
||||
* @param int|null $davPathVersionToUse
|
||||
* @param string|null $type
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public static function proppatch(
|
||||
?string $baseUrl,
|
||||
?string $user,
|
||||
?string $password,
|
||||
?string $path,
|
||||
?string $propertyName,
|
||||
?string $propertyValue,
|
||||
?string $xRequestId = '',
|
||||
?string $namespaceString = "oc='http://owncloud.org/ns'",
|
||||
?int $davPathVersionToUse = self::DAV_VERSION_NEW,
|
||||
?string $type="files"
|
||||
):ResponseInterface {
|
||||
$matches = [];
|
||||
\preg_match("/^(.*)='(.*)'$/", $namespaceString, $matches);
|
||||
$namespace = $matches[2];
|
||||
$namespacePrefix = $matches[1];
|
||||
$propertyBody = "<$namespacePrefix:$propertyName" .
|
||||
" xmlns:$namespacePrefix=\"$namespace\">" .
|
||||
"$propertyValue" .
|
||||
"</$namespacePrefix:$propertyName>";
|
||||
$body = "<?xml version=\"1.0\"?>
|
||||
<d:propertyupdate xmlns:d=\"DAV:\"
|
||||
xmlns:oc=\"http://owncloud.org/ns\">
|
||||
<d:set>
|
||||
<d:prop>$propertyBody</d:prop>
|
||||
</d:set>
|
||||
</d:propertyupdate>";
|
||||
return self::makeDavRequest(
|
||||
$baseUrl,
|
||||
$user,
|
||||
$password,
|
||||
"PROPPATCH",
|
||||
$path,
|
||||
[],
|
||||
$xRequestId,
|
||||
$body,
|
||||
$davPathVersionToUse,
|
||||
$type
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* gets namespace-prefix, namespace url and propName from provided namespaceString or property
|
||||
* or otherwise use default
|
||||
*
|
||||
* @param string|null $namespaceString
|
||||
* @param string|null $property
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getPropertyWithNamespaceInfo(?string $namespaceString = "", ?string $property = ""):array {
|
||||
$namespace = "";
|
||||
$namespacePrefix = "";
|
||||
if (\is_int($namespaceString)) {
|
||||
//default namespace prefix if the property has no array key
|
||||
//also used if no prefix is given in the property value
|
||||
$namespacePrefix = "d";
|
||||
$namespace = "DAV:";
|
||||
} elseif ($namespaceString) {
|
||||
//calculate the namespace prefix and namespace from the array key
|
||||
$matches = [];
|
||||
\preg_match("/^(.*)='(.*)'$/", $namespaceString, $matches);
|
||||
$namespacePrefix = $matches[1];
|
||||
$namespace = $matches[2];
|
||||
}
|
||||
//if a namespace prefix is given in the property value use that
|
||||
if ($property && \strpos($property, ":")) {
|
||||
$propertyParts = \explode(":", $property);
|
||||
$namespacePrefix = $propertyParts[0];
|
||||
$property = $propertyParts[1];
|
||||
}
|
||||
return [$namespacePrefix, $namespace, $property];
|
||||
}
|
||||
|
||||
/**
|
||||
* sends HTTP request PROPPATCH method with multiple properties
|
||||
*
|
||||
* @param string|null $baseUrl
|
||||
* @param string|null $user
|
||||
* @param string|null $password
|
||||
* @param string $path
|
||||
* @param array|null $propertiesArray
|
||||
* @param string|null $xRequestId
|
||||
* @param int|null $davPathVersion
|
||||
* @param string|null $namespaceString
|
||||
* @param string|null $type
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public static function proppatchWithMultipleProps(
|
||||
?string $baseUrl,
|
||||
?string $user,
|
||||
?string $password,
|
||||
string $path,
|
||||
?array $propertiesArray,
|
||||
?string $xRequestId = '',
|
||||
?int $davPathVersion = null,
|
||||
?string $namespaceString = "oc='http://owncloud.org/ns'",
|
||||
?string $type="files"
|
||||
):ResponseInterface {
|
||||
$propertyBody = "";
|
||||
foreach ($propertiesArray as $propertyArray) {
|
||||
$property = $propertyArray["propertyName"];
|
||||
$value = $propertyArray["propertyValue"];
|
||||
[$namespacePrefix, $namespace, $property] = self::getPropertyWithNamespaceInfo(
|
||||
$namespaceString,
|
||||
$property
|
||||
);
|
||||
$propertyBody .= "\n\t<$namespacePrefix:$property>" .
|
||||
"$value" .
|
||||
"</$namespacePrefix:$property>";
|
||||
}
|
||||
$body = "<?xml version=\"1.0\"?>
|
||||
<d:propertyupdate xmlns:d=\"DAV:\"
|
||||
xmlns:oc=\"http://owncloud.org/ns\">
|
||||
<d:set>
|
||||
<d:prop>$propertyBody
|
||||
</d:prop>
|
||||
</d:set>
|
||||
</d:propertyupdate>";
|
||||
return self::makeDavRequest(
|
||||
$baseUrl,
|
||||
$user,
|
||||
$password,
|
||||
"PROPPATCH",
|
||||
$path,
|
||||
[],
|
||||
$xRequestId,
|
||||
$body,
|
||||
$davPathVersion,
|
||||
$type
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the response to listing a folder (collection)
|
||||
*
|
||||
* @param string|null $baseUrl
|
||||
* @param string|null $user
|
||||
* @param string|null $password
|
||||
* @param string|null $path
|
||||
* @param string|null $folderDepth
|
||||
* @param string|null $xRequestId
|
||||
* @param string[] $properties
|
||||
* @param string|null $type
|
||||
* @param int|null $davPathVersionToUse
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public static function listFolder(
|
||||
?string $baseUrl,
|
||||
?string $user,
|
||||
?string $password,
|
||||
?string $path,
|
||||
?string $folderDepth,
|
||||
?string $xRequestId = '',
|
||||
?array $properties = null,
|
||||
?string $type = "files",
|
||||
?int $davPathVersionToUse = self::DAV_VERSION_NEW
|
||||
):ResponseInterface {
|
||||
if (!$properties) {
|
||||
$properties = [
|
||||
'getetag', 'resourcetype'
|
||||
];
|
||||
}
|
||||
return self::propfind(
|
||||
$baseUrl,
|
||||
$user,
|
||||
$password,
|
||||
$path,
|
||||
$properties,
|
||||
$xRequestId,
|
||||
$folderDepth,
|
||||
$type,
|
||||
$davPathVersionToUse
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates UUIDv4
|
||||
* Example: 123e4567-e89b-12d3-a456-426614174000
|
||||
*
|
||||
* @return string
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function generateUUIDv4():string {
|
||||
// generate 16 bytes (128 bits) of random data or use the data passed into the function.
|
||||
$data = random_bytes(16);
|
||||
\assert(\strlen($data) == 16);
|
||||
|
||||
$data[6] = \chr(\ord($data[6]) & 0x0f | 0x40); // set version to 0100
|
||||
$data[8] = \chr(\ord($data[8]) & 0x3f | 0x80); // set bits 6-7 to 10
|
||||
|
||||
return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4));
|
||||
}
|
||||
|
||||
/**
|
||||
* fetches personal space id for provided user
|
||||
*
|
||||
* @param string $baseUrl
|
||||
* @param string $user
|
||||
* @param string $password
|
||||
* @param string $xRequestId
|
||||
*
|
||||
* @return string
|
||||
* @throws GuzzleException
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function getPersonalSpaceIdForUser(string $baseUrl, string $user, string $password, string $xRequestId):string {
|
||||
if (\array_key_exists($user, self::$spacesIdRef) && \array_key_exists("personal", self::$spacesIdRef[$user])) {
|
||||
return self::$spacesIdRef[$user]["personal"];
|
||||
}
|
||||
$trimmedBaseUrl = \trim($baseUrl, "/");
|
||||
$drivesPath = '/graph/v1.0/me/drives';
|
||||
$fullUrl = $trimmedBaseUrl . $drivesPath;
|
||||
$response = HttpRequestHelper::get(
|
||||
$fullUrl,
|
||||
$xRequestId,
|
||||
$user,
|
||||
$password
|
||||
);
|
||||
$bodyContents = $response->getBody()->getContents();
|
||||
$json = \json_decode($bodyContents);
|
||||
$personalSpaceId = '';
|
||||
if ($json === null) {
|
||||
// the graph endpoint did not give a useful answer
|
||||
// try getting the information from the webdav endpoint
|
||||
$fullUrl = $trimmedBaseUrl . '/remote.php/webdav';
|
||||
$response = HttpRequestHelper::sendRequest(
|
||||
$fullUrl,
|
||||
$xRequestId,
|
||||
'PROPFIND',
|
||||
$user,
|
||||
$password
|
||||
);
|
||||
// we expect to get a multipart XML response with status 207
|
||||
$status = $response->getStatusCode();
|
||||
if ($status === 401) {
|
||||
throw new SpaceNotFoundException(__METHOD__ . " Personal space not found for user " . $user);
|
||||
} elseif ($status !== 207) {
|
||||
throw new Exception(
|
||||
__METHOD__ . " webdav propfind for user $user failed with status $status - so the personal space id cannot be discovered"
|
||||
);
|
||||
}
|
||||
$responseXmlObject = HttpRequestHelper::getResponseXml(
|
||||
$response,
|
||||
__METHOD__
|
||||
);
|
||||
$xmlPart = $responseXmlObject->xpath("/d:multistatus/d:response[1]/d:propstat/d:prop/oc:id");
|
||||
if ($xmlPart === false) {
|
||||
throw new Exception(
|
||||
__METHOD__ . " oc:id not found in webdav propfind for user $user - so the personal space id cannot be discovered"
|
||||
);
|
||||
}
|
||||
$ocIdRawString = $xmlPart[0]->__toString();
|
||||
$separator = "!";
|
||||
if (\strpos($ocIdRawString, $separator) !== false) {
|
||||
// The string is not base64-encoded, because the exclamation mark is not in the base64 alphabet.
|
||||
// We expect to have a string with 2 parts separated by the exclamation mark.
|
||||
// This is the format introduced in 2022-02
|
||||
// oc:id should be something like:
|
||||
// "7464caf6-1799-103c-9046-c7b74deb5f63!7464caf6-1799-103c-9046-c7b74deb5f63"
|
||||
// There is no encoding to decode.
|
||||
$decodedId = $ocIdRawString;
|
||||
} else {
|
||||
// fall-back to assuming that the oc:id is base64-encoded
|
||||
// That is the format used before and up to 2022-02
|
||||
// This can be removed after both the edge and master branches of cs3org/reva are using the new format.
|
||||
// oc:id should be some base64 encoded string like:
|
||||
// "NzQ2NGNhZjYtMTc5OS0xMDNjLTkwNDYtYzdiNzRkZWI1ZjYzOjc0NjRjYWY2LTE3OTktMTAzYy05MDQ2LWM3Yjc0ZGViNWY2Mw=="
|
||||
// That should decode to something like:
|
||||
// "7464caf6-1799-103c-9046-c7b74deb5f63:7464caf6-1799-103c-9046-c7b74deb5f63"
|
||||
$decodedId = base64_decode($ocIdRawString);
|
||||
$separator = ":";
|
||||
}
|
||||
$ocIdParts = \explode($separator, $decodedId);
|
||||
if (\count($ocIdParts) !== 2) {
|
||||
throw new Exception(
|
||||
__METHOD__ . " the oc:id $decodedId for user $user does not have 2 parts separated by '$separator', so the personal space id cannot be discovered"
|
||||
);
|
||||
}
|
||||
$personalSpaceId = $ocIdParts[0];
|
||||
} else {
|
||||
foreach ($json->value as $spaces) {
|
||||
if ($spaces->driveType === "personal") {
|
||||
$personalSpaceId = $spaces->id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($personalSpaceId) {
|
||||
// If env var LOG_PERSONAL_SPACE_ID is defined, then output the details of the personal space id.
|
||||
// This is a useful debugging tool to have confidence that the personal space id is found correctly.
|
||||
if (\getenv('LOG_PERSONAL_SPACE_ID') !== false) {
|
||||
echo __METHOD__ . " personal space id of user $user is $personalSpaceId\n";
|
||||
}
|
||||
self::$spacesIdRef[$user] = [];
|
||||
self::$spacesIdRef[$user]["personal"] = $personalSpaceId;
|
||||
return $personalSpaceId;
|
||||
} else {
|
||||
throw new SpaceNotFoundException(__METHOD__ . " Personal space not found for user " . $user);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* First checks if a user exist to return its space ID
|
||||
* In case of any exception, it returns a fake space ID
|
||||
*
|
||||
* @param string $baseUrl
|
||||
* @param string $user
|
||||
* @param string $password
|
||||
* @param string $xRequestId
|
||||
*
|
||||
* @return string
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function getPersonalSpaceIdForUserOrFakeIfNotFound(string $baseUrl, string $user, string $password, string $xRequestId):string {
|
||||
try {
|
||||
$spaceId = self::getPersonalSpaceIdForUser(
|
||||
$baseUrl,
|
||||
$user,
|
||||
$password,
|
||||
$xRequestId,
|
||||
);
|
||||
} catch (SpaceNotFoundException $e) {
|
||||
// if the fetch fails, and the user is not found, then a fake space id is prepared
|
||||
// this is useful for testing when the personal space is of a non-existing user
|
||||
$fakeSpaceId = self::generateUUIDv4();
|
||||
self::$spacesIdRef[$user]["personal"] = $fakeSpaceId;
|
||||
$spaceId = $fakeSpaceId;
|
||||
}
|
||||
return $spaceId;
|
||||
}
|
||||
|
||||
/**
|
||||
* sends a DAV request
|
||||
*
|
||||
* @param string|null $baseUrl
|
||||
* URL of owncloud e.g. http://localhost:8080
|
||||
* should include the subfolder if owncloud runs in a subfolder
|
||||
* e.g. http://localhost:8080/owncloud-core
|
||||
* @param string|null $user
|
||||
* @param string|null $password or token when bearer auth is used
|
||||
* @param string|null $method PUT, GET, DELETE, etc.
|
||||
* @param string|null $path
|
||||
* @param array|null $headers
|
||||
* @param string|null $xRequestId
|
||||
* @param string|null|resource|StreamInterface $body
|
||||
* @param int|null $davPathVersionToUse (1|2|3)
|
||||
* @param string|null $type of request
|
||||
* @param string|null $sourceIpAddress to initiate the request from
|
||||
* @param string|null $authType basic|bearer
|
||||
* @param bool $stream Set to true to stream a response rather
|
||||
* than download it all up-front.
|
||||
* @param int|null $timeout
|
||||
* @param Client|null $client
|
||||
* @param array|null $urlParameter to concatenate with path
|
||||
* @param string|null $doDavRequestAsUser run the DAV as this user, if null its same as $user
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws GuzzleException
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function makeDavRequest(
|
||||
?string $baseUrl,
|
||||
?string $user,
|
||||
?string $password,
|
||||
?string $method,
|
||||
?string $path,
|
||||
?array $headers,
|
||||
?string $xRequestId = '',
|
||||
$body = null,
|
||||
?int $davPathVersionToUse = self::DAV_VERSION_OLD,
|
||||
?string $type = "files",
|
||||
?string $sourceIpAddress = null,
|
||||
?string $authType = "basic",
|
||||
?bool $stream = false,
|
||||
?int $timeout = 0,
|
||||
?Client $client = null,
|
||||
?array $urlParameter = [],
|
||||
?string $doDavRequestAsUser = null
|
||||
):ResponseInterface {
|
||||
$baseUrl = self::sanitizeUrl($baseUrl, true);
|
||||
|
||||
// We need to manipulate and use path as a string.
|
||||
// So ensure that it is a string to avoid any type-conversion errors.
|
||||
if ($path === null) {
|
||||
$path = "";
|
||||
}
|
||||
|
||||
// get space id if testing with spaces dav
|
||||
if (self::$SPACE_ID_FROM_OCIS === '' && $davPathVersionToUse === self::DAV_VERSION_SPACES) {
|
||||
$spaceId = self::getPersonalSpaceIdForUserOrFakeIfNotFound(
|
||||
$baseUrl,
|
||||
$doDavRequestAsUser ?? $user,
|
||||
$password,
|
||||
$xRequestId
|
||||
);
|
||||
} else {
|
||||
$spaceId = self::$SPACE_ID_FROM_OCIS;
|
||||
}
|
||||
|
||||
$davPath = self::getDavPath($doDavRequestAsUser ?? $user, $davPathVersionToUse, $type, $spaceId);
|
||||
|
||||
//replace %, # and ? and in the path, Guzzle will not encode them
|
||||
$urlSpecialChar = [['%', '#', '?'], ['%25', '%23', '%3F']];
|
||||
$path = \str_replace($urlSpecialChar[0], $urlSpecialChar[1], $path);
|
||||
|
||||
if (!empty($urlParameter)) {
|
||||
$urlParameter = \http_build_query($urlParameter, '', '&');
|
||||
$path .= '?' . $urlParameter;
|
||||
}
|
||||
$fullUrl = self::sanitizeUrl($baseUrl . $davPath . $path);
|
||||
|
||||
if ($authType === 'bearer') {
|
||||
$headers['Authorization'] = 'Bearer ' . $password;
|
||||
$user = null;
|
||||
$password = null;
|
||||
}
|
||||
if ($type === "public-files-new") {
|
||||
if ($password === null || $password === "") {
|
||||
$user = null;
|
||||
} else {
|
||||
$user = "public";
|
||||
}
|
||||
}
|
||||
$config = null;
|
||||
if ($sourceIpAddress !== null) {
|
||||
$config = [ 'curl' => [ CURLOPT_INTERFACE => $sourceIpAddress ]];
|
||||
}
|
||||
|
||||
if ($headers !== null) {
|
||||
foreach ($headers as $key => $value) {
|
||||
//? and # need to be encoded in the Destination URL
|
||||
if ($key === "Destination") {
|
||||
$headers[$key] = \str_replace(
|
||||
$urlSpecialChar[0],
|
||||
$urlSpecialChar[1],
|
||||
$value
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Clear the space ID from ocis after each request
|
||||
self::$SPACE_ID_FROM_OCIS = '';
|
||||
return HttpRequestHelper::sendRequest(
|
||||
$fullUrl,
|
||||
$xRequestId,
|
||||
$method,
|
||||
$user,
|
||||
$password,
|
||||
$headers,
|
||||
$body,
|
||||
$config,
|
||||
null,
|
||||
$stream,
|
||||
$timeout,
|
||||
$client
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* get the dav path
|
||||
*
|
||||
* @param string|null $user
|
||||
* @param int|null $davPathVersionToUse (1|2)
|
||||
* @param string|null $type
|
||||
* @param string|null $spaceId
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getDavPath(
|
||||
?string $user,
|
||||
?int $davPathVersionToUse = null,
|
||||
?string $type = "files",
|
||||
?string $spaceId = null
|
||||
):string {
|
||||
$newTrashbinDavPath = "remote.php/dav/trash-bin/$user/";
|
||||
if ($type === "public-files" || $type === "public-files-old") {
|
||||
return "public.php/webdav/";
|
||||
}
|
||||
if ($type === "public-files-new") {
|
||||
return "remote.php/dav/public-files/$user/";
|
||||
}
|
||||
if ($type === "archive") {
|
||||
return "remote.php/dav/archive/$user/files";
|
||||
}
|
||||
if ($type === "customgroups") {
|
||||
return "remote.php/dav/";
|
||||
}
|
||||
if ($davPathVersionToUse === self::DAV_VERSION_SPACES) {
|
||||
if (($spaceId === null) || (\strlen($spaceId) === 0)) {
|
||||
throw new InvalidArgumentException(
|
||||
__METHOD__ . " A spaceId must be passed when using DAV path version 3 (spaces)"
|
||||
);
|
||||
}
|
||||
if ($type === "trash-bin") {
|
||||
return "/remote.php/dav/spaces/trash-bin/" . $spaceId . '/';
|
||||
}
|
||||
return "dav/spaces/" . $spaceId . '/';
|
||||
} else {
|
||||
if ($davPathVersionToUse === self::DAV_VERSION_OLD) {
|
||||
if ($type === "trash-bin") {
|
||||
// Since there is no trash bin endpoint for old dav version, new dav version's endpoint is used here.
|
||||
return $newTrashbinDavPath;
|
||||
}
|
||||
return "remote.php/webdav/";
|
||||
} elseif ($davPathVersionToUse === self::DAV_VERSION_NEW) {
|
||||
if ($type === "files") {
|
||||
$path = 'remote.php/dav/files/';
|
||||
return $path . $user . '/';
|
||||
} elseif ($type === "trash-bin") {
|
||||
return $newTrashbinDavPath;
|
||||
} else {
|
||||
return "remote.php/dav";
|
||||
}
|
||||
} else {
|
||||
throw new InvalidArgumentException(
|
||||
"DAV path version $davPathVersionToUse is unknown"
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* make sure there are no double slash in the URL
|
||||
*
|
||||
* @param string|null $url
|
||||
* @param bool|null $trailingSlash forces a trailing slash
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function sanitizeUrl(?string $url, ?bool $trailingSlash = false):string {
|
||||
if ($trailingSlash === true) {
|
||||
$url = $url . "/";
|
||||
} else {
|
||||
$url = \rtrim($url, "/");
|
||||
}
|
||||
$url = \preg_replace("/([^:]\/)\/+/", '$1', $url);
|
||||
return $url;
|
||||
}
|
||||
|
||||
/**
|
||||
* decides if the proposed dav version and chunking version are
|
||||
* a valid combination.
|
||||
* If no chunkingVersion is specified, then any dav version is valid.
|
||||
* If a chunkingVersion is specified, then it has to match the dav version.
|
||||
* Note: in future the dav and chunking versions might or might not
|
||||
* move together and/or be supported together. So a more complex
|
||||
* matrix could be needed here.
|
||||
*
|
||||
* @param string|int $davPathVersion
|
||||
* @param string|int|null $chunkingVersion
|
||||
*
|
||||
* @return boolean is this a valid combination
|
||||
*/
|
||||
public static function isValidDavChunkingCombination(
|
||||
$davPathVersion,
|
||||
$chunkingVersion
|
||||
): bool {
|
||||
if ($davPathVersion === self::DAV_VERSION_SPACES) {
|
||||
// allow only old chunking version when using the spaces dav
|
||||
return $chunkingVersion === 1;
|
||||
}
|
||||
return (
|
||||
($chunkingVersion === 'no' || $chunkingVersion === null) ||
|
||||
($davPathVersion === $chunkingVersion)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* get Mtime of File in a public link share
|
||||
*
|
||||
* @param string|null $baseUrl
|
||||
* @param string|null $fileName
|
||||
* @param string|null $token
|
||||
* @param string|null $xRequestId
|
||||
* @param int|null $davVersionToUse
|
||||
*
|
||||
* @return string
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function getMtimeOfFileinPublicLinkShare(
|
||||
?string $baseUrl,
|
||||
?string $fileName,
|
||||
?string $token,
|
||||
?string $xRequestId = '',
|
||||
?int $davVersionToUse = self::DAV_VERSION_NEW
|
||||
):string {
|
||||
$response = self::propfind(
|
||||
$baseUrl,
|
||||
null,
|
||||
null,
|
||||
"/public-files/{$token}/{$fileName}",
|
||||
['d:getlastmodified'],
|
||||
$xRequestId,
|
||||
'1',
|
||||
null,
|
||||
$davVersionToUse
|
||||
);
|
||||
$responseXmlObject = HttpRequestHelper::getResponseXml(
|
||||
$response,
|
||||
__METHOD__
|
||||
);
|
||||
$xmlPart = $responseXmlObject->xpath("//d:getlastmodified");
|
||||
|
||||
return $xmlPart[0]->__toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* get Mtime of a resource
|
||||
*
|
||||
* @param string|null $user
|
||||
* @param string|null $password
|
||||
* @param string|null $baseUrl
|
||||
* @param string|null $resource
|
||||
* @param string|null $xRequestId
|
||||
* @param int|null $davPathVersionToUse
|
||||
*
|
||||
* @return string
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function getMtimeOfResource(
|
||||
?string $user,
|
||||
?string $password,
|
||||
?string $baseUrl,
|
||||
?string $resource,
|
||||
?string $xRequestId = '',
|
||||
?int $davPathVersionToUse = self::DAV_VERSION_NEW
|
||||
):string {
|
||||
$response = self::propfind(
|
||||
$baseUrl,
|
||||
$user,
|
||||
$password,
|
||||
$resource,
|
||||
["getlastmodified"],
|
||||
$xRequestId,
|
||||
"0",
|
||||
"files",
|
||||
$davPathVersionToUse
|
||||
);
|
||||
$responseXmlObject = HttpRequestHelper::getResponseXml(
|
||||
$response,
|
||||
__METHOD__
|
||||
);
|
||||
$xmlpart = $responseXmlObject->xpath("//d:getlastmodified");
|
||||
Assert::assertArrayHasKey(
|
||||
0,
|
||||
$xmlpart,
|
||||
__METHOD__ . " XML part does not have key 0. Expected a value at index 0 of 'xmlPart' but, found: " . (string) json_encode($xmlpart)
|
||||
);
|
||||
$mtime = new DateTime($xmlpart[0]->__toString());
|
||||
return $mtime->format('U');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,401 @@
|
||||
default:
|
||||
autoload:
|
||||
"": "%paths.base%/../features/bootstrap"
|
||||
suites:
|
||||
coreApiMain:
|
||||
paths:
|
||||
- "%paths.base%/../features/coreApiMain"
|
||||
context: &common_ldap_suite_context
|
||||
parameters:
|
||||
ldapAdminPassword: admin
|
||||
ldapUsersOU: TestUsers
|
||||
ldapGroupsOU: TestGroups
|
||||
ldapInitialUserFilePath: /../../config/ldap-users.ldif
|
||||
contexts:
|
||||
- FeatureContext: &common_feature_context_params
|
||||
baseUrl: http://localhost:8080
|
||||
adminUsername: admin
|
||||
adminPassword: admin
|
||||
regularUserPassword: 123456
|
||||
ocPath: apps/testing/api/v1/occ
|
||||
- AppConfigurationContext:
|
||||
- ChecksumContext:
|
||||
- FilesVersionsContext:
|
||||
- TrashbinContext:
|
||||
|
||||
coreApiAuth:
|
||||
paths:
|
||||
- "%paths.base%/../features/coreApiAuth"
|
||||
context: *common_ldap_suite_context
|
||||
contexts:
|
||||
- FeatureContext: *common_feature_context_params
|
||||
- AuthContext:
|
||||
|
||||
coreApiAuthOcs:
|
||||
paths:
|
||||
- "%paths.base%/../features/coreApiAuthOcs"
|
||||
context: *common_ldap_suite_context
|
||||
contexts:
|
||||
- FeatureContext: *common_feature_context_params
|
||||
- AuthContext:
|
||||
|
||||
coreApiAuthWebDav:
|
||||
paths:
|
||||
- "%paths.base%/../features/coreApiAuthWebDav"
|
||||
context: *common_ldap_suite_context
|
||||
contexts:
|
||||
- FeatureContext: *common_feature_context_params
|
||||
- SearchContext:
|
||||
- PublicWebDavContext:
|
||||
- WebDavPropertiesContext:
|
||||
- AuthContext:
|
||||
|
||||
coreApiCapabilities:
|
||||
paths:
|
||||
- "%paths.base%/../features/coreApiCapabilities"
|
||||
context: *common_ldap_suite_context
|
||||
contexts:
|
||||
- FeatureContext: *common_feature_context_params
|
||||
- CapabilitiesContext:
|
||||
- AppConfigurationContext:
|
||||
|
||||
coreApiFavorites:
|
||||
paths:
|
||||
- "%paths.base%/../features/coreApiFavorites"
|
||||
context: *common_ldap_suite_context
|
||||
contexts:
|
||||
- FeatureContext: *common_feature_context_params
|
||||
- FavoritesContext:
|
||||
- WebDavPropertiesContext:
|
||||
- AppConfigurationContext:
|
||||
|
||||
coreApiShareCreateSpecialToShares1:
|
||||
paths:
|
||||
- "%paths.base%/../features/coreApiShareCreateSpecialToShares1"
|
||||
context: *common_ldap_suite_context
|
||||
contexts:
|
||||
- FeatureContext: *common_feature_context_params
|
||||
- TrashbinContext:
|
||||
- WebDavPropertiesContext:
|
||||
- AppConfigurationContext:
|
||||
|
||||
coreApiShareCreateSpecialToShares2:
|
||||
paths:
|
||||
- "%paths.base%/../features/coreApiShareCreateSpecialToShares2"
|
||||
context: *common_ldap_suite_context
|
||||
contexts:
|
||||
- FeatureContext: *common_feature_context_params
|
||||
- TrashbinContext:
|
||||
- WebDavPropertiesContext:
|
||||
- AppConfigurationContext:
|
||||
|
||||
coreApiSharees:
|
||||
paths:
|
||||
- "%paths.base%/../features/coreApiSharees"
|
||||
context: *common_ldap_suite_context
|
||||
contexts:
|
||||
- FeatureContext: *common_feature_context_params
|
||||
- ShareesContext:
|
||||
- AppConfigurationContext:
|
||||
|
||||
coreApiShareManagementToShares:
|
||||
paths:
|
||||
- "%paths.base%/../features/coreApiShareManagementToShares"
|
||||
context: *common_ldap_suite_context
|
||||
contexts:
|
||||
- FeatureContext: *common_feature_context_params
|
||||
- PublicWebDavContext:
|
||||
- TrashbinContext:
|
||||
- WebDavPropertiesContext:
|
||||
- AppConfigurationContext:
|
||||
- FilesVersionsContext:
|
||||
|
||||
coreApiShareManagementBasicToShares:
|
||||
paths:
|
||||
- "%paths.base%/../features/coreApiShareManagementBasicToShares"
|
||||
context: *common_ldap_suite_context
|
||||
contexts:
|
||||
- FeatureContext: *common_feature_context_params
|
||||
- PublicWebDavContext:
|
||||
- TrashbinContext:
|
||||
- WebDavPropertiesContext:
|
||||
- AuthContext:
|
||||
|
||||
coreApiShareOperationsToShares1:
|
||||
paths:
|
||||
- "%paths.base%/../features/coreApiShareOperationsToShares1"
|
||||
context: *common_ldap_suite_context
|
||||
contexts:
|
||||
- FeatureContext: *common_feature_context_params
|
||||
- PublicWebDavContext:
|
||||
- TrashbinContext:
|
||||
- WebDavPropertiesContext:
|
||||
|
||||
coreApiShareOperationsToShares2:
|
||||
paths:
|
||||
- "%paths.base%/../features/coreApiShareOperationsToShares2"
|
||||
context: *common_ldap_suite_context
|
||||
contexts:
|
||||
- FeatureContext: *common_feature_context_params
|
||||
- PublicWebDavContext:
|
||||
- TrashbinContext:
|
||||
- WebDavPropertiesContext:
|
||||
|
||||
coreApiSharePublicLink1:
|
||||
paths:
|
||||
- "%paths.base%/../features/coreApiSharePublicLink1"
|
||||
context: *common_ldap_suite_context
|
||||
contexts:
|
||||
- FeatureContext: *common_feature_context_params
|
||||
- PublicWebDavContext:
|
||||
- TrashbinContext:
|
||||
- WebDavPropertiesContext:
|
||||
- AppConfigurationContext:
|
||||
|
||||
coreApiSharePublicLink2:
|
||||
paths:
|
||||
- "%paths.base%/../features/coreApiSharePublicLink2"
|
||||
context: *common_ldap_suite_context
|
||||
contexts:
|
||||
- FeatureContext: *common_feature_context_params
|
||||
- PublicWebDavContext:
|
||||
- TrashbinContext:
|
||||
- WebDavPropertiesContext:
|
||||
- AppConfigurationContext:
|
||||
|
||||
coreApiSharePublicLink3:
|
||||
paths:
|
||||
- "%paths.base%/../features/coreApiSharePublicLink3"
|
||||
context: *common_ldap_suite_context
|
||||
contexts:
|
||||
- FeatureContext: *common_feature_context_params
|
||||
- PublicWebDavContext:
|
||||
- TrashbinContext:
|
||||
- WebDavPropertiesContext:
|
||||
- AppConfigurationContext:
|
||||
|
||||
coreApiShareReshareToShares1:
|
||||
paths:
|
||||
- "%paths.base%/../features/coreApiShareReshareToShares1"
|
||||
context: *common_ldap_suite_context
|
||||
contexts:
|
||||
- FeatureContext: *common_feature_context_params
|
||||
- PublicWebDavContext:
|
||||
- TrashbinContext:
|
||||
- WebDavPropertiesContext:
|
||||
|
||||
coreApiShareReshareToShares2:
|
||||
paths:
|
||||
- "%paths.base%/../features/coreApiShareReshareToShares2"
|
||||
context: *common_ldap_suite_context
|
||||
contexts:
|
||||
- FeatureContext: *common_feature_context_params
|
||||
- PublicWebDavContext:
|
||||
- TrashbinContext:
|
||||
- WebDavPropertiesContext:
|
||||
- AppConfigurationContext:
|
||||
|
||||
coreApiShareReshareToShares3:
|
||||
paths:
|
||||
- "%paths.base%/../features/coreApiShareReshareToShares3"
|
||||
context: *common_ldap_suite_context
|
||||
contexts:
|
||||
- FeatureContext: *common_feature_context_params
|
||||
- PublicWebDavContext:
|
||||
- TrashbinContext:
|
||||
- WebDavPropertiesContext:
|
||||
- AppConfigurationContext:
|
||||
|
||||
coreApiShareUpdateToShares:
|
||||
paths:
|
||||
- "%paths.base%/../features/coreApiShareUpdateToShares"
|
||||
context: *common_ldap_suite_context
|
||||
contexts:
|
||||
- FeatureContext: *common_feature_context_params
|
||||
- PublicWebDavContext:
|
||||
- TrashbinContext:
|
||||
- WebDavPropertiesContext:
|
||||
- AppConfigurationContext:
|
||||
|
||||
coreApiTrashbin:
|
||||
paths:
|
||||
- "%paths.base%/../features/coreApiTrashbin"
|
||||
context: *common_ldap_suite_context
|
||||
contexts:
|
||||
- FeatureContext: *common_feature_context_params
|
||||
- TrashbinContext:
|
||||
- AppConfigurationContext:
|
||||
- WebDavPropertiesContext:
|
||||
|
||||
coreApiTrashbinRestore:
|
||||
paths:
|
||||
- "%paths.base%/../features/coreApiTrashbinRestore"
|
||||
context: *common_ldap_suite_context
|
||||
contexts:
|
||||
- FeatureContext: *common_feature_context_params
|
||||
- TrashbinContext:
|
||||
- AppConfigurationContext:
|
||||
- WebDavPropertiesContext:
|
||||
|
||||
coreApiVersions:
|
||||
paths:
|
||||
- "%paths.base%/../features/coreApiVersions"
|
||||
context: *common_ldap_suite_context
|
||||
contexts:
|
||||
- FeatureContext: *common_feature_context_params
|
||||
- ChecksumContext:
|
||||
- FilesVersionsContext:
|
||||
- WebDavPropertiesContext:
|
||||
- AppConfigurationContext:
|
||||
- TrashbinContext:
|
||||
|
||||
coreApiWebdavDelete:
|
||||
paths:
|
||||
- "%paths.base%/../features/coreApiWebdavDelete"
|
||||
context: *common_ldap_suite_context
|
||||
contexts:
|
||||
- FeatureContext: *common_feature_context_params
|
||||
- SearchContext:
|
||||
- PublicWebDavContext:
|
||||
- WebDavPropertiesContext:
|
||||
- TrashbinContext:
|
||||
|
||||
coreApiWebdavLocks:
|
||||
paths:
|
||||
- "%paths.base%/../features/coreApiWebdavLocks"
|
||||
context: *common_ldap_suite_context
|
||||
contexts:
|
||||
- FeatureContext: *common_feature_context_params
|
||||
- PublicWebDavContext:
|
||||
- WebDavLockingContext:
|
||||
- WebDavPropertiesContext:
|
||||
|
||||
coreApiWebdavLocks2:
|
||||
paths:
|
||||
- "%paths.base%/../features/coreApiWebdavLocks2"
|
||||
context: *common_ldap_suite_context
|
||||
contexts:
|
||||
- FeatureContext: *common_feature_context_params
|
||||
- PublicWebDavContext:
|
||||
- WebDavLockingContext:
|
||||
- WebDavPropertiesContext:
|
||||
|
||||
coreApiWebdavLocksUnlock:
|
||||
paths:
|
||||
- "%paths.base%/../features/coreApiWebdavLocksUnlock"
|
||||
context: *common_ldap_suite_context
|
||||
contexts:
|
||||
- FeatureContext: *common_feature_context_params
|
||||
- PublicWebDavContext:
|
||||
- WebDavLockingContext:
|
||||
- WebDavPropertiesContext:
|
||||
|
||||
coreApiWebdavMove1:
|
||||
paths:
|
||||
- "%paths.base%/../features/coreApiWebdavMove1"
|
||||
context: *common_ldap_suite_context
|
||||
contexts:
|
||||
- FeatureContext: *common_feature_context_params
|
||||
- WebDavPropertiesContext:
|
||||
|
||||
coreApiWebdavMove2:
|
||||
paths:
|
||||
- "%paths.base%/../features/coreApiWebdavMove2"
|
||||
context: *common_ldap_suite_context
|
||||
contexts:
|
||||
- FeatureContext: *common_feature_context_params
|
||||
- WebDavPropertiesContext:
|
||||
|
||||
coreApiWebdavOperations:
|
||||
paths:
|
||||
- "%paths.base%/../features/coreApiWebdavOperations"
|
||||
context: *common_ldap_suite_context
|
||||
contexts:
|
||||
- FeatureContext: *common_feature_context_params
|
||||
- SearchContext:
|
||||
- PublicWebDavContext:
|
||||
- WebDavPropertiesContext:
|
||||
- TrashbinContext:
|
||||
|
||||
coreApiWebdavPreviews:
|
||||
paths:
|
||||
- "%paths.base%/../features/coreApiWebdavPreviews"
|
||||
context: *common_ldap_suite_context
|
||||
contexts:
|
||||
- FeatureContext: *common_feature_context_params
|
||||
- WebDavPropertiesContext:
|
||||
|
||||
coreApiWebdavProperties1:
|
||||
paths:
|
||||
- "%paths.base%/../features/coreApiWebdavProperties1"
|
||||
context: *common_ldap_suite_context
|
||||
contexts:
|
||||
- FeatureContext: *common_feature_context_params
|
||||
- WebDavPropertiesContext:
|
||||
- AppConfigurationContext:
|
||||
|
||||
coreApiWebdavProperties2:
|
||||
paths:
|
||||
- "%paths.base%/../features/coreApiWebdavProperties2"
|
||||
context: *common_ldap_suite_context
|
||||
contexts:
|
||||
- FeatureContext: *common_feature_context_params
|
||||
- WebDavPropertiesContext:
|
||||
- AppConfigurationContext:
|
||||
|
||||
coreApiWebdavUpload1:
|
||||
paths:
|
||||
- "%paths.base%/../features/coreApiWebdavUpload1"
|
||||
context: *common_ldap_suite_context
|
||||
contexts:
|
||||
- FeatureContext: *common_feature_context_params
|
||||
- PublicWebDavContext:
|
||||
- WebDavPropertiesContext:
|
||||
|
||||
coreApiWebdavUpload2:
|
||||
paths:
|
||||
- "%paths.base%/../features/coreApiWebdavUpload2"
|
||||
context: *common_ldap_suite_context
|
||||
contexts:
|
||||
- FeatureContext: *common_feature_context_params
|
||||
- PublicWebDavContext:
|
||||
|
||||
coreApiWebdavUploadTUS:
|
||||
paths:
|
||||
- "%paths.base%/../features/coreApiWebdavUploadTUS"
|
||||
context: *common_ldap_suite_context
|
||||
contexts:
|
||||
- FeatureContext: *common_feature_context_params
|
||||
- PublicWebDavContext:
|
||||
- TUSContext:
|
||||
- FilesVersionsContext:
|
||||
- ChecksumContext:
|
||||
|
||||
coreApiWebdavEtagPropagation1:
|
||||
paths:
|
||||
- "%paths.base%/../features/coreApiWebdavEtagPropagation1"
|
||||
context: *common_ldap_suite_context
|
||||
contexts:
|
||||
- FeatureContext: *common_feature_context_params
|
||||
- TrashbinContext:
|
||||
- PublicWebDavContext:
|
||||
- FilesVersionsContext:
|
||||
- WebDavPropertiesContext:
|
||||
- AppConfigurationContext:
|
||||
|
||||
coreApiWebdavEtagPropagation2:
|
||||
paths:
|
||||
- "%paths.base%/../features/coreApiWebdavEtagPropagation2"
|
||||
context: *common_ldap_suite_context
|
||||
contexts:
|
||||
- FeatureContext: *common_feature_context_params
|
||||
- TrashbinContext:
|
||||
- PublicWebDavContext:
|
||||
- FilesVersionsContext:
|
||||
- WebDavPropertiesContext:
|
||||
- AppConfigurationContext:
|
||||
|
||||
extensions:
|
||||
rdx\behatvars\BehatVariablesExtension: ~
|
||||
|
||||
Cjm\Behat\StepThroughExtension: ~
|
||||
@@ -1,11 +1,11 @@
|
||||
default:
|
||||
autoload:
|
||||
'': '%paths.base%/../features/bootstrap'
|
||||
"": "%paths.base%/../features/bootstrap"
|
||||
|
||||
suites:
|
||||
apiAccountsHashDifficulty:
|
||||
paths:
|
||||
- '%paths.base%/../features/apiAccountsHashDifficulty'
|
||||
- "%paths.base%/../features/apiAccountsHashDifficulty"
|
||||
context: &common_ldap_suite_context
|
||||
parameters:
|
||||
ldapAdminPassword: admin
|
||||
@@ -16,7 +16,6 @@ default:
|
||||
- RoleAssignmentContext:
|
||||
- GraphContext:
|
||||
- SpacesContext:
|
||||
- OccContext:
|
||||
- FeatureContext: &common_feature_context_params
|
||||
baseUrl: http://localhost:8080
|
||||
adminUsername: admin
|
||||
@@ -34,12 +33,11 @@ default:
|
||||
|
||||
apiSpaces:
|
||||
paths:
|
||||
- '%paths.base%/../features/apiSpaces'
|
||||
- "%paths.base%/../features/apiSpaces"
|
||||
context: *common_ldap_suite_context
|
||||
contexts:
|
||||
- RoleAssignmentContext:
|
||||
- SpacesContext:
|
||||
- OccContext:
|
||||
- FeatureContext: *common_feature_context_params
|
||||
- CapabilitiesContext:
|
||||
- ChecksumContext:
|
||||
@@ -48,19 +46,20 @@ default:
|
||||
- OCSContext:
|
||||
- PublicWebDavContext:
|
||||
- SearchContext:
|
||||
- TagContext:
|
||||
- TrashbinContext:
|
||||
- WebDavPropertiesContext:
|
||||
- TUSContext:
|
||||
- SpacesTUSContext:
|
||||
- GraphContext:
|
||||
|
||||
apiSpacesShares:
|
||||
paths:
|
||||
- '%paths.base%/../features/apiSpacesShares'
|
||||
- "%paths.base%/../features/apiSpacesShares"
|
||||
context: *common_ldap_suite_context
|
||||
contexts:
|
||||
- RoleAssignmentContext:
|
||||
- SpacesContext:
|
||||
- OccContext:
|
||||
- FeatureContext: *common_feature_context_params
|
||||
- CapabilitiesContext:
|
||||
- ChecksumContext:
|
||||
@@ -73,15 +72,16 @@ default:
|
||||
- WebDavPropertiesContext:
|
||||
- TUSContext:
|
||||
- SpacesTUSContext:
|
||||
|
||||
- ArchiverContext:
|
||||
- GraphContext:
|
||||
|
||||
apiContract:
|
||||
paths:
|
||||
- '%paths.base%/../features/apiContract'
|
||||
- "%paths.base%/../features/apiContract"
|
||||
context: *common_ldap_suite_context
|
||||
contexts:
|
||||
- RoleAssignmentContext:
|
||||
- SpacesContext:
|
||||
- OccContext:
|
||||
- FeatureContext: *common_feature_context_params
|
||||
- CapabilitiesContext:
|
||||
- ChecksumContext:
|
||||
@@ -94,16 +94,16 @@ default:
|
||||
- WebDavPropertiesContext:
|
||||
- TUSContext:
|
||||
- SpacesTUSContext:
|
||||
- GraphContext:
|
||||
|
||||
apiArchiver:
|
||||
paths:
|
||||
- '%paths.base%/../features/apiArchiver'
|
||||
- "%paths.base%/../features/apiArchiver"
|
||||
context: *common_ldap_suite_context
|
||||
contexts:
|
||||
- RoleAssignmentContext:
|
||||
- ArchiverContext:
|
||||
- SpacesContext:
|
||||
- OccContext:
|
||||
- FeatureContext: *common_feature_context_params
|
||||
- CapabilitiesContext:
|
||||
- ChecksumContext:
|
||||
@@ -113,16 +113,16 @@ default:
|
||||
- FavoritesContext:
|
||||
- TrashbinContext:
|
||||
- WebDavPropertiesContext:
|
||||
- GraphContext:
|
||||
|
||||
apiGraph:
|
||||
paths:
|
||||
- '%paths.base%/../features/apiGraph'
|
||||
- "%paths.base%/../features/apiGraph"
|
||||
context: *common_ldap_suite_context
|
||||
contexts:
|
||||
- RoleAssignmentContext:
|
||||
- GraphContext:
|
||||
- SpacesContext:
|
||||
- OccContext:
|
||||
- FeatureContext: *common_feature_context_params
|
||||
- CapabilitiesContext:
|
||||
- ChecksumContext:
|
||||
@@ -136,5 +136,22 @@ default:
|
||||
- TUSContext:
|
||||
- SpacesTUSContext:
|
||||
|
||||
apiCors:
|
||||
paths:
|
||||
- "%paths.base%/../features/apiCors"
|
||||
context: *common_ldap_suite_context
|
||||
contexts:
|
||||
- SpacesContext:
|
||||
- FeatureContext: *common_feature_context_params
|
||||
- WebDavPropertiesContext:
|
||||
- FavoritesContext:
|
||||
- ChecksumContext:
|
||||
- FilesVersionsContext:
|
||||
- OCSContext:
|
||||
- TrashbinContext:
|
||||
- GraphContext:
|
||||
|
||||
extensions:
|
||||
rdx\behatvars\BehatVariablesExtension: ~
|
||||
|
||||
Cjm\Behat\StepThroughExtension: ~
|
||||
@@ -0,0 +1,9 @@
|
||||
dn: ou=TestUsers,dc=owncloud,dc=com
|
||||
objectclass: top
|
||||
objectclass: organizationalUnit
|
||||
ou: TestUsers
|
||||
|
||||
dn: ou=TestGroups,dc=owncloud,dc=com
|
||||
objectclass: top
|
||||
objectclass: organizationalUnit
|
||||
ou: TestGroups
|
||||
@@ -32,13 +32,13 @@ then
|
||||
if [ "$STORAGE_DRIVER" = "owncloud" ]
|
||||
then
|
||||
export OCIS_REVA_DATA_ROOT='/srv/app/tmp/ocis/owncloud/data/'
|
||||
export BEHAT_FILTER_TAGS='~@notToImplementOnOCIS&&~@toImplementOnOCIS&&~comments-app-required&&~@federation-app-required&&~@notifications-app-required&&~systemtags-app-required&&~@local_storage&&~@skipOnOcis-OC-Storage'
|
||||
export BEHAT_FILTER_TAGS='~@toImplementOnOCIS&&~comments-app-required&&~@federation-app-required&&~@notifications-app-required&&~systemtags-app-required&&~@local_storage&&~@skipOnOcis-OC-Storage'
|
||||
export OCIS_SKELETON_STRATEGY='copy'
|
||||
export EXPECTED_FAILURES_FILE='/drone/src/tests/acceptance/expected-failures-API-on-OWNCLOUD-storage.md'
|
||||
elif [ "$STORAGE_DRIVER" = "ocis" ]
|
||||
then
|
||||
export OCIS_REVA_DATA_ROOT=''
|
||||
export BEHAT_FILTER_TAGS='~@notToImplementOnOCIS&&~@toImplementOnOCIS&&~comments-app-required&&~@federation-app-required&&~@notifications-app-required&&~systemtags-app-required&&~@local_storage&&~@skipOnOcis-OCIS-Storage'
|
||||
export BEHAT_FILTER_TAGS='~@toImplementOnOCIS&&~comments-app-required&&~@federation-app-required&&~@notifications-app-required&&~systemtags-app-required&&~@local_storage&&~@skipOnOcis-OCIS-Storage'
|
||||
export OCIS_SKELETON_STRATEGY='upload'
|
||||
export EXPECTED_FAILURES_FILE='/drone/src/tests/acceptance/expected-failures-API-on-OCIS-storage.md'
|
||||
else
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -23,14 +23,13 @@ The expected failures in this file are from features in the owncloud/ocis repo.
|
||||
- [apiGraph/createGroupCaseSensitive.feature:21](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/createGroupCaseSensitive.feature#L21)
|
||||
- [apiGraph/createGroupCaseSensitive.feature:22](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/createGroupCaseSensitive.feature#L22)
|
||||
- [apiGraph/createGroup.feature:26](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/createGroup.feature#L26)
|
||||
- [apiGraph/createUser.feature:28](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/createUser.feature#L28)
|
||||
|
||||
### [PROPFIND on accepted shares with identical names containing brackets exit with 404](https://github.com/owncloud/ocis/issues/4421)
|
||||
- [apiSpacesShares/changingFilesShare.feature:12](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/changingFilesShare.feature#L12)
|
||||
|
||||
### [copy to overwrite (file and folder) from Personal to Shares Jail behaves differently](https://github.com/owncloud/ocis/issues/4393)
|
||||
- [apiSpacesShares/copySpaces.feature:487](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/copySpaces.feature#L487)
|
||||
- [apiSpacesShares/copySpaces.feature:501](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/copySpaces.feature#L501)
|
||||
- [apiSpacesShares/copySpaces.feature:529](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/copySpaces.feature#L529)
|
||||
- [apiSpacesShares/copySpaces.feature:543](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/copySpaces.feature#L543)
|
||||
|
||||
#### [PATCH request for TUS upload with wrong checksum gives incorrect response](https://github.com/owncloud/ocis/issues/1755)
|
||||
- [apiSpacesShares/shareUploadTUS.feature:204](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/shareUploadTUS.feature#L204)
|
||||
@@ -38,9 +37,9 @@ The expected failures in this file are from features in the owncloud/ocis repo.
|
||||
- [apiSpacesShares/shareUploadTUS.feature:284](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/shareUploadTUS.feature#L284)
|
||||
|
||||
### [Copy or move on an existing resource doesn't create a new version but deletes instead](https://github.com/owncloud/ocis/issues/4797)
|
||||
- [apiSpacesShares/moveSpaces.feature:306](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/moveSpaces.feature#L306)
|
||||
- [apiSpacesShares/copySpaces.feature:710](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/copySpaces.feature#L710)
|
||||
- [apiSpacesShares/copySpaces.feature:748](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/copySpaces.feature#L748)
|
||||
- [apiSpacesShares/moveSpaces.feature:322](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/moveSpaces.feature#L322)
|
||||
- [apiSpacesShares/copySpaces.feature:752](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/copySpaces.feature#L752)
|
||||
- [apiSpacesShares/copySpaces.feature:793](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/copySpaces.feature#L793)
|
||||
|
||||
### [Creating group with empty name returns status code 200](https://github.com/owncloud/ocis/issues/5050)
|
||||
- [apiGraph/createGroup.feature:40](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/createGroup.feature#L40)
|
||||
@@ -68,3 +67,62 @@ The expected failures in this file are from features in the owncloud/ocis repo.
|
||||
- [apiGraph/editGroup.feature:23](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/editGroup.feature#L23)
|
||||
- [apiGraph/editGroup.feature:24](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/editGroup.feature#L24)
|
||||
- [apiGraph/editGroup.feature:25](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/editGroup.feature#L25)
|
||||
|
||||
#### [CORS headers are not identical with oC10 headers](https://github.com/owncloud/ocis/issues/5195)
|
||||
- [apiCors/cors.feature:25](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiCors/cors.feature#L25)
|
||||
- [apiCors/cors.feature:26](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiCors/cors.feature#L26)
|
||||
- [apiCors/cors.feature:27](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiCors/cors.feature#L27)
|
||||
- [apiCors/cors.feature:28](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiCors/cors.feature#L28)
|
||||
|
||||
#### [Requests with invalid credentials do not return CORS headers](https://github.com/owncloud/ocis/issues/5194)
|
||||
- [apiCors/cors.feature:67](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiCors/cors.feature#L67)
|
||||
- [apiCors/cors.feature:68](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiCors/cors.feature#L68)
|
||||
|
||||
#### [POST response does not return correct path when creating public link](https://github.com/owncloud/ocis/issues/5139)
|
||||
- [apiSpacesShares/shareSubItemOfSpaceViaPublicLink.feature:62](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/shareSubItemOfSpaceViaPublicLink.feature#L62)
|
||||
- [apiSpacesShares/shareSubItemOfSpaceViaPublicLink.feature:63](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/shareSubItemOfSpaceViaPublicLink.feature#L63)
|
||||
- [apiSpacesShares/shareSubItemOfSpaceViaPublicLink.feature:64](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/shareSubItemOfSpaceViaPublicLink.feature#L64)
|
||||
- [apiSpacesShares/shareSubItemOfSpaceViaPublicLink.feature:92](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/shareSubItemOfSpaceViaPublicLink.feature#L92)
|
||||
- [apiSpacesShares/shareSubItemOfSpaceViaPublicLink.feature:166](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/shareSubItemOfSpaceViaPublicLink.feature#L166)
|
||||
- [apiSpacesShares/shareSubItemOfSpaceViaPublicLink.feature:167](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/shareSubItemOfSpaceViaPublicLink.feature#L167)
|
||||
- [apiSpacesShares/shareSubItemOfSpaceViaPublicLink.feature:168](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/shareSubItemOfSpaceViaPublicLink.feature#L168)
|
||||
|
||||
#### [Public cannot download folder via the public link of the folder inside the project space](https://github.com/owncloud/ocis/issues/5229)
|
||||
- [apiSpacesShares/publicLinkDownload.feature:30](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/publicLinkDownload.feature#L30)
|
||||
|
||||
#### [A User can get information of another user with Graph API](https://github.com/owncloud/ocis/issues/5125)
|
||||
- [apiGraph/getUser.feature:23](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/getUser.feature#L23)
|
||||
- [apiGraph/getUser.feature:102](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/getUser.feature#L102)
|
||||
|
||||
#### [GET a file while it's in processing doesn't return 425 code (async uploads)](https://github.com/owncloud/ocis/issues/5326)
|
||||
- [apiAsyncUpload/delayPostprocessing.feature:14](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiAsyncUpload/delayPostprocessing.feature#L14)
|
||||
- [apiAsyncUpload/delayPostprocessing.feature:15](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiAsyncUpload/delayPostprocessing.feature#L15)
|
||||
- [apiAsyncUpload/delayPostprocessing.feature:16](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiAsyncUpload/delayPostprocessing.feature#L16)
|
||||
|
||||
#### [Normal user can get expanded members information of a group](https://github.com/owncloud/ocis/issues/5604)
|
||||
- [apiGraph/getGroup.feature:101](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/getGroup.feature#L101)
|
||||
|
||||
#### [Sharing to a group with an expiration date does not work #5442](https://github.com/owncloud/ocis/issues/5442)
|
||||
- [apiSpacesShares/shareSubItemOfSpace.feature:105](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/shareSubItemOfSpace.feature#L105)
|
||||
|
||||
#### [Space admin should not not be able to change the user quota](https://github.com/owncloud/ocis/issues/5475)
|
||||
- [apiSpaces/spaceManagement.feature:149](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/spaceManagement.feature#L149)
|
||||
|
||||
#### [Same users can be added in a group multiple time](https://github.com/owncloud/ocis/issues/5702)
|
||||
- [apiGraph/addUserToGroup.feature:222](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/addUserToGroup.feature#L222)
|
||||
|
||||
#### [Try to add group to a group return 204](https://github.com/owncloud/ocis/issues/5793)
|
||||
- [apiGraph/addUserToGroup.feature:244](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/addUserToGroup.feature#L244)
|
||||
|
||||
### [Users are added in a group with wrong host in host-part of user](https://github.com/owncloud/ocis/issues/5871)
|
||||
- [apiGraph/addUserToGroup.feature:292](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/addUserToGroup.feature#L292)
|
||||
- [apiGraph/addUserToGroup.feature:306](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/addUserToGroup.feature#L306)
|
||||
|
||||
### [Space admin trying to set personal space quota returns status code 200](https://github.com/owncloud/ocis/issues/5947)
|
||||
- [apiSpaces/setQuota.feature:80](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/setQuota.feature#L80)
|
||||
- [apiSpaces/setQuota.feature:81](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/setQuota.feature#L81)
|
||||
- [apiSpaces/setQuota.feature:82](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/setQuota.feature#L82)
|
||||
- [apiSpaces/setQuota.feature:83](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/setQuota.feature#L83)
|
||||
|
||||
Note: always have an empty line at the end of this file.
|
||||
The bash script that processes this file requires that the last line has a newline on the end.
|
||||
+1
-2
@@ -9,8 +9,7 @@ Feature: sharing
|
||||
|
||||
|
||||
Scenario Outline: Creating a share of a file with a user
|
||||
Given the administrator has set the default folder for received shares to "Shares"
|
||||
And auto-accept shares has been disabled
|
||||
Given auto-accept shares has been disabled
|
||||
And using OCS API version "<ocs_api_version>"
|
||||
And user "Alice" has been created with default attributes and without skeleton files
|
||||
And user "Alice" has uploaded file with content "ownCloud test text file 0" to "/textfile0.txt"
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
@api @skipOnOcV10
|
||||
Feature: Copy test
|
||||
check that the Copy response contains all the relevant values
|
||||
|
||||
Background:
|
||||
Given these users have been created with default attributes and without skeleton files:
|
||||
| username |
|
||||
| Alice |
|
||||
And using spaces DAV path
|
||||
And the administrator has given "Alice" the role "Space Admin" using the settings api
|
||||
And user "Alice" has created a space "new-space" with the default quota using the GraphApi
|
||||
|
||||
|
||||
Scenario: check the COPY response headers
|
||||
Given user "Alice" has uploaded a file inside space "new-space" with content "some content" to "testfile.txt"
|
||||
And user "Alice" has created a folder "new" in space "new-space"
|
||||
When user "Alice" copies file "testfile.txt" from space "new-space" to "/new/testfile.txt" inside space "new-space" using the WebDAV API
|
||||
Then the HTTP status code should be "201"
|
||||
And the following headers should match these regular expressions
|
||||
| Oc-Fileid | /^[a-f0-9!\$\-]{110}$/ |
|
||||
| Access-Control-Allow-Origin | /^[*]{1}$/ |
|
||||
@@ -0,0 +1,46 @@
|
||||
@api @skipOnOcV10
|
||||
Feature: Propfind test
|
||||
check that the PROPFIND response contains all the relevant values
|
||||
|
||||
Background:
|
||||
Given these users have been created with default attributes and without skeleton files:
|
||||
| username |
|
||||
| Alice |
|
||||
| Brian |
|
||||
And using spaces DAV path
|
||||
And the administrator has given "Alice" the role "Space Admin" using the settings api
|
||||
And user "Alice" has created a space "new-space" with the default quota using the GraphApi
|
||||
|
||||
|
||||
Scenario: space-admin checks the PROPFIND request of a space
|
||||
Given user "Alice" has uploaded a file inside space "new-space" with content "some content" to "testfile.txt"
|
||||
When user "Alice" sends PROPFIND request to space "new-space" using the WebDAV API
|
||||
Then the HTTP status code should be "207"
|
||||
And the "PROPFIND" response should contain a space "new-space" with these key and value pairs:
|
||||
| key | value |
|
||||
| oc:fileid | UUIDof:new-space |
|
||||
| oc:name | new-space |
|
||||
| oc:permissions | SRDNVCKZ |
|
||||
| oc:privatelink | |
|
||||
| oc:size | 12 |
|
||||
|
||||
|
||||
Scenario Outline: space member with a different role checks the PROPFIND request of a space
|
||||
Given user "Alice" has uploaded a file inside space "new-space" with content "some content" to "testfile.txt"
|
||||
And user "Alice" has shared a space "new-space" with settings:
|
||||
| shareWith | Brian |
|
||||
| role | <role> |
|
||||
When user "Brian" sends PROPFIND request to space "new-space" using the WebDAV API
|
||||
Then the HTTP status code should be "207"
|
||||
And the "PROPFIND" response should contain a space "new-space" with these key and value pairs:
|
||||
| key | value |
|
||||
| oc:fileid | UUIDof:new-space |
|
||||
| oc:name | new-space |
|
||||
| oc:permissions | <oc_permission> |
|
||||
| oc:privatelink | |
|
||||
| oc:size | 12 |
|
||||
Examples:
|
||||
| role | oc_permission |
|
||||
| manager | SRDNVCKZ |
|
||||
| editor | SDNVCK |
|
||||
| viewer | S |
|
||||
@@ -0,0 +1,52 @@
|
||||
@api
|
||||
Feature: REPORT request to Shares space
|
||||
Check that the REPORT response contains all relevant details for Shares
|
||||
|
||||
Background:
|
||||
Given these users have been created with default attributes and without skeleton files:
|
||||
| username |
|
||||
| Alice |
|
||||
| Brian |
|
||||
And user "Alice" has created folder "/folderMain"
|
||||
And user "Alice" has created folder "/folderMain/SubFolder1"
|
||||
And user "Alice" has created folder "/folderMain/SubFolder1/subFOLDER2"
|
||||
And user "Alice" has shared entry "/folderMain" with user "Brian" with permissions "17"
|
||||
And user "Brian" has accepted share "/folderMain" offered by user "Alice"
|
||||
|
||||
|
||||
Scenario Outline: Check the REPORT response of the found folder
|
||||
Given using <dav_version> DAV path
|
||||
When user "Brian" searches for "SubFolder1" using the WebDAV API
|
||||
Then the HTTP status code should be "207"
|
||||
And the "REPORT" response to user "Brian" should contain a mountpoint "folderMain" with these key and value pairs:
|
||||
| key | value |
|
||||
| oc:fileid | UUIDof:SubFolder1 |
|
||||
| oc:file-parent | UUIDof:folderMain |
|
||||
| oc:shareroot | /folderMain |
|
||||
| oc:name | SubFolder1 |
|
||||
| d:getcontenttype | httpd/unix-directory |
|
||||
| oc:permissions | SR |
|
||||
Examples:
|
||||
| dav_version |
|
||||
| old |
|
||||
| new |
|
||||
|
||||
|
||||
Scenario Outline: Check the REPORT response of the found file
|
||||
Given using <dav_version> DAV path
|
||||
And user "Alice" has uploaded file with content "Not all those who wander are lost." to "/folderMain/SubFolder1/subFOLDER2/frodo.txt"
|
||||
When user "Brian" searches for "frodo.txt" using the WebDAV API
|
||||
Then the HTTP status code should be "207"
|
||||
And the "REPORT" response to user "Brian" should contain a mountpoint "folderMain" with these key and value pairs:
|
||||
| key | value |
|
||||
| oc:fileid | UUIDof:SubFolder1/subFOLDER2/frodo.txt |
|
||||
| oc:file-parent | UUIDof:SubFolder1/subFOLDER2 |
|
||||
| oc:shareroot | /folderMain |
|
||||
| oc:name | frodo.txt |
|
||||
| d:getcontenttype | text/plain |
|
||||
| oc:permissions | SR |
|
||||
| d:getcontentlength | 34 |
|
||||
Examples:
|
||||
| dav_version |
|
||||
| old |
|
||||
| new |
|
||||
+10
-4
@@ -19,11 +19,14 @@ Feature: Report test
|
||||
|
||||
|
||||
Scenario: check the response of the found folder
|
||||
Given user "Alice" shares the following entity "folderMain" inside of space "find data" with user "Brian" with role "viewer"
|
||||
Given user "Alice" has created a share inside of space "find data" with settings:
|
||||
| path | folderMain |
|
||||
| shareWith | Brian |
|
||||
| role | viewer |
|
||||
And user "Brian" has accepted share "/folderMain" offered by user "Alice"
|
||||
When user "Brian" searches for "SubFolder1" using the WebDAV API
|
||||
Then the HTTP status code should be "207"
|
||||
And for user "Brian" the REPORT response should contain a mountpoint "folderMain" with these key and value pairs:
|
||||
And the "REPORT" response to user "Brian" should contain a mountpoint "folderMain" with these key and value pairs:
|
||||
| key | value |
|
||||
| oc:fileid | UUIDof:SubFolder1 |
|
||||
| oc:file-parent | UUIDof:folderMain |
|
||||
@@ -35,11 +38,14 @@ Feature: Report test
|
||||
|
||||
|
||||
Scenario: check the response of the found file
|
||||
Given user "Alice" shares the following entity "folderMain" inside of space "find data" with user "Brian" with role "editor"
|
||||
Given user "Alice" has created a share inside of space "find data" with settings:
|
||||
| path | folderMain |
|
||||
| shareWith | Brian |
|
||||
| role | editor |
|
||||
And user "Brian" has accepted share "/folderMain" offered by user "Alice"
|
||||
When user "Brian" searches for "insideTheFolder.txt" using the WebDAV API
|
||||
Then the HTTP status code should be "207"
|
||||
And for user "Brian" the REPORT response should contain a mountpoint "folderMain" with these key and value pairs:
|
||||
And the "REPORT" response to user "Brian" should contain a mountpoint "folderMain" with these key and value pairs:
|
||||
| key | value |
|
||||
| oc:fileid | UUIDof:SubFolder1/subFOLDER2/insideTheFolder.txt |
|
||||
| oc:file-parent | UUIDof:SubFolder1/subFOLDER2 |
|
||||
@@ -0,0 +1,68 @@
|
||||
# NOTE: for running this feature locally, you need to run oCIS with the following env var:
|
||||
# CORS_ALLOWED_ORIGINS=https://aphno.badal
|
||||
@api @skipOnOcV10
|
||||
Feature: CORS headers
|
||||
|
||||
Background:
|
||||
Given user "Alice" has been created with default attributes and without skeleton files
|
||||
|
||||
|
||||
Scenario Outline: CORS headers should be returned when setting CORS domain sending Origin header
|
||||
Given using OCS API version "<ocs_api_version>"
|
||||
When user "Alice" sends HTTP method "GET" to OCS API endpoint "<endpoint>" with headers
|
||||
| header | value |
|
||||
| Origin | https://aphno.badal |
|
||||
Then the OCS status code should be "<ocs-code>"
|
||||
And the HTTP status code should be "<http-code>"
|
||||
And the following headers should be set
|
||||
| header | value |
|
||||
| Access-Control-Allow-Headers | OC-Checksum,OC-Total-Length,OCS-APIREQUEST,X-OC-Mtime,OC-RequestAppPassword,Accept,Authorization,Brief,Content-Length,Content-Range,Content-Type,Date,Depth,Destination,Host,If,If-Match,If-Modified-Since,If-None-Match,If-Range,If-Unmodified-Since,Location,Lock-Token,Overwrite,Prefer,Range,Schedule-Reply,Timeout,User-Agent,X-Expected-Entity-Length,Accept-Language,Access-Control-Request-Method,Access-Control-Allow-Origin,Cache-Control,ETag,OC-Autorename,OC-CalDav-Import,OC-Chunked,OC-Etag,OC-FileId,OC-LazyOps,OC-Total-File-Length,Origin,X-Request-ID,X-Requested-With |
|
||||
| Access-Control-Expose-Headers | Content-Location,DAV,ETag,Link,Lock-Token,OC-ETag,OC-Checksum,OC-FileId,OC-JobStatus-Location,OC-RequestAppPassword,Vary,Webdav-Location,X-Sabre-Status |
|
||||
| Access-Control-Allow-Origin | https://aphno.badal |
|
||||
| Access-Control-Allow-Methods | GET,OPTIONS,POST,PUT,DELETE,MKCOL,PROPFIND,PATCH,PROPPATCH,REPORT |
|
||||
Examples:
|
||||
| ocs_api_version | endpoint | ocs-code | http-code |
|
||||
| 1 | /config | 100 | 200 |
|
||||
| 2 | /config | 200 | 200 |
|
||||
| 1 | /apps/files_sharing/api/v1/shares | 100 | 200 |
|
||||
| 2 | /apps/files_sharing/api/v1/shares | 200 | 200 |
|
||||
|
||||
|
||||
Scenario Outline: CORS headers should not be returned when CORS domain does not match Origin header
|
||||
Given using OCS API version "<ocs_api_version>"
|
||||
When user "Alice" sends HTTP method "GET" to OCS API endpoint "<endpoint>" with headers
|
||||
| header | value |
|
||||
| Origin | https://mero.badal |
|
||||
Then the OCS status code should be "<ocs-code>"
|
||||
And the HTTP status code should be "<http-code>"
|
||||
And the following headers should not be set
|
||||
| header |
|
||||
| Access-Control-Allow-Headers |
|
||||
| Access-Control-Expose-Headers |
|
||||
| Access-Control-Allow-Origin |
|
||||
| Access-Control-Allow-Methods |
|
||||
Examples:
|
||||
| ocs_api_version | endpoint | ocs-code | http-code |
|
||||
| 1 | /config | 100 | 200 |
|
||||
| 2 | /config | 200 | 200 |
|
||||
| 1 | /apps/files_sharing/api/v1/shares | 100 | 200 |
|
||||
| 2 | /apps/files_sharing/api/v1/shares | 200 | 200 |
|
||||
|
||||
|
||||
Scenario Outline: CORS headers should be returned when an invalid password is used
|
||||
Given using OCS API version "<ocs_api_version>"
|
||||
When user "Alice" sends HTTP method "GET" to OCS API endpoint "<endpoint>" with headers using password "invalid"
|
||||
| header | value |
|
||||
| Origin | https://aphno.badal |
|
||||
Then the OCS status code should be "997"
|
||||
And the HTTP status code should be "401"
|
||||
And the following headers should be set
|
||||
| header | value |
|
||||
| Access-Control-Allow-Headers | OC-Checksum,OC-Total-Length,OCS-APIREQUEST,X-OC-Mtime,OC-RequestAppPassword,Accept,Authorization,Brief,Content-Length,Content-Range,Content-Type,Date,Depth,Destination,Host,If,If-Match,If-Modified-Since,If-None-Match,If-Range,If-Unmodified-Since,Location,Lock-Token,Overwrite,Prefer,Range,Schedule-Reply,Timeout,User-Agent,X-Expected-Entity-Length,Accept-Language,Access-Control-Request-Method,Access-Control-Allow-Origin,Cache-Control,ETag,OC-Autorename,OC-CalDav-Import,OC-Chunked,OC-Etag,OC-FileId,OC-LazyOps,OC-Total-File-Length,Origin,X-Request-ID,X-Requested-With |
|
||||
| Access-Control-Expose-Headers | Content-Location,DAV,ETag,Link,Lock-Token,OC-ETag,OC-Checksum,OC-FileId,OC-JobStatus-Location,OC-RequestAppPassword,Vary,Webdav-Location,X-Sabre-Status |
|
||||
| Access-Control-Allow-Origin | https://aphno.badal |
|
||||
| Access-Control-Allow-Methods | GET,OPTIONS,POST,PUT,DELETE,MKCOL,PROPFIND,PATCH,PROPPATCH,REPORT |
|
||||
Examples:
|
||||
| ocs_api_version | endpoint |
|
||||
| 1 | /apps/files_sharing/api/v1/shares |
|
||||
| 2 | /apps/files_sharing/api/v1/shares |
|
||||
@@ -69,14 +69,14 @@ Feature: add users to group
|
||||
|
||||
Scenario: adding a user to a group with % and # in its name
|
||||
Given these groups have been created:
|
||||
| groupname | comment |
|
||||
| maintenance#123 | Hash sign |
|
||||
| 50%pass | Percent sign (special escaping happens) |
|
||||
| 50%25=0 | %25 literal looks like an escaped "%" |
|
||||
| 50%2Eagle | %2E literal looks like an escaped "." |
|
||||
| 50%2Fix | %2F literal looks like an escaped slash |
|
||||
| Mgmt\Middle | Backslash |
|
||||
| staff?group | Question mark |
|
||||
| groupname | comment |
|
||||
| maintenance#123 | Hash sign |
|
||||
| 50%pass | Percent sign (special escaping happens) |
|
||||
| 50%25=0 | %25 literal looks like an escaped "%" |
|
||||
| 50%2Eagle | %2E literal looks like an escaped "." |
|
||||
| 50%2Fix | %2F literal looks like an escaped slash |
|
||||
| Mgmt\Middle | Backslash |
|
||||
| staff?group | Question mark |
|
||||
When the administrator adds the following users to the following groups using the Graph API
|
||||
| username | groupname |
|
||||
| Alice | maintenance#123 |
|
||||
@@ -136,7 +136,7 @@ Feature: add users to group
|
||||
|
||||
|
||||
Scenario: admin tries to add user to a non-existing group
|
||||
When the administrator tries to add user "Alice" to group "nonexistentgroup" using the Graph API
|
||||
When the administrator tries to add user "Alice" to a nonexistent group using the Graph API
|
||||
Then the HTTP status code should be "404"
|
||||
|
||||
|
||||
@@ -147,5 +147,208 @@ Feature: add users to group
|
||||
|
||||
|
||||
Scenario: admin tries to add user to a group without sending the group
|
||||
When the administrator tries to add user "Alice" to group "" using the Graph API
|
||||
When the administrator tries to add user "Alice" to a nonexistent group using the Graph API
|
||||
Then the HTTP status code should be "404"
|
||||
|
||||
|
||||
Scenario: add multiple users to a group at once
|
||||
Given the administrator has given "Alice" the role "Admin" using the settings api
|
||||
And these users have been created with default attributes and without skeleton files:
|
||||
| username |
|
||||
| Brian |
|
||||
| Carol |
|
||||
And user "Alice" has created a group "grp1" using the Graph API
|
||||
When the administrator "Alice" adds the following users to a group "grp1" at once using the Graph API
|
||||
| username |
|
||||
| Brian |
|
||||
| Carol |
|
||||
Then the HTTP status code should be "204"
|
||||
And the following users should be listed in the following groups
|
||||
| username | groupname |
|
||||
| Brian | grp1 |
|
||||
| Carol | grp1 |
|
||||
|
||||
|
||||
Scenario: admin tries to add users to a non-existing group at once
|
||||
Given the administrator has given "Alice" the role "Admin" using the settings api
|
||||
And these users have been created with default attributes and without skeleton files:
|
||||
| username |
|
||||
| Brian |
|
||||
| Carol |
|
||||
When the administrator "Alice" tries to add the following users to a nonexistent group at once using the Graph API
|
||||
| username |
|
||||
| Brian |
|
||||
| Carol |
|
||||
Then the HTTP status code should be "404"
|
||||
|
||||
|
||||
Scenario: admin tries to add multiple non-existing users to a group at once
|
||||
Given the administrator has given "Alice" the role "Admin" using the settings api
|
||||
And user "Alice" has created a group "grp1" using the Graph API
|
||||
When the administrator "Alice" tries to add the following nonexistent users to a group "grp1" at once using the Graph API
|
||||
| username |
|
||||
| Brian |
|
||||
| Carol |
|
||||
Then the HTTP status code should be "404"
|
||||
|
||||
|
||||
Scenario: admin tries to add non-existing and existing users to a group at once
|
||||
Given the administrator has given "Alice" the role "Admin" using the settings api
|
||||
And these users have been created with default attributes and without skeleton files:
|
||||
| username |
|
||||
| Brian |
|
||||
And user "Alice" has created a group "grp1" using the Graph API
|
||||
When the administrator "Alice" tries to add the following existent and nonexistent users to a group "grp1" at once using the Graph API
|
||||
| username |
|
||||
| Brian |
|
||||
| Carol |
|
||||
Then the HTTP status code should be "404"
|
||||
|
||||
|
||||
Scenario: adding a disabled user to a group
|
||||
Given these groups have been created:
|
||||
| groupname | comment |
|
||||
| sales | normal group |
|
||||
And the user "Admin" has disabled user "Alice" using the Graph API
|
||||
When the administrator adds the following users to the following groups using the Graph API
|
||||
| username | groupname |
|
||||
| Alice | sales |
|
||||
Then the HTTP status code of responses on all endpoints should be "204"
|
||||
And the following users should be listed in the following groups
|
||||
| username | groupname |
|
||||
| Alice | sales |
|
||||
|
||||
@issue-5702
|
||||
Scenario: try to add users to a group twice
|
||||
Given the administrator has given "Alice" the role "Admin" using the settings api
|
||||
And these users have been created with default attributes and without skeleton files:
|
||||
| username |
|
||||
| Brian |
|
||||
| Carol |
|
||||
And user "Alice" has created a group "grp1" using the Graph API
|
||||
And the administrator "Alice" has added the following users to a group "grp1" at once using the Graph API
|
||||
| username |
|
||||
| Brian |
|
||||
| Carol |
|
||||
When the administrator "Alice" adds the following users to a group "grp1" at once using the Graph API
|
||||
| username |
|
||||
| Brian |
|
||||
| Carol |
|
||||
Then the HTTP status code should be "400"
|
||||
And the following users should be listed in the following groups
|
||||
| username | groupname |
|
||||
| Brian | grp1 |
|
||||
| Carol | grp1 |
|
||||
|
||||
@issue-5793
|
||||
Scenario: try to add a group to a group
|
||||
Given the administrator has given "Alice" the role "Admin" using the settings api
|
||||
And these users have been created with default attributes and without skeleton files:
|
||||
| username |
|
||||
| Brian |
|
||||
And these groups have been created:
|
||||
| groupname |
|
||||
| student |
|
||||
| music |
|
||||
And user "Brian" has been added to group "music"
|
||||
When the administrator "Alice" tries to add a group "music" to a group "student" using the Graph API
|
||||
Then the HTTP status code should be "400"
|
||||
|
||||
|
||||
Scenario Outline: admin tries to add a user to a group with invalid JSON
|
||||
Given the administrator has given "Alice" the role "Admin" using the settings api
|
||||
And these users have been created with default attributes and without skeleton files:
|
||||
| username |
|
||||
| Brian |
|
||||
And user "Alice" has created a group "grp1" using the Graph API
|
||||
When user "Alice" tries to add user "Brian" to group "grp1" with invalid JSON "<invalid-json>" using the Graph API
|
||||
Then the HTTP status code should be "400"
|
||||
Examples:
|
||||
| invalid-json |
|
||||
| {'@odata.id': 'https://localhost:9200/graph/v1.0/users/%user_id%',} |
|
||||
| {'@odata.id'- 'https://localhost:9200/graph/v1.0/users/%user_id%'} |
|
||||
| {@odata.id: https://localhost:9200/graph/v1.0/users/%user_id%} |
|
||||
|
||||
|
||||
Scenario Outline: admin tries to add multiple users to a group at once with invalid JSON
|
||||
Given the administrator has given "Alice" the role "Admin" using the settings api
|
||||
And these users have been created with default attributes and without skeleton files:
|
||||
| username |
|
||||
| Brian |
|
||||
| Carol |
|
||||
And user "Alice" has created a group "grp1" using the Graph API
|
||||
When user "Alice" tries to add the following users to a group "grp1" at once with invalid JSON "<invalid-json>" using the Graph API
|
||||
| username |
|
||||
| Brian |
|
||||
| Carol |
|
||||
Then the HTTP status code should be "400"
|
||||
Examples:
|
||||
| invalid-json |
|
||||
| {'members@odata.bind': ['https://localhost:9200/graph/v1.0/users/%user_id%',,'https://localhost:9200/graph/v1.0/users/%user_id%']} |
|
||||
| {'members@odata.bind'- ['https://localhost:9200/graph/v1.0/users/%user_id%','https://localhost:9200/graph/v1.0/users/%user_id%']} |
|
||||
| {'members@odata.bind': ['https://localhost:9200/graph/v1.0/users/%user_id%'.'https://localhost:9200/graph/v1.0/users/%user_id%']} |
|
||||
|
||||
@issue-5871
|
||||
Scenario: admin tries to add multiple users with wrong host
|
||||
Given the administrator has given "Alice" the role "Admin" using the settings api
|
||||
And these users have been created with default attributes and without skeleton files:
|
||||
| username |
|
||||
| Brian |
|
||||
| Carol |
|
||||
And user "Alice" has created a group "grp1" using the Graph API
|
||||
When user "Alice" tries to add the following users to a group "grp1" at once with an invalid host using the Graph API
|
||||
| username |
|
||||
| Brian |
|
||||
| Carol |
|
||||
Then the HTTP status code should be "400"
|
||||
|
||||
@issue-5871
|
||||
Scenario: admin tries to add single user with wrong host
|
||||
Given the administrator has given "Alice" the role "Admin" using the settings api
|
||||
And these users have been created with default attributes and without skeleton files:
|
||||
| username |
|
||||
| Brian |
|
||||
And user "Alice" has created a group "grp1" using the Graph API
|
||||
When user "Alice" tries to add user "Brian" to group "grp1" with an invalid host using the Graph API
|
||||
Then the HTTP status code should be "400"
|
||||
|
||||
|
||||
Scenario Outline: try to add invalid user id to a group
|
||||
Given the administrator has given "Alice" the role "Admin" using the settings api
|
||||
And user "Alice" has created a group "grp1" using the Graph API
|
||||
When the administrator "Alice" tries to add an invalid user id "<invalid-uuidv4>" to a group "grp1" using the Graph API
|
||||
Then the HTTP status code should be "404"
|
||||
Examples:
|
||||
| invalid-uuidv4 | comment |
|
||||
| �ϰ�Ϧ-@$@^-¶Ëøœ-ɧɸɱʨΌϖЁϿ | UTF characters |
|
||||
| 4c510ada-c86b-4815-8820-42cdf82c3d511 | adding an extra character at end of valid UUID pattern |
|
||||
| 4c510adac8-6b-4815-882042cdf-82c3d51 | invalid UUID pattern |
|
||||
|
||||
|
||||
Scenario Outline: try to add invalid user ids to a group at once
|
||||
Given the administrator has given "Alice" the role "Admin" using the settings api
|
||||
And user "Alice" has created a group "grp1" using the Graph API
|
||||
When the administrator "Alice" tries to add the following invalid user ids to a group "grp1" at once using the Graph API
|
||||
| user-id |
|
||||
| <invalid-uuidv4> |
|
||||
| <invalid-uuidv4> |
|
||||
Then the HTTP status code should be "404"
|
||||
Examples:
|
||||
| invalid-uuidv4 | comment |
|
||||
| �ϰ�Ϧ-@$@^-¶Ëøœ-ɧɸɱʨΌϖЁϿ | UTF characters |
|
||||
| 4c510ada-c86b-4815-8820-42cdf82c3d511 | adding an extra character at end of valid UUID pattern |
|
||||
| 4c510adac8-6b-4815-882042cdf-82c3d51 | invalid UUID pattern |
|
||||
|
||||
@skipOnStable2.0
|
||||
Scenario: add same user twice to a group at once
|
||||
Given the administrator has given "Alice" the role "Admin" using the settings api
|
||||
And these users have been created with default attributes and without skeleton files:
|
||||
| username |
|
||||
| Brian |
|
||||
And user "Alice" has created a group "grp1" using the Graph API
|
||||
When the administrator "Alice" adds the following users to a group "grp1" at once using the Graph API
|
||||
| username |
|
||||
| Brian |
|
||||
| Brian |
|
||||
Then the HTTP status code should be "204"
|
||||
And the user "Brian" should be listed once in the group "grp1"
|
||||
@@ -0,0 +1,47 @@
|
||||
@api @skipOnStable2.0
|
||||
Feature: assign role
|
||||
As an admin,
|
||||
I want to assign roles to users.
|
||||
So that users without an admin role cannot get the list of roles, assignments list and assign roles to users
|
||||
|
||||
|
||||
Scenario Outline: assign role to the user using graph api
|
||||
Given user "Alice" has been created with default attributes and without skeleton files
|
||||
And the administrator has assigned the role "<userRole>" to user "Alice" using the Graph API
|
||||
When the administrator retrieves the assigned role of user "Alice" using the Graph API
|
||||
Then the HTTP status code should be "200"
|
||||
And the Graph API response should have the role "<userRole>"
|
||||
Examples:
|
||||
| userRole |
|
||||
| Admin |
|
||||
| Space Admin |
|
||||
| User |
|
||||
| Guest |
|
||||
|
||||
@issue-5032
|
||||
Scenario Outline: assign role to the user with graph api and list role with setting api
|
||||
Given user "Alice" has been created with default attributes and without skeleton files
|
||||
And the administrator has assigned the role "<userRole>" to user "Alice" using the Graph API
|
||||
When user "Alice" tries to get list of assignment
|
||||
Then the HTTP status code should be "<statusCode>"
|
||||
And the setting API response should have the role "<userRole>"
|
||||
Examples:
|
||||
| userRole | statusCode |
|
||||
| Admin | 201 |
|
||||
| Space Admin | 401 |
|
||||
| User | 401 |
|
||||
| Guest | 401 |
|
||||
|
||||
|
||||
Scenario Outline: assign role to the user with setting api and list role with graph api
|
||||
Given user "Alice" has been created with default attributes and without skeleton files
|
||||
And the administrator has given "Alice" the role "<userRole>" using the settings api
|
||||
When the administrator retrieves the assigned role of user "Alice" using the Graph API
|
||||
Then the HTTP status code should be "200"
|
||||
And the Graph API response should have the role "<userRole>"
|
||||
Examples:
|
||||
| userRole |
|
||||
| Admin |
|
||||
| Space Admin |
|
||||
| User |
|
||||
| Guest |
|
||||
@@ -26,17 +26,17 @@ Feature: create group
|
||||
Scenario: admin user tries to create a group that already exists
|
||||
Given group "mygroup" has been created
|
||||
When user "Alice" tries to create a group "mygroup" using the Graph API
|
||||
And the HTTP status code should be "400"
|
||||
Then the HTTP status code should be "400"
|
||||
And group "mygroup" should exist
|
||||
|
||||
|
||||
Scenario: normal user tries to create a group
|
||||
Given user "Brian" has been created with default attributes and without skeleton files
|
||||
When user "Brian" tries to create a group "mygroup" using the Graph API
|
||||
And the HTTP status code should be "401"
|
||||
Then the HTTP status code should be "401"
|
||||
And group "mygroup" should not exist
|
||||
|
||||
|
||||
Scenario: admin user tries to create a group that is the empty string
|
||||
When user "Alice" tries to create a group "" using the Graph API
|
||||
Then the HTTP status code should be "400"
|
||||
Then the HTTP status code should be "400"
|
||||
@@ -12,43 +12,77 @@ Feature: create user
|
||||
Scenario Outline: the admin creates a user
|
||||
Given the administrator has given "Alice" the role "Admin" using the settings api
|
||||
When the user "Alice" creates a new user using GraphAPI with the following settings:
|
||||
| userName | <userName> |
|
||||
| displayName | <displayName> |
|
||||
| email | <email> |
|
||||
| password | <password> |
|
||||
| userName | <userName> |
|
||||
| displayName | <displayName> |
|
||||
| email | <email> |
|
||||
| password | <password> |
|
||||
| accountEnabled | <enable> |
|
||||
Then the HTTP status code should be "<code>"
|
||||
And user "<userName>" <shouldOrNot> exist
|
||||
Examples:
|
||||
| userName | displayName | email | password | code | shouldOrNot |
|
||||
| SameDisplayName | Alice Hansen | new@example.org | containsCharacters(*:!;_+-&) | 200 | should |
|
||||
| withoutPassSameEmail | without pass | alice@example.org | | 200 | should |
|
||||
| name | pass with space | example@example.org | my pass | 200 | should |
|
||||
| nameWithCharacters(*:!;_+-&) | user | new@example.org | 123 | 400 | should not |
|
||||
| withoutEmail | without email | | 123 | 400 | should not |
|
||||
| Alice | same userName | new@example.org | 123 | 400 | should |
|
||||
| name with space | name with space | example@example.org | 123 | 400 | should not |
|
||||
| userName | displayName | email | password | code | enable | shouldOrNot |
|
||||
| SameDisplayName | Alice Hansen | new@example.org | containsCharacters(*:!;_+-&) | 200 | true | should |
|
||||
| withoutPassSameEmail | without pass | alice@example.org | | 200 | true | should |
|
||||
| name | pass with space | example@example.org | my pass | 200 | true | should |
|
||||
| nameWithCharacters(*:!;_+-&) | user | new@example.org | 123 | 400 | true | should not |
|
||||
| name with space | name with space | example@example.org | 123 | 400 | true | should not |
|
||||
| createDisabledUser | disabled user | example@example.org | 123 | 200 | false | should |
|
||||
|
||||
@skipOnStable2.0
|
||||
Examples:
|
||||
| userName | displayName | email | password | code | enable | shouldOrNot |
|
||||
| withoutEmail | without email | | 123 | 200 | true | should |
|
||||
| Alice | same userName | new@example.org | 123 | 400 | true | should |
|
||||
|
||||
Scenario: a user cannot be created with empty name
|
||||
Given the administrator has given "Alice" the role "Admin" using the settings api
|
||||
When the user "Alice" creates a new user using GraphAPI with the following settings:
|
||||
| userName | |
|
||||
| displayName | emptyName |
|
||||
| email | @example.org |
|
||||
| password | 123 |
|
||||
| userName | |
|
||||
| displayName | emptyName |
|
||||
| email | @example.org |
|
||||
| password | 123 |
|
||||
| accountEnabled | true |
|
||||
Then the HTTP status code should be "400"
|
||||
|
||||
|
||||
Scenario Outline: a user without admin right cannot create a user
|
||||
Given the administrator has given "Alice" the role "<role>" using the settings api
|
||||
When the user "Alice" creates a new user using GraphAPI with the following settings:
|
||||
| userName | user |
|
||||
| displayName | user |
|
||||
| email | @example.org |
|
||||
| password | 123 |
|
||||
| userName | user |
|
||||
| displayName | user |
|
||||
| email | @example.org |
|
||||
| password | 123 |
|
||||
| accountEnabled | true |
|
||||
Then the HTTP status code should be "401"
|
||||
And user "user" should not exist
|
||||
Examples:
|
||||
| role |
|
||||
| Space Admin |
|
||||
| User |
|
||||
|
||||
@skipOnStable2.0
|
||||
Scenario: a user cannot be created with the name of the disabled user
|
||||
Given user "Brian" has been created with default attributes and without skeleton files
|
||||
And the administrator has given "Alice" the role "Admin" using the settings api
|
||||
And the user "Alice" has disabled user "Brian" using the Graph API
|
||||
When the user "Alice" creates a new user using GraphAPI with the following settings:
|
||||
| userName | Brian |
|
||||
| displayName | This is another Brian |
|
||||
| email | brian@example.com |
|
||||
| password | 123 |
|
||||
| accountEnabled | true |
|
||||
Then the HTTP status code should be "400"
|
||||
|
||||
@skipOnStable2.0
|
||||
Scenario: a user can be created with the name of the deleted user
|
||||
Given user "Brian" has been created with default attributes and without skeleton files
|
||||
And the administrator has given "Alice" the role "Admin" using the settings api
|
||||
And the user "Alice" has deleted a user "Brian" using the Graph API
|
||||
When the user "Alice" creates a new user using GraphAPI with the following settings:
|
||||
| userName | Brian |
|
||||
| displayName | This is another Brian |
|
||||
| email | brian@example.com |
|
||||
| password | 123 |
|
||||
| accountEnabled | true |
|
||||
Then the HTTP status code should be "200"
|
||||
And user "Brian" should exist
|
||||
@@ -0,0 +1,82 @@
|
||||
@api @skipOnOcV10
|
||||
Feature: delete user
|
||||
Only user with admin permission can delete user
|
||||
|
||||
Note - this feature is run in CI with ACCOUNTS_HASH_DIFFICULTY set to the default for production
|
||||
See https://github.com/owncloud/ocis/issues/1542 and https://github.com/owncloud/ocis/pull/839
|
||||
|
||||
Background:
|
||||
Given user "Alice" has been created with default attributes and without skeleton files
|
||||
|
||||
|
||||
Scenario Outline: the admin user deletes a user
|
||||
Given the administrator has given "Alice" the role "Admin" using the settings api
|
||||
And the user "Alice" has created a new user using the Graph API with the following settings:
|
||||
| userName | <userName> |
|
||||
| displayName | <displayName> |
|
||||
| email | <email> |
|
||||
| password | <password> |
|
||||
When the user "Alice" deletes a user "<userName>" using the Graph API
|
||||
Then the HTTP status code should be "204"
|
||||
And user "<userName>" should not exist
|
||||
Examples:
|
||||
| userName | displayName | email | password |
|
||||
| SameDisplayName | Alice Hansen | new@example.org | containsCharacters(*:!;_+-&) |
|
||||
| withoutPassSameEmail | without pass | alice@example.org | |
|
||||
| name | pass with space | example@example.org | my pass |
|
||||
|
||||
|
||||
Scenario: Delete a user and specify the user name in different case
|
||||
Given user "brand-new-user" has been created with default attributes and without skeleton files
|
||||
And the administrator has given "Alice" the role "Admin" using the settings api
|
||||
When the user "Alice" deletes a user "Brand-New-User" using the Graph API
|
||||
Then the HTTP status code should be "204"
|
||||
And user "brand-new-user" should not exist
|
||||
|
||||
|
||||
Scenario Outline: the admin user deletes another user with different role
|
||||
Given user "Brian" has been created with default attributes and without skeleton files
|
||||
And the administrator has given "Alice" the role "Admin" using the settings api
|
||||
And the administrator has given "Brian" the role "<role>" using the settings api
|
||||
When the user "Alice" deletes a user "Brian" using the Graph API
|
||||
Then the HTTP status code should be "204"
|
||||
And user "Brian" should not exist
|
||||
Examples:
|
||||
| role |
|
||||
| Admin |
|
||||
| Space Admin |
|
||||
| User |
|
||||
|
||||
|
||||
Scenario: the admin user tries to delete his/her own account
|
||||
Given the administrator has given "Alice" the role "Admin" using the settings api
|
||||
When the user "Alice" deletes a user "Alice" using the Graph API
|
||||
Then the HTTP status code should be "403"
|
||||
And user "Alice" should exist
|
||||
|
||||
|
||||
Scenario: the admin user tries to delete a non-existent user
|
||||
Given the administrator has given "Alice" the role "Admin" using the settings api
|
||||
When the user "Alice" deletes a user "nonExistentUser" using the Graph API
|
||||
Then the HTTP status code should be "404"
|
||||
|
||||
|
||||
Scenario Outline: Non-admin user tries to delete another user with different role
|
||||
Given user "Brian" has been created with default attributes and without skeleton files
|
||||
And the administrator has given "Alice" the role "<role>" using the settings api
|
||||
When the user "Alice" deletes a user "Brian" using the Graph API
|
||||
Then the HTTP status code should be "401"
|
||||
And user "Brian" should exist
|
||||
Examples:
|
||||
| role |
|
||||
| Space Admin |
|
||||
| User |
|
||||
|
||||
|
||||
Scenario: the admin user deletes a disabled user
|
||||
Given the administrator has given "Alice" the role "Admin" using the settings api
|
||||
And user "Brian" has been created with default attributes and without skeleton files
|
||||
And the user "Alice" has disabled user "Brian" using the Graph API
|
||||
When the user "Alice" deletes a user "Brian" using the Graph API
|
||||
Then the HTTP status code should be "204"
|
||||
And user "Brian" should not exist
|
||||
@@ -0,0 +1,229 @@
|
||||
@api @skipOnOcV10
|
||||
Feature: edit user
|
||||
|
||||
Note - this feature is run in CI with ACCOUNTS_HASH_DIFFICULTY set to the default for production
|
||||
See https://github.com/owncloud/ocis/issues/1542 and https://github.com/owncloud/ocis/pull/839
|
||||
|
||||
Background:
|
||||
Given user "Alice" has been created with default attributes and without skeleton files
|
||||
And the administrator has given "Alice" the role "Admin" using the settings api
|
||||
And the user "Alice" has created a new user using the Graph API with the following settings:
|
||||
| userName | Brian |
|
||||
| displayName | Brian Murphy |
|
||||
| email | brian@example.com |
|
||||
| password | 1234 |
|
||||
|
||||
|
||||
Scenario Outline: the admin user can edit another user's email
|
||||
When the user "Alice" changes the email of user "Brian" to "<newEmail>" using the Graph API
|
||||
Then the HTTP status code should be "<code>"
|
||||
And the user "Brian" should have information with these key and value pairs:
|
||||
| key | value |
|
||||
| mail | <emailAsResult> |
|
||||
Examples:
|
||||
| action description | newEmail | code | emailAsResult |
|
||||
| change to a valid email | newemail@example.com | 200 | newemail@example.com |
|
||||
| override existing mail | brian@example.com | 200 | brian@example.com |
|
||||
| two users with same mail | alice@example.org | 200 | alice@example.org |
|
||||
| empty mail | | 400 | brian@example.com |
|
||||
| change to a invalid email | invalidEmail | 400 | brian@example.com |
|
||||
|
||||
@skipOnStable2.0
|
||||
Scenario Outline: the admin user can edit another user's name
|
||||
Given user "Carol" has been created with default attributes and without skeleton files
|
||||
When the user "Alice" changes the user name of user "Carol" to "<userName>" using the Graph API
|
||||
Then the HTTP status code should be "<code>"
|
||||
And the user "<userNameAsResult>" should have information with these key and value pairs:
|
||||
| key | value |
|
||||
| onPremisesSamAccountName | <userNameAsResult> |
|
||||
Examples:
|
||||
| action description | userName | code | userNameAsResult |
|
||||
| change to a valid user name | Lionel | 200 | Lionel |
|
||||
| user name characters | *:!;_+-& | 200 | *:!;_+-& |
|
||||
| change to existing user name | Brian | 409 | Brian |
|
||||
| empty user name | | 400 | Brian |
|
||||
|
||||
@skipOnStable2.0
|
||||
Scenario: the admin user changes the name of a user to the name of an existing disabled user
|
||||
Given the user "Alice" has created a new user using the Graph API with the following settings:
|
||||
| userName | sam |
|
||||
| displayName | sam |
|
||||
| email | sam@example.com |
|
||||
| password | 1234 |
|
||||
And the user "Alice" has disabled user "Brian" using the Graph API
|
||||
When the user "Alice" changes the user name of user "sam" to "Brian" using the Graph API
|
||||
Then the HTTP status code should be "409"
|
||||
And the user "sam" should have information with these key and value pairs:
|
||||
| key | value |
|
||||
| onPremisesSamAccountName | sam |
|
||||
|
||||
@skipOnStable2.0
|
||||
Scenario: the admin user changes the name of a user to the name of a previously deleted user
|
||||
Given the user "Alice" has created a new user using the Graph API with the following settings:
|
||||
| userName | sam |
|
||||
| displayName | sam |
|
||||
| email | sam@example.com |
|
||||
| password | 1234 |
|
||||
And the user "Alice" has deleted a user "sam" using the Graph API
|
||||
When the user "Alice" changes the user name of user "Brian" to "sam" using the Graph API
|
||||
Then the HTTP status code should be "200"
|
||||
And the user "sam" should have information with these key and value pairs:
|
||||
| key | value |
|
||||
| onPremisesSamAccountName | sam |
|
||||
|
||||
|
||||
Scenario Outline: a normal user should not be able to change their email address
|
||||
Given the administrator has given "Brian" the role "<role>" using the settings api
|
||||
When the user "Brian" tries to change the email of user "Brian" to "newemail@example.com" using the Graph API
|
||||
Then the HTTP status code should be "401"
|
||||
And the user "Brian" should have information with these key and value pairs:
|
||||
| key | value |
|
||||
| mail | brian@example.com |
|
||||
Examples:
|
||||
| role |
|
||||
| Space Admin |
|
||||
| User |
|
||||
|
||||
|
||||
Scenario Outline: a normal user should not be able to edit another user's email
|
||||
Given the administrator has given "Brian" the role "<role>" using the settings api
|
||||
And the user "Alice" has created a new user using the Graph API with the following settings:
|
||||
| userName | Carol |
|
||||
| displayName | Carol King |
|
||||
| email | carol@example.com |
|
||||
| password | 1234 |
|
||||
When the user "Brian" tries to change the email of user "Carol" to "newemail@example.com" using the Graph API
|
||||
Then the HTTP status code should be "401"
|
||||
And the user "Carol" should have information with these key and value pairs:
|
||||
| key | value |
|
||||
| mail | carol@example.com |
|
||||
Examples:
|
||||
| role |
|
||||
| Space Admin |
|
||||
| User |
|
||||
|
||||
|
||||
Scenario Outline: the admin user can edit another user display name
|
||||
When the user "Alice" changes the display name of user "Brian" to "<newDisplayName>" using the Graph API
|
||||
Then the HTTP status code should be "200"
|
||||
And the user "Brian" should have information with these key and value pairs:
|
||||
| key | value |
|
||||
| displayName | <displayNameAsResult> |
|
||||
Examples:
|
||||
| action description | newDisplayName | code | displayNameAsResult |
|
||||
| change to a display name | Olaf Scholz | 200 | Olaf Scholz |
|
||||
| override to existing display name | Carol King | 200 | Carol King |
|
||||
| change to an empty display name | | 400 | Brian Murphy |
|
||||
| displayName with characters | *:!;_+-&#(?) | 200 | *:!;_+-&#(?) |
|
||||
|
||||
|
||||
Scenario Outline: a normal user should not be able to change his/her own display name
|
||||
Given the administrator has given "Brian" the role "<role>" using the settings api
|
||||
When the user "Brian" tries to change the display name of user "Brian" to "Brian Murphy" using the Graph API
|
||||
Then the HTTP status code should be "401"
|
||||
And the user "Alice" should have information with these key and value pairs:
|
||||
| key | value |
|
||||
| displayName | Alice Hansen |
|
||||
Examples:
|
||||
| role |
|
||||
| Space Admin |
|
||||
| User |
|
||||
|
||||
|
||||
Scenario Outline: a normal user should not be able to edit another user's display name
|
||||
Given the administrator has given "Brian" the role "<role>" using the settings api
|
||||
And the user "Alice" has created a new user using the Graph API with the following settings:
|
||||
| userName | Carol |
|
||||
| displayName | Carol King |
|
||||
| email | carol@example.com |
|
||||
| password | 1234 |
|
||||
When the user "Brian" tries to change the display name of user "Carol" to "Alice Hansen" using the Graph API
|
||||
Then the HTTP status code should be "401"
|
||||
And the user "Carol" should have information with these key and value pairs:
|
||||
| key | value |
|
||||
| displayName | Carol King |
|
||||
Examples:
|
||||
| role |
|
||||
| Space Admin |
|
||||
| User |
|
||||
|
||||
|
||||
Scenario: the admin user resets password of another user
|
||||
Given user "Brian" has uploaded file with content "test file for reset password" to "/resetpassword.txt"
|
||||
When the user "Alice" resets the password of user "Brian" to "newpassword" using the Graph API
|
||||
Then the HTTP status code should be "200"
|
||||
And the content of file "resetpassword.txt" for user "Brian" using password "newpassword" should be "test file for reset password"
|
||||
|
||||
|
||||
Scenario Outline: a normal user should not be able to reset the password of another user
|
||||
Given the administrator has given "Brian" the role "<role>" using the settings api
|
||||
And the user "Alice" has created a new user using the Graph API with the following settings:
|
||||
| userName | Carol |
|
||||
| displayName | Carol King |
|
||||
| email | carol@example.com |
|
||||
| password | 1234 |
|
||||
And user "Carol" has uploaded file with content "test file for reset password" to "/resetpassword.txt"
|
||||
When the user "Brian" resets the password of user "Carol" to "newpassword" using the Graph API
|
||||
Then the HTTP status code should be "401"
|
||||
And the content of file "resetpassword.txt" for user "Carol" using password "1234" should be "test file for reset password"
|
||||
But user "Carol" using password "newpassword" should not be able to download file "resetpassword.txt"
|
||||
Examples:
|
||||
| role |
|
||||
| Space Admin |
|
||||
| User |
|
||||
|
||||
@skipOnStable2.0
|
||||
Scenario: the admin user disables another user
|
||||
When the user "Alice" disables user "Brian" using the Graph API
|
||||
Then the HTTP status code should be "200"
|
||||
When user "Alice" gets information of user "Brian" using Graph API
|
||||
Then the HTTP status code should be "200"
|
||||
And the user retrieve API response should contain the following information:
|
||||
| displayName | id | mail | onPremisesSamAccountName | accountEnabled |
|
||||
| Brian Murphy | %uuid_v4% | brian@example.com | Brian | false |
|
||||
|
||||
@skipOnStable2.0
|
||||
Scenario Outline: a normal user should not be able to disable another user
|
||||
Given user "Carol" has been created with default attributes and without skeleton files
|
||||
And the administrator has given "Brian" the role "<role>" using the settings api
|
||||
When the user "Brian" tries to disable user "Carol" using the Graph API
|
||||
Then the HTTP status code should be "401"
|
||||
When user "Alice" gets information of user "Carol" using Graph API
|
||||
Then the HTTP status code should be "200"
|
||||
And the user retrieve API response should contain the following information:
|
||||
| displayName | id | mail | onPremisesSamAccountName | accountEnabled |
|
||||
| Carol King | %uuid_v4% | carol@example.org | Carol | true |
|
||||
Examples:
|
||||
| role |
|
||||
| Space Admin |
|
||||
| User |
|
||||
| Guest |
|
||||
|
||||
@skipOnStable2.0
|
||||
Scenario: the admin user enables disabled user
|
||||
Given the user "Alice" has disabled user "Brian" using the Graph API
|
||||
When the user "Alice" enables user "Brian" using the Graph API
|
||||
Then the HTTP status code should be "200"
|
||||
When user "Alice" gets information of user "Brian" using Graph API
|
||||
Then the HTTP status code should be "200"
|
||||
And the user retrieve API response should contain the following information:
|
||||
| displayName | id | mail | onPremisesSamAccountName | accountEnabled |
|
||||
| Brian Murphy | %uuid_v4% | brian@example.com | Brian | true |
|
||||
|
||||
@skipOnStable2.0
|
||||
Scenario Outline: a normal user should not be able to enable another user
|
||||
Given user "Carol" has been created with default attributes and without skeleton files
|
||||
And the user "Alice" has disabled user "Carol" using the Graph API
|
||||
And the administrator has given "Brian" the role "<role>" using the settings api
|
||||
When the user "Brian" tries to enable user "Carol" using the Graph API
|
||||
Then the HTTP status code should be "401"
|
||||
When user "Alice" gets information of user "Carol" using Graph API
|
||||
Then the HTTP status code should be "200"
|
||||
And the user retrieve API response should contain the following information:
|
||||
| displayName | id | mail | onPremisesSamAccountName | accountEnabled |
|
||||
| Carol King | %uuid_v4% | carol@example.org | Carol | false |
|
||||
Examples:
|
||||
| role |
|
||||
| Space Admin |
|
||||
| User |
|
||||
| Guest |
|
||||
@@ -0,0 +1,28 @@
|
||||
@api @skipOnOcV10 @skipOnStable2.0
|
||||
Feature: get applications
|
||||
As an user
|
||||
I want to be able to get applications information with existings roles
|
||||
|
||||
Background:
|
||||
Given user "Alice" has been created with default attributes and without skeleton files
|
||||
|
||||
|
||||
Scenario Outline: admin user lists all the groups
|
||||
Given the administrator has given "Alice" the role "<role>" using the settings api
|
||||
When user "Alice" gets all applications using the Graph API
|
||||
Then the HTTP status code should be "200"
|
||||
And the user retrieve API response should contain the following applications information:
|
||||
| key | value |
|
||||
| displayName | ownCloud Infinite Scale |
|
||||
| id | %uuid_v4% |
|
||||
And the user retrieve API response should contain the following app roles:
|
||||
| Admin |
|
||||
| Space Admin |
|
||||
| User |
|
||||
| Guest |
|
||||
Examples:
|
||||
| role |
|
||||
| Admin |
|
||||
| Space Admin |
|
||||
| User |
|
||||
| Guest |
|
||||
@@ -52,3 +52,120 @@ Feature: get groups and their members
|
||||
When user "Brian" gets all the members of group "tea-lover" using the Graph API
|
||||
Then the HTTP status code should be "401"
|
||||
And the last response should be an unauthorized response
|
||||
|
||||
|
||||
Scenario: admin user gets all groups along with its member's information
|
||||
Given these users have been created with default attributes and without skeleton files:
|
||||
| username |
|
||||
| Brian |
|
||||
| Carol |
|
||||
And group "tea-lover" has been created
|
||||
And group "coffee-lover" has been created
|
||||
And user "Alice" has been added to group "tea-lover"
|
||||
And user "Brian" has been added to group "coffee-lover"
|
||||
And user "Carol" has been added to group "tea-lover"
|
||||
When user "Alice" retrieves all groups along with their members using the Graph API
|
||||
Then the HTTP status code should be "200"
|
||||
And the group 'coffee-lover' should have the following member information
|
||||
| displayName | id | mail | onPremisesSamAccountName |
|
||||
| Brian Murphy | %uuid_v4% | brian@example.org | Brian |
|
||||
And the group 'tea-lover' should have the following member information
|
||||
| displayName | id | mail | onPremisesSamAccountName |
|
||||
| Alice Hansen | %uuid_v4% | alice@example.org | Alice |
|
||||
| Carol King | %uuid_v4% | carol@example.org | Carol |
|
||||
|
||||
|
||||
Scenario: normal user gets all groups along with their members information
|
||||
Given user "Brian" has been created with default attributes and without skeleton files
|
||||
And group "tea-lover" has been created
|
||||
And group "coffee-lover" has been created
|
||||
And user "Alice" has been added to group "tea-lover"
|
||||
And user "Brian" has been added to group "coffee-lover"
|
||||
When user "Brian" retrieves all groups along with their members using the Graph API
|
||||
Then the HTTP status code should be "401"
|
||||
And the last response should be an unauthorized response
|
||||
|
||||
|
||||
Scenario: admin user gets a group along with their members information
|
||||
Given user "Brian" has been created with default attributes and without skeleton files
|
||||
And group "tea-lover" has been created
|
||||
And user "Alice" has been added to group "tea-lover"
|
||||
And user "Brian" has been added to group "tea-lover"
|
||||
When user "Alice" gets all the members information of group "tea-lover" using the Graph API
|
||||
And the group 'tea-lover' should have the following member information
|
||||
| displayName | id | mail | onPremisesSamAccountName |
|
||||
| Alice Hansen | %uuid_v4% | alice@example.org | Alice |
|
||||
| Brian Murphy | %uuid_v4% | brian@example.org | Brian |
|
||||
|
||||
|
||||
Scenario: normal user gets a group along with their members information
|
||||
Given user "Brian" has been created with default attributes and without skeleton files
|
||||
And group "tea-lover" has been created
|
||||
And user "Alice" has been added to group "tea-lover"
|
||||
And user "Brian" has been added to group "tea-lover"
|
||||
When user "Brian" gets all the members information of group "tea-lover" using the Graph API
|
||||
Then the HTTP status code should be "401"
|
||||
And the last response should be an unauthorized response
|
||||
|
||||
|
||||
Scenario: Get details of a group
|
||||
Given group "tea-lover" has been created
|
||||
When user "Alice" gets details of the group "tea-lover" using the Graph API
|
||||
Then the HTTP status code should be "200"
|
||||
And the JSON data of the response should match
|
||||
"""
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"displayName",
|
||||
"id"
|
||||
],
|
||||
"properties": {
|
||||
"displayName": {
|
||||
"type": "string",
|
||||
"enum": ["tea-lover"]
|
||||
},
|
||||
"id": {
|
||||
"type": "string",
|
||||
"pattern": "^%group_id_pattern%$"
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
||||
|
||||
Scenario Outline: Get details of group with UTF-8 characters name
|
||||
Given group "<group>" has been created
|
||||
When user "Alice" gets details of the group "<group>" using the Graph API
|
||||
Then the HTTP status code should be "200"
|
||||
And the JSON data of the response should match
|
||||
"""
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"displayName",
|
||||
"id"
|
||||
],
|
||||
"properties": {
|
||||
"displayName": {
|
||||
"type": "string",
|
||||
"enum": ["<group>"]
|
||||
},
|
||||
"id": {
|
||||
"type": "string",
|
||||
"pattern": "^%group_id_pattern%$"
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
Examples:
|
||||
| group |
|
||||
| España§àôœ€ |
|
||||
| नेपाली |
|
||||
| $x<=>[y*z^2+1]! |
|
||||
| եòɴԪ˯ΗՐΛɔπ |
|
||||
|
||||
|
||||
Scenario: admin user tries to get group information of non-existing group
|
||||
When user "Alice" gets details of the group "non-existing" using the Graph API
|
||||
Then the HTTP status code should be "404"
|
||||
@@ -0,0 +1,187 @@
|
||||
@api @skipOnOcV10
|
||||
Feature: get users
|
||||
As an admin
|
||||
I want to be able to retrieve user information
|
||||
So that I can see the information
|
||||
|
||||
Background:
|
||||
Given these users have been created with default attributes and without skeleton files:
|
||||
| username |
|
||||
| Alice |
|
||||
| Brian |
|
||||
And the administrator has given "Alice" the role "Admin" using the settings api
|
||||
|
||||
@skipOnStable2.0
|
||||
Scenario: admin user gets the information of a user
|
||||
When user "Alice" gets information of user "Brian" using Graph API
|
||||
Then the HTTP status code should be "200"
|
||||
And the user retrieve API response should contain the following information:
|
||||
| displayName | id | mail | onPremisesSamAccountName | accountEnabled |
|
||||
| Brian Murphy | %uuid_v4% | brian@example.org | Brian | true |
|
||||
|
||||
|
||||
Scenario: non-admin user tries to get the information of a user
|
||||
When user "Brian" tries to get information of user "Alice" using Graph API
|
||||
Then the HTTP status code should be "401"
|
||||
And the last response should be an unauthorized response
|
||||
|
||||
@skipOnStable2.0
|
||||
Scenario: admin user gets all users
|
||||
When user "Alice" gets all users using the Graph API
|
||||
Then the HTTP status code should be "200"
|
||||
And the API response should contain following users with the information:
|
||||
| displayName | id | mail | onPremisesSamAccountName | accountEnabled |
|
||||
| Alice Hansen | %uuid_v4% | alice@example.org | Alice | true |
|
||||
| Brian Murphy | %uuid_v4% | brian@example.org | Brian | true |
|
||||
|
||||
@skipOnStable2.0
|
||||
Scenario: admin user gets all users include disabled users
|
||||
Given the user "Alice" has disabled user "Brian" using the Graph API
|
||||
When user "Alice" gets all users using the Graph API
|
||||
Then the HTTP status code should be "200"
|
||||
And the API response should contain following users with the information:
|
||||
| displayName | id | mail | onPremisesSamAccountName | accountEnabled |
|
||||
| Alice Hansen | %uuid_v4% | alice@example.org | Alice | true |
|
||||
| Brian Murphy | %uuid_v4% | brian@example.org | Brian | false |
|
||||
|
||||
|
||||
Scenario: non-admin user tries to get all users
|
||||
When user "Brian" tries to get all users using the Graph API
|
||||
Then the HTTP status code should be "401"
|
||||
And the last response should be an unauthorized response
|
||||
|
||||
@skipOnStable2.0
|
||||
Scenario: admin user gets the drive information of a user
|
||||
When the user "Alice" gets user "Brian" along with his drive information using Graph API
|
||||
Then the HTTP status code should be "200"
|
||||
And the user retrieve API response should contain the following information:
|
||||
| displayName | id | mail | onPremisesSamAccountName | accountEnabled |
|
||||
| Brian Murphy | %uuid_v4% | brian@example.org | Brian | true |
|
||||
And the user retrieve API response should contain the following drive information:
|
||||
| driveType | personal |
|
||||
| driveAlias | personal/brian |
|
||||
| id | %space_id% |
|
||||
| name | Brian Murphy |
|
||||
| owner@@@user@@@id | %user_id% |
|
||||
| quota@@@state | normal |
|
||||
| root@@@id | %space_id% |
|
||||
| root@@@webDavUrl | %base_url%/dav/spaces/%space_id% |
|
||||
| webUrl | %base_url%/f/%space_id% |
|
||||
|
||||
@skipOnStable2.0
|
||||
Scenario: normal user gets his/her own drive information
|
||||
When the user "Brian" gets his drive information using Graph API
|
||||
Then the HTTP status code should be "200"
|
||||
And the user retrieve API response should contain the following information:
|
||||
| displayName | id | mail | onPremisesSamAccountName | accountEnabled |
|
||||
| Brian Murphy | %uuid_v4% | brian@example.org | Brian | true |
|
||||
And the user retrieve API response should contain the following drive information:
|
||||
| driveType | personal |
|
||||
| driveAlias | personal/brian |
|
||||
| id | %space_id% |
|
||||
| name | Brian Murphy |
|
||||
| owner@@@user@@@id | %user_id% |
|
||||
| quota@@@state | normal |
|
||||
| root@@@id | %space_id% |
|
||||
| root@@@webDavUrl | %base_url%/dav/spaces/%space_id% |
|
||||
| webUrl | %base_url%/f/%space_id% |
|
||||
|
||||
@skipOnStable2.0
|
||||
Scenario: admin user gets the group information of a user
|
||||
Given group "tea-lover" has been created
|
||||
And group "coffee-lover" has been created
|
||||
And user "Brian" has been added to group "tea-lover"
|
||||
And user "Brian" has been added to group "coffee-lover"
|
||||
When the user "Alice" gets user "Brian" along with his group information using Graph API
|
||||
Then the HTTP status code should be "200"
|
||||
And the user retrieve API response should contain the following information:
|
||||
| displayName | id | mail | onPremisesSamAccountName | accountEnabled | memberOf |
|
||||
| Brian Murphy | %uuid_v4% | brian@example.org | Brian | true | tea-lover, coffee-lover |
|
||||
|
||||
|
||||
Scenario: non-admin user tries to get the group information of a user
|
||||
Given user "Carol" has been created with default attributes and without skeleton files
|
||||
And group "coffee-lover" has been created
|
||||
And user "Brian" has been added to group "coffee-lover"
|
||||
When the user "Carol" gets user "Brian" along with his group information using Graph API
|
||||
Then the HTTP status code should be "401"
|
||||
And the last response should be an unauthorized response
|
||||
|
||||
@skipOnStable2.0
|
||||
Scenario: admin user gets all users of certain groups
|
||||
Given user "Carol" has been created with default attributes and without skeleton files
|
||||
And the user "Alice" has disabled user "Carol" using the Graph API
|
||||
And group "tea-lover" has been created
|
||||
And group "coffee-lover" has been created
|
||||
And user "Alice" has been added to group "tea-lover"
|
||||
And user "Brian" has been added to group "tea-lover"
|
||||
And user "Brian" has been added to group "coffee-lover"
|
||||
When the user "Alice" gets all users of the group "tea-lover" using the Graph API
|
||||
Then the HTTP status code should be "200"
|
||||
And the API response should contain following users with the information:
|
||||
| displayName | id | mail | onPremisesSamAccountName | accountEnabled |
|
||||
| Alice Hansen | %uuid_v4% | alice@example.org | Alice | true |
|
||||
| Brian Murphy | %uuid_v4% | brian@example.org | Brian | true |
|
||||
But the API response should not contain following user with the information:
|
||||
| displayName | id | mail | onPremisesSamAccountName | accountEnabled |
|
||||
| Carol King | %uuid_v4% | carol@example.org | Carol | false |
|
||||
When the user "Alice" gets all users of two groups "tea-lover,coffee-lover" using the Graph API
|
||||
Then the HTTP status code should be "200"
|
||||
And the API response should contain following user with the information:
|
||||
| displayName | id | mail | onPremisesSamAccountName | accountEnabled |
|
||||
| Brian Murphy | %uuid_v4% | brian@example.org | Brian | true |
|
||||
But the API response should not contain following users with the information:
|
||||
| displayName | id | mail | onPremisesSamAccountName | accountEnabled |
|
||||
| Alice Hansen | %uuid_v4% | alice@example.org | Alice | true |
|
||||
| Carol King | %uuid_v4% | carol@example.org | Carol | true |
|
||||
|
||||
|
||||
Scenario Outline: non admin user tries to get users of certain groups
|
||||
Given the administrator has given "Brian" the role "<role>" using the settings api
|
||||
And group "tea-lover" has been created
|
||||
And user "Alice" has been added to group "tea-lover"
|
||||
When the user "Brian" gets all users of the group "tea-lover" using the Graph API
|
||||
Then the HTTP status code should be "401"
|
||||
And the last response should be an unauthorized response
|
||||
Examples:
|
||||
| role |
|
||||
| Space Admin |
|
||||
| User |
|
||||
| Guest |
|
||||
|
||||
@skipOnStable2.0
|
||||
Scenario: admin user gets all users with certain roles and members of a certain group
|
||||
Given user "Carol" has been created with default attributes and without skeleton files
|
||||
And the administrator has given "Brian" the role "Space Admin" using the settings api
|
||||
And the administrator has given "Carol" the role "Space Admin" using the settings api
|
||||
And group "tea-lover" has been created
|
||||
And user "Brian" has been added to group "tea-lover"
|
||||
When the user "Alice" gets all users with role "Space Admin" using the Graph API
|
||||
Then the HTTP status code should be "200"
|
||||
And the API response should contain following users with the information:
|
||||
| displayName | id | mail | onPremisesSamAccountName | accountEnabled |
|
||||
| Brian Murphy | %uuid_v4% | brian@example.org | Brian | true |
|
||||
| Carol King | %uuid_v4% | carol@example.org | Carol | true |
|
||||
But the API response should not contain following user with the information:
|
||||
| displayName | id | mail | onPremisesSamAccountName |
|
||||
| Alice Hansen | %uuid_v4% | alice@example.org | Alice |
|
||||
When the user "Alice" gets all users with role "Space Admin" and member of the group "tea-lover" using the Graph API
|
||||
Then the HTTP status code should be "200"
|
||||
And the API response should contain following users with the information:
|
||||
| displayName | id | mail | onPremisesSamAccountName | accountEnabled |
|
||||
| Brian Murphy | %uuid_v4% | brian@example.org | Brian | true |
|
||||
But the API response should not contain following user with the information:
|
||||
| displayName | id | mail | onPremisesSamAccountName | accountEnabled |
|
||||
| Carol King | %uuid_v4% | carol@example.org | Carol | true |
|
||||
|
||||
@skipOnStable2.0
|
||||
Scenario Outline: non-admin user tries to get users with a certain role
|
||||
Given the administrator has given "Brian" the role "<role>" using the settings api
|
||||
When the user "Brian" gets all users with role "Admin" using the Graph API
|
||||
Then the HTTP status code should be "401"
|
||||
And the last response should be an unauthorized response
|
||||
Examples:
|
||||
| role |
|
||||
| Space Admin |
|
||||
| User |
|
||||
| Guest |
|
||||
@@ -152,8 +152,8 @@ Feature: remove a user from a group
|
||||
| Alice | var/../etc |
|
||||
|
||||
|
||||
Scenario: admin tries to remove a user from a non-existing group
|
||||
When the administrator tries to remove user "Alice" from group "nonexistentgroup" using the Graph API
|
||||
Scenario: admin tries to remove a user from a nonexistent group
|
||||
When the administrator tries to remove user "Alice" from a nonexistent group using the Graph API
|
||||
Then the HTTP status code should be "404"
|
||||
|
||||
|
||||
@@ -166,3 +166,21 @@ Feature: remove a user from a group
|
||||
Then the HTTP status code should be "401"
|
||||
And the last response should be an unauthorized response
|
||||
And user "Brian" should belong to group "grp1"
|
||||
|
||||
|
||||
|
||||
Scenario: admin removes a disabled user from a group
|
||||
Given these groups have been created:
|
||||
| groupname | comment |
|
||||
| brand-new-group | nothing special here |
|
||||
And the following users have been added to the following groups
|
||||
| username | groupname |
|
||||
| Alice | brand-new-group |
|
||||
And the user "Admin" has disabled user "Alice" using the Graph API
|
||||
When the administrator removes the following users from the following groups using the Graph API
|
||||
| username | groupname |
|
||||
| Alice | brand-new-group |
|
||||
Then the HTTP status code of responses on all endpoints should be "204"
|
||||
And the following users should not belong to the following groups
|
||||
| username | groupname |
|
||||
| Alice | brand-new-group |
|
||||
@@ -14,18 +14,38 @@ Feature: Change data of space
|
||||
| Bob |
|
||||
And the administrator has given "Alice" the role "Space Admin" using the settings api
|
||||
And user "Alice" has created a space "Project Jupiter" of type "project" with quota "20"
|
||||
And user "Alice" has shared a space "Project Jupiter" to user "Brian" with role "editor"
|
||||
And user "Alice" has shared a space "Project Jupiter" to user "Bob" with role "viewer"
|
||||
And user "Alice" has shared a space "Project Jupiter" with settings:
|
||||
| shareWith | Brian |
|
||||
| role | editor |
|
||||
And user "Alice" has shared a space "Project Jupiter" with settings:
|
||||
| shareWith | Bob |
|
||||
| role | viewer |
|
||||
And using spaces DAV path
|
||||
|
||||
|
||||
Scenario Outline: Only space admin user can change the name of a Space via the Graph API
|
||||
When user "<user>" changes the name of the "Project Jupiter" space to "Project Death Star"
|
||||
When user "<user>" changes the name of the "Project Jupiter" space to "<expectedName>"
|
||||
Then the HTTP status code should be "<code>"
|
||||
And the user "<user>" should have a space called "<expectedName>" with these key and value pairs:
|
||||
| key | value |
|
||||
| driveType | project |
|
||||
| name | <expectedName> |
|
||||
And for user "<user>" the JSON response should contain space called "<expectedName>" and match
|
||||
"""
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name",
|
||||
"driveType"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"enum": ["<expectedName>"]
|
||||
},
|
||||
"driveType": {
|
||||
"type": "string",
|
||||
"enum": ["project"]
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
Examples:
|
||||
| user | code | expectedName |
|
||||
| Alice | 200 | Project Death Star |
|
||||
@@ -36,11 +56,31 @@ Feature: Change data of space
|
||||
Scenario: Only space admin user can change the description(subtitle) of a Space via the Graph API
|
||||
When user "Alice" changes the description of the "Project Jupiter" space to "The Death Star is a fictional mobile space station"
|
||||
Then the HTTP status code should be "200"
|
||||
And the user "Alice" should have a space called "Project Jupiter" with these key and value pairs:
|
||||
| key | value |
|
||||
| driveType | project |
|
||||
| name | Project Jupiter |
|
||||
| description | The Death Star is a fictional mobile space station |
|
||||
And for user "Alice" the JSON response should contain space called "Project Jupiter" and match
|
||||
"""
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name",
|
||||
"driveType",
|
||||
"description"
|
||||
],
|
||||
"properties": {
|
||||
"driveType": {
|
||||
"type": "string",
|
||||
"enum": ["project"]
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"enum": ["Project Jupiter"]
|
||||
},
|
||||
"description": {
|
||||
"type": "string",
|
||||
"enum": ["The Death Star is a fictional mobile space station"]
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
||||
|
||||
Scenario Outline: Viewer and editor cannot change the description(subtitle) of a Space via the Graph API
|
||||
@@ -55,10 +95,35 @@ Feature: Change data of space
|
||||
Scenario Outline: An user tries to increase the quota of a Space via the Graph API
|
||||
When user "<user>" changes the quota of the "Project Jupiter" space to "100"
|
||||
Then the HTTP status code should be "<code>"
|
||||
And the user "<user>" should have a space called "Project Jupiter" with these key and value pairs:
|
||||
| key | value |
|
||||
| name | Project Jupiter |
|
||||
| quota@@@total | <expectedQuataValue> |
|
||||
And for user "<user>" the JSON response should contain space called "Project Jupiter" and match
|
||||
|
||||
"""
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name",
|
||||
"quota"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"enum": ["Project Jupiter"]
|
||||
},
|
||||
"quota": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"total"
|
||||
],
|
||||
"properties": {
|
||||
"total" : {
|
||||
"type": "number",
|
||||
"enum": [<expectedQuataValue>]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
Examples:
|
||||
| user | code | expectedQuataValue |
|
||||
| Alice | 200 | 100 |
|
||||
@@ -71,10 +136,34 @@ Feature: Change data of space
|
||||
Then the HTTP status code should be "200"
|
||||
When user "Alice" uploads a file inside space "Project Jupiter" with content "some content" to "file.txt" using the WebDAV API
|
||||
Then the HTTP status code should be "201"
|
||||
And the user "Alice" should have a space called "Project Jupiter" with these key and value pairs:
|
||||
| key | value |
|
||||
| name | Project Jupiter |
|
||||
| quota@@@used | 12 |
|
||||
And for user "Alice" the JSON response should contain space called "Project Jupiter" and match
|
||||
"""
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name",
|
||||
"quota"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"enum": ["Project Jupiter"]
|
||||
},
|
||||
"quota": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"used"
|
||||
],
|
||||
"properties": {
|
||||
"used" : {
|
||||
"type": "number",
|
||||
"enum": [12]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
Examples:
|
||||
| quotaValue |
|
||||
| 0 |
|
||||
@@ -86,15 +175,78 @@ Feature: Change data of space
|
||||
And user "Alice" has uploaded a file inside space "Project Jupiter" with content "space description" to ".space/readme.md"
|
||||
When user "Alice" sets the file ".space/readme.md" as a description in a special section of the "Project Jupiter" space
|
||||
Then the HTTP status code should be "200"
|
||||
And the user "Alice" should have a space called "Project Jupiter" owned by "Alice" with description file ".space/readme.md" with these key and value pairs:
|
||||
| key | value |
|
||||
| name | Project Jupiter |
|
||||
| special@@@0@@@size | 17 |
|
||||
| special@@@0@@@name | readme.md |
|
||||
| special@@@0@@@specialFolder@@@name | readme |
|
||||
| special@@@0@@@file@@@mimeType | text/markdown |
|
||||
| special@@@0@@@id | %file_id% |
|
||||
| special@@@0@@@eTag | %eTag% |
|
||||
And for user "Alice" the JSON response should contain space called "Project Jupiter" owned by "Alice" with description file ".space/readme.md" and match
|
||||
"""
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name",
|
||||
"special"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"enum": ["Project Jupiter"]
|
||||
},
|
||||
"special": {
|
||||
"type": "array",
|
||||
"items": [
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"size",
|
||||
"name",
|
||||
"specialFolder",
|
||||
"file",
|
||||
"id",
|
||||
"eTag"
|
||||
],
|
||||
"properties": {
|
||||
"size": {
|
||||
"type": "number",
|
||||
"enum": [17]
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"enum": ["readme.md"]
|
||||
},
|
||||
"specialFolder": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"enum": ["readme"]
|
||||
}
|
||||
}
|
||||
},
|
||||
"file": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"mimeType"
|
||||
],
|
||||
"properties": {
|
||||
"type": "string",
|
||||
"enum": ["text/markdown"]
|
||||
}
|
||||
},
|
||||
"id": {
|
||||
"type": "string",
|
||||
"enum": ["%file_id%"]
|
||||
},
|
||||
"tag": {
|
||||
"type": "string",
|
||||
"enum": ["%eTag%"]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
And for user "Alice" folder ".space/" of the space "Project Jupiter" should contain these entries:
|
||||
| readme.md |
|
||||
And for user "Alice" the content of the file ".space/readme.md" of the space "Project Jupiter" should be "space description"
|
||||
@@ -106,15 +258,78 @@ Feature: Change data of space
|
||||
And user "Alice" has set the file ".space/readme.md" as a description in a special section of the "Project Jupiter" space
|
||||
When user "<user>" uploads a file inside space "Project Jupiter" with content "new description" to ".space/readme.md" using the WebDAV API
|
||||
Then the HTTP status code should be "<code>"
|
||||
And the user "<user>" should have a space called "Project Jupiter" owned by "Alice" with description file ".space/readme.md" with these key and value pairs:
|
||||
| key | value |
|
||||
| name | Project Jupiter |
|
||||
| special@@@0@@@size | <size> |
|
||||
| special@@@0@@@name | readme.md |
|
||||
| special@@@0@@@specialFolder@@@name | readme |
|
||||
| special@@@0@@@file@@@mimeType | text/markdown |
|
||||
| special@@@0@@@id | %file_id% |
|
||||
| special@@@0@@@eTag | %eTag% |
|
||||
And for user "Alice" the JSON response should contain space called "Project Jupiter" owned by "Alice" with description file ".space/readme.md" and match
|
||||
"""
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name",
|
||||
"special"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"enum": ["Project Jupiter"]
|
||||
},
|
||||
"special": {
|
||||
"type": "array",
|
||||
"items": [
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"size",
|
||||
"name",
|
||||
"specialFolder",
|
||||
"file",
|
||||
"id",
|
||||
"eTag"
|
||||
],
|
||||
"properties": {
|
||||
"size": {
|
||||
"type": "number",
|
||||
"enum": [<size>]
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"enum": ["readme.md"]
|
||||
},
|
||||
"specialFolder": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"enum": ["readme"]
|
||||
}
|
||||
}
|
||||
},
|
||||
"file": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"mimeType"
|
||||
],
|
||||
"properties": {
|
||||
"type": "string",
|
||||
"enum": ["text/markdown"]
|
||||
}
|
||||
},
|
||||
"id": {
|
||||
"type": "string",
|
||||
"enum": ["%file_id%"]
|
||||
},
|
||||
"tag": {
|
||||
"type": "string",
|
||||
"enum": ["%eTag%"]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
And for user "<user>" folder ".space/" of the space "Project Jupiter" should contain these entries:
|
||||
| readme.md |
|
||||
And for user "<user>" the content of the file ".space/readme.md" of the space "Project Jupiter" should be "<content>"
|
||||
@@ -129,15 +344,78 @@ Feature: Change data of space
|
||||
And user "<user>" has uploaded a file inside space "Project Jupiter" with content "" to ".space/<fileName>"
|
||||
When user "<user>" sets the file ".space/<fileName>" as a space image in a special section of the "Project Jupiter" space
|
||||
Then the HTTP status code should be "200"
|
||||
And the user "Alice" should have a space called "Project Jupiter" owned by "Alice" with description file ".space/<fileName>" with these key and value pairs:
|
||||
| key | value |
|
||||
| name | Project Jupiter |
|
||||
| special@@@0@@@size | 0 |
|
||||
| special@@@0@@@name | <nameInResponse> |
|
||||
| special@@@0@@@specialFolder@@@name | image |
|
||||
| special@@@0@@@file@@@mimeType | <mimeType> |
|
||||
| special@@@0@@@id | %file_id% |
|
||||
| special@@@0@@@eTag | %eTag% |
|
||||
And for user "Alice" the JSON response should contain space called "Project Jupiter" owned by "Alice" with description file ".space/<fileName>" and match
|
||||
"""
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name",
|
||||
"special"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"enum": ["Project Jupiter"]
|
||||
},
|
||||
"special": {
|
||||
"type": "array",
|
||||
"items": [
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"size",
|
||||
"name",
|
||||
"specialFolder",
|
||||
"file",
|
||||
"id",
|
||||
"eTag"
|
||||
],
|
||||
"properties": {
|
||||
"size": {
|
||||
"type": "number",
|
||||
"enum": [0]
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"enum": ["<nameInResponse>"]
|
||||
},
|
||||
"specialFolder": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"enum": ["image"]
|
||||
}
|
||||
}
|
||||
},
|
||||
"file": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"mimeType"
|
||||
],
|
||||
"properties": {
|
||||
"type": "string",
|
||||
"enum": ["<mimeType>"]
|
||||
}
|
||||
},
|
||||
"id": {
|
||||
"type": "string",
|
||||
"enum": ["%file_id%"]
|
||||
},
|
||||
"tag": {
|
||||
"type": "string",
|
||||
"enum": ["%eTag%"]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
And for user "<user>" folder ".space/" of the space "Project Jupiter" should contain these entries:
|
||||
| <fileName> |
|
||||
Examples:
|
||||
@@ -146,7 +424,6 @@ Feature: Change data of space
|
||||
| Brian | spaceImage.png | spaceImage.png | image/png |
|
||||
| Alice | spaceImage.gif | spaceImage.gif | image/gif |
|
||||
|
||||
|
||||
Scenario: An user viewer cannot set image file as space image of the space via the Graph API
|
||||
Given user "Alice" has created a folder ".space" in space "Project Jupiter"
|
||||
And user "Alice" has uploaded a file inside space "Project Jupiter" with content "" to ".space/someImageFile.jpg"
|
||||
@@ -161,15 +438,78 @@ Feature: Change data of space
|
||||
When user "<user>" uploads a file inside space "Project Jupiter" owned by the user "Alice" with content "new content" to ".space/readme.md" using the WebDAV API
|
||||
Then the HTTP status code should be "<code>"
|
||||
And for user "<user>" the content of the file ".space/readme.md" of the space "Project Jupiter" should be "<expectedContent>"
|
||||
And the user "<user>" should have a space called "Project Jupiter" owned by "Alice" with description file ".space/readme.md" with these key and value pairs:
|
||||
| key | value |
|
||||
| name | Project Jupiter |
|
||||
| special@@@0@@@size | <expectedSize> |
|
||||
| special@@@0@@@name | readme.md |
|
||||
| special@@@0@@@specialFolder@@@name | readme |
|
||||
| special@@@0@@@file@@@mimeType | text/markdown |
|
||||
| special@@@0@@@id | %file_id% |
|
||||
| special@@@0@@@eTag | %eTag% |
|
||||
And for user "<user>" the JSON response should contain space called "Project Jupiter" owned by "Alice" with description file ".space/readme.md" and match
|
||||
"""
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name",
|
||||
"special"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"enum": ["Project Jupiter"]
|
||||
},
|
||||
"special": {
|
||||
"type": "array",
|
||||
"items": [
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"size",
|
||||
"name",
|
||||
"specialFolder",
|
||||
"file",
|
||||
"id",
|
||||
"eTag"
|
||||
],
|
||||
"properties": {
|
||||
"size": {
|
||||
"type": "number",
|
||||
"enum": [<expectedSize>]
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"enum": ["readme.md"]
|
||||
},
|
||||
"specialFolder": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"enum": ["readme"]
|
||||
}
|
||||
}
|
||||
},
|
||||
"file": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"mimeType"
|
||||
],
|
||||
"properties": {
|
||||
"type": "string",
|
||||
"enum": ["text/markdown"]
|
||||
}
|
||||
},
|
||||
"id": {
|
||||
"type": "string",
|
||||
"enum": ["%file_id%"]
|
||||
},
|
||||
"tag": {
|
||||
"type": "string",
|
||||
"enum": ["%eTag%"]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
Examples:
|
||||
| user | code | expectedSize | expectedContent |
|
||||
| Alice | 204 | 11 | new content |
|
||||
@@ -184,15 +524,78 @@ Feature: Change data of space
|
||||
When user "<user>" has uploaded a file inside space "Project Jupiter" with content "" to ".space/newSpaceImage.png"
|
||||
And user "<user>" sets the file ".space/newSpaceImage.png" as a space image in a special section of the "Project Jupiter" space
|
||||
Then the HTTP status code should be "200"
|
||||
And the user "<user>" should have a space called "Project Jupiter" owned by "Alice" with space image ".space/newSpaceImage.png" with these key and value pairs:
|
||||
| key | value |
|
||||
| name | Project Jupiter |
|
||||
| special@@@0@@@size | 0 |
|
||||
| special@@@0@@@name | newSpaceImage.png |
|
||||
| special@@@0@@@specialFolder@@@name | image |
|
||||
| special@@@0@@@file@@@mimeType | image/png |
|
||||
| special@@@0@@@id | %file_id% |
|
||||
| special@@@0@@@eTag | %eTag% |
|
||||
And for user "<user>" the JSON response should contain space called "Project Jupiter" owned by "Alice" with description file ".space/newSpaceImage.png" and match
|
||||
"""
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name",
|
||||
"special"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"enum": ["Project Jupiter"]
|
||||
},
|
||||
"special": {
|
||||
"type": "array",
|
||||
"items": [
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"size",
|
||||
"name",
|
||||
"specialFolder",
|
||||
"file",
|
||||
"id",
|
||||
"eTag"
|
||||
],
|
||||
"properties": {
|
||||
"size": {
|
||||
"type": "number",
|
||||
"enum": [0]
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"enum": ["newSpaceImage.png"]
|
||||
},
|
||||
"specialFolder": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"enum": ["image"]
|
||||
}
|
||||
}
|
||||
},
|
||||
"file": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"mimeType"
|
||||
],
|
||||
"properties": {
|
||||
"type": "string",
|
||||
"enum": ["image/png"]
|
||||
}
|
||||
},
|
||||
"id": {
|
||||
"type": "string",
|
||||
"enum": ["%file_id%"]
|
||||
},
|
||||
"tag": {
|
||||
"type": "string",
|
||||
"enum": ["%eTag%"]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
Examples:
|
||||
| user |
|
||||
| Alice |
|
||||
@@ -223,3 +626,22 @@ Feature: Change data of space
|
||||
| 10000 | between "201" and "204" |
|
||||
| 0 | between "201" and "204" |
|
||||
| -1 | between "201" and "204" |
|
||||
|
||||
|
||||
Scenario: user sends invalid space uuid via the Graph API
|
||||
When user "Admin" tries to change the name of the "non-existing" space to "new name"
|
||||
Then the HTTP status code should be "404"
|
||||
When user "Admin" tries to change the quota of the "non-existing" space to "10"
|
||||
Then the HTTP status code should be "404"
|
||||
When user "Alice" tries to change the description of the "non-existing" space to "new description"
|
||||
Then the HTTP status code should be "404"
|
||||
|
||||
|
||||
Scenario: user sends PATCH request to other user's space that they don't have access to
|
||||
Given these users have been created with default attributes and without skeleton files:
|
||||
| username |
|
||||
| Carol |
|
||||
When user "Carol" sends PATCH request to the space "Personal" of user "Alice" with data "{}"
|
||||
Then the HTTP status code should be "404"
|
||||
When user "Carol" sends PATCH request to the space "Project Jupiter" of user "Alice" with data "{}"
|
||||
Then the HTTP status code should be "404"
|
||||
@@ -15,17 +15,53 @@ Feature: Disabling and deleting space
|
||||
| Bob |
|
||||
And the administrator has given "Alice" the role "Space Admin" using the settings api
|
||||
And user "Alice" has created a space "Project Moon" with the default quota using the GraphApi
|
||||
And user "Alice" has shared a space "Project Moon" to user "Brian" with role "editor"
|
||||
And user "Alice" has shared a space "Project Moon" to user "Bob" with role "viewer"
|
||||
And user "Alice" has shared a space "Project Moon" with settings:
|
||||
| shareWith | Brian |
|
||||
| role | editor |
|
||||
And user "Alice" has shared a space "Project Moon" with settings:
|
||||
| shareWith | Bob |
|
||||
| role | viewer |
|
||||
|
||||
|
||||
Scenario Outline: A space admin user can disable a Space via the Graph API
|
||||
When user "Alice" disables a space "Project Moon"
|
||||
Then the HTTP status code should be "204"
|
||||
And the user "Alice" should have a space called "Project Moon" with these key and value pairs:
|
||||
| key | value |
|
||||
| name | Project Moon |
|
||||
| root@@@deleted@@@state | trashed |
|
||||
And for user "Alice" the JSON response should contain space called "Project Moon" and match
|
||||
"""
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name",
|
||||
"root"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"enum": ["Project Moon"]
|
||||
},
|
||||
"root": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"deleted"
|
||||
],
|
||||
"properties": {
|
||||
"deleted": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"state"
|
||||
],
|
||||
"properties": {
|
||||
"state": {
|
||||
"type": "string",
|
||||
"enum": ["trashed"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
And the user "<user>" should not have a space called "Project Moon"
|
||||
Examples:
|
||||
| user |
|
||||
@@ -36,9 +72,21 @@ Feature: Disabling and deleting space
|
||||
Scenario Outline: An user without space admin role cannot disable a Space via the Graph API
|
||||
When user "<user>" disables a space "Project Moon"
|
||||
Then the HTTP status code should be "403"
|
||||
And the user "<user>" should have a space called "Project Moon" with these key and value pairs:
|
||||
| key | value |
|
||||
| name | Project Moon |
|
||||
And for user "<user>" the JSON response should contain space called "Project Moon" and match
|
||||
"""
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"enum": ["Project Moon"]
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
Examples:
|
||||
| user |
|
||||
| Brian |
|
||||
@@ -65,6 +113,18 @@ Feature: Disabling and deleting space
|
||||
Scenario: An space manager cannot delete a space via the webDav API without first disabling it
|
||||
When user "Alice" deletes a space "Project Moon"
|
||||
Then the HTTP status code should be "400"
|
||||
And the user "Alice" should have a space called "Project Moon" with these key and value pairs:
|
||||
| key | value |
|
||||
| name | Project Moon |
|
||||
And for user "Alice" the JSON response should contain space called "Project Moon" and match
|
||||
"""
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"enum": ["Project Moon"]
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
@@ -1,52 +1,56 @@
|
||||
@api @skipOnOcV10
|
||||
Feature: Download file in project space
|
||||
As a user with different role, I want to be able to download files
|
||||
As a user with different role, I want to be able to download files
|
||||
|
||||
Note - this feature is run in CI with ACCOUNTS_HASH_DIFFICULTY set to the default for production
|
||||
See https://github.com/owncloud/ocis/issues/1542 and https://github.com/owncloud/ocis/pull/839
|
||||
Note - this feature is run in CI with ACCOUNTS_HASH_DIFFICULTY set to the default for production
|
||||
See https://github.com/owncloud/ocis/issues/1542 and https://github.com/owncloud/ocis/pull/839
|
||||
|
||||
Background:
|
||||
Given these users have been created with default attributes and without skeleton files:
|
||||
| username |
|
||||
| Alice |
|
||||
| Brian |
|
||||
| Bob |
|
||||
And using spaces DAV path
|
||||
And the administrator has given "Alice" the role "Space Admin" using the settings api
|
||||
And user "Alice" has created a space "download file" with the default quota using the GraphApi
|
||||
And user "Alice" has uploaded a file inside space "download file" with content "some content" to "file.txt"
|
||||
And user "Alice" has shared a space "download file" to user "Brian" with role "editor"
|
||||
And user "Alice" has shared a space "download file" to user "Bob" with role "viewer"
|
||||
Background:
|
||||
Given these users have been created with default attributes and without skeleton files:
|
||||
| username |
|
||||
| Alice |
|
||||
| Brian |
|
||||
| Bob |
|
||||
And using spaces DAV path
|
||||
And the administrator has given "Alice" the role "Space Admin" using the settings api
|
||||
And user "Alice" has created a space "download file" with the default quota using the GraphApi
|
||||
And user "Alice" has uploaded a file inside space "download file" with content "some content" to "file.txt"
|
||||
And user "Alice" has shared a space "download file" with settings:
|
||||
| shareWith | Brian |
|
||||
| role | editor |
|
||||
And user "Alice" has shared a space "download file" with settings:
|
||||
| shareWith | Bob |
|
||||
| role | viewer |
|
||||
|
||||
|
||||
Scenario Outline: An user downloads a file in the project space
|
||||
When user "<user>" downloads the file "file.txt" of the space "download file" using the WebDAV API
|
||||
Then the HTTP status code should be "200"
|
||||
And the following headers should be set
|
||||
| header | value |
|
||||
| Content-Length | 12 |
|
||||
Examples:
|
||||
| user |
|
||||
| Alice |
|
||||
| Brian |
|
||||
| Bob |
|
||||
Scenario Outline: An user downloads a file in the project space
|
||||
When user "<user>" downloads the file "file.txt" of the space "download file" using the WebDAV API
|
||||
Then the HTTP status code should be "200"
|
||||
And the following headers should be set
|
||||
| header | value |
|
||||
| Content-Length | 12 |
|
||||
Examples:
|
||||
| user |
|
||||
| Alice |
|
||||
| Brian |
|
||||
| Bob |
|
||||
|
||||
|
||||
Scenario Outline: An user downloads an old version of the file in the project space
|
||||
Given user "Alice" has uploaded a file inside space "download file" with content "new content" to "file.txt"
|
||||
And user "Alice" has uploaded a file inside space "download file" with content "newest content" to "file.txt"
|
||||
When user "<user>" downloads version of the file "file.txt" with the index "1" of the space "download file" using the WebDAV API
|
||||
Then the HTTP status code should be "200"
|
||||
And the following headers should be set
|
||||
| header | value |
|
||||
| Content-Length | 11 |
|
||||
When user "<user>" downloads version of the file "file.txt" with the index "2" of the space "download file" using the WebDAV API
|
||||
Then the HTTP status code should be "200"
|
||||
And the following headers should be set
|
||||
| header | value |
|
||||
| Content-Length | 12 |
|
||||
Examples:
|
||||
| user |
|
||||
| Alice |
|
||||
| Brian |
|
||||
| Bob |
|
||||
Scenario Outline: An user downloads an old version of the file in the project space
|
||||
Given user "Alice" has uploaded a file inside space "download file" with content "new content" to "file.txt"
|
||||
And user "Alice" has uploaded a file inside space "download file" with content "newest content" to "file.txt"
|
||||
When user "<user>" downloads version of the file "file.txt" with the index "1" of the space "download file" using the WebDAV API
|
||||
Then the HTTP status code should be "200"
|
||||
And the following headers should be set
|
||||
| header | value |
|
||||
| Content-Length | 11 |
|
||||
When user "<user>" downloads version of the file "file.txt" with the index "2" of the space "download file" using the WebDAV API
|
||||
Then the HTTP status code should be "200"
|
||||
And the following headers should be set
|
||||
| header | value |
|
||||
| Content-Length | 12 |
|
||||
Examples:
|
||||
| user |
|
||||
| Alice |
|
||||
| Brian |
|
||||
| Bob |
|
||||
@@ -31,7 +31,6 @@ Feature: A manager of the space can edit public link
|
||||
| permissions | <permissions> |
|
||||
| password | <password> |
|
||||
| name | <linkName> |
|
||||
| expireDate | <expireDate> |
|
||||
Then the HTTP status code should be "200"
|
||||
And the OCS status code should be "200"
|
||||
And the OCS status message should be "OK"
|
||||
@@ -44,18 +43,19 @@ Feature: A manager of the space can edit public link
|
||||
| share_type | public_link |
|
||||
| displayname_owner | %displayname% |
|
||||
| name | <linkName> |
|
||||
| expiration | <expireDate> |
|
||||
And the public should be able to download file "/test.txt" from inside the last public link shared folder using the new public WebDAV API with password "<password>"
|
||||
And the downloaded content should be "some content"
|
||||
Examples:
|
||||
| permissions | expectedPermissions | password | linkName | expireDate |
|
||||
| 5 | read,create | newPass | | |
|
||||
| 15 | read,update,create,delete | | newName | 2042-03-25T23:59:59+0100 |
|
||||
| permissions | expectedPermissions | password | linkName |
|
||||
| 5 | read,create | newPass | |
|
||||
| 15 | read,update,create,delete | | newName |
|
||||
|
||||
|
||||
Scenario Outline: All members can see a created public link
|
||||
Given using OCS API version "2"
|
||||
When user "Alice" shares a space "edit space" to user "Brian" with role "<role>"
|
||||
When user "Alice" shares a space "edit space" with settings:
|
||||
| shareWith | Brian |
|
||||
| role | <role> |
|
||||
Then the HTTP status code should be "200"
|
||||
And the OCS status code should be "200"
|
||||
And for user "Alice" the space "edit space" should contain the last created public link
|
||||
@@ -69,7 +69,9 @@ Feature: A manager of the space can edit public link
|
||||
|
||||
Scenario Outline: Members of the space try to edit a public link
|
||||
Given using OCS API version "2"
|
||||
And user "Alice" has shared a space "edit space" to user "Brian" with role "<role>"
|
||||
And user "Alice" has shared a space "edit space" with settings:
|
||||
| shareWith | Brian |
|
||||
| role | <role> |
|
||||
When user "Brian" updates the last public link share using the sharing API with
|
||||
| permissions | 15 |
|
||||
Then the HTTP status code should be "<code>"
|
||||
|
||||
@@ -14,14 +14,62 @@ Feature: List and create spaces
|
||||
Scenario: An ordinary user can request information about their Space via the Graph API
|
||||
When user "Alice" lists all available spaces via the GraphApi
|
||||
Then the HTTP status code should be "200"
|
||||
And the json responded should contain a space "Alice Hansen" with these key and value pairs:
|
||||
| key | value |
|
||||
| driveType | personal |
|
||||
| driveAlias | personal/alice |
|
||||
| id | %space_id% |
|
||||
| name | Alice Hansen |
|
||||
| quota@@@state | normal |
|
||||
| root@@@webDavUrl | %base_url%/dav/spaces/%space_id% |
|
||||
And the JSON response should contain space called "Alice Hansen" and match
|
||||
"""
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"driveType",
|
||||
"driveAlias",
|
||||
"name",
|
||||
"id",
|
||||
"quota",
|
||||
"root"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"enum": ["Alice Hansen"]
|
||||
},
|
||||
"driveType": {
|
||||
"type": "string",
|
||||
"enum": ["personal"]
|
||||
},
|
||||
"driveAlias": {
|
||||
"type": "string",
|
||||
"enum": ["personal/alice"]
|
||||
},
|
||||
"id": {
|
||||
"type": "string",
|
||||
"enum": ["%space_id%"]
|
||||
},
|
||||
"quota": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"state"
|
||||
],
|
||||
"properties": {
|
||||
"state": {
|
||||
"type": "string",
|
||||
"enum": ["normal"]
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"webDavUrl"
|
||||
],
|
||||
"properties": {
|
||||
"webDavUrl": {
|
||||
"type": "string",
|
||||
"enum": ["%base_url%/dav/spaces/%space_id%"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
||||
|
||||
Scenario: An ordinary user can request information about their Space via the Graph API using a filter
|
||||
@@ -29,20 +77,89 @@ Feature: List and create spaces
|
||||
And user "Brian" has created folder "folder"
|
||||
And user "Brian" has shared folder "folder" with user "Alice" with permissions "31"
|
||||
And user "Alice" has accepted share "/folder" offered by user "Brian"
|
||||
Then the user "Alice" should have a space called "Shares" with these key and value pairs:
|
||||
| key | value |
|
||||
| driveType | virtual |
|
||||
| id | %space_id% |
|
||||
| name | Shares |
|
||||
Then for user "Alice" the JSON response should contain space called "Shares" and match
|
||||
"""
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"driveType",
|
||||
"id",
|
||||
"name"
|
||||
],
|
||||
"properties": {
|
||||
"driveType": {
|
||||
"type": "string",
|
||||
"enum": ["virtual"]
|
||||
},
|
||||
"id": {
|
||||
"type": "string",
|
||||
"enum": ["%space_id%"]
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"enum": ["Shares"]
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
When user "Alice" lists all available spaces via the GraphApi with query "$filter=driveType eq 'personal'"
|
||||
Then the HTTP status code should be "200"
|
||||
And the json responded should contain a space "Alice Hansen" with these key and value pairs:
|
||||
| key | value |
|
||||
| driveType | personal |
|
||||
| id | %space_id% |
|
||||
| name | Alice Hansen |
|
||||
| quota@@@state | normal |
|
||||
| root@@@webDavUrl | %base_url%/dav/spaces/%space_id% |
|
||||
And the JSON response should contain space called "Alice Hansen" and match
|
||||
"""
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"driveType",
|
||||
"driveAlias",
|
||||
"name",
|
||||
"id",
|
||||
"quota",
|
||||
"root"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"enum": ["Alice Hansen"]
|
||||
},
|
||||
"driveType": {
|
||||
"type": "string",
|
||||
"enum": ["personal"]
|
||||
},
|
||||
"driveAlias": {
|
||||
"type": "string",
|
||||
"enum": ["personal/alice"]
|
||||
},
|
||||
"id": {
|
||||
"type": "string",
|
||||
"enum": ["%space_id%"]
|
||||
},
|
||||
"quota": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"state"
|
||||
],
|
||||
"properties": {
|
||||
"state": {
|
||||
"type": "string",
|
||||
"enum": ["normal"]
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"webDavUrl"
|
||||
],
|
||||
"properties": {
|
||||
"webDavUrl": {
|
||||
"type": "string",
|
||||
"enum": ["%base_url%/dav/spaces/%space_id%"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
And the json responded should not contain a space with name "Shares"
|
||||
And the json responded should only contain spaces of type "personal"
|
||||
|
||||
@@ -52,11 +169,31 @@ Feature: List and create spaces
|
||||
And user "Alice" has created a space "my project" of type "project" with quota "20"
|
||||
When user "Alice" lists all available spaces via the GraphApi with query "$filter=driveType eq 'project'"
|
||||
Then the HTTP status code should be "200"
|
||||
And the json responded should contain a space "my project" with these key and value pairs:
|
||||
| key | value |
|
||||
| driveType | project |
|
||||
| id | %space_id% |
|
||||
| name | my project |
|
||||
And the JSON response should contain space called "my project" and match
|
||||
"""
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"driveType",
|
||||
"name",
|
||||
"id"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"enum": ["my project"]
|
||||
},
|
||||
"driveType": {
|
||||
"type": "string",
|
||||
"enum": ["project"]
|
||||
},
|
||||
"id": {
|
||||
"type": "string",
|
||||
"enum": ["%space_id%"]
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
And the json responded should not contain a space with name "Alice Hansen"
|
||||
|
||||
|
||||
@@ -66,68 +203,383 @@ Feature: List and create spaces
|
||||
Then the HTTP status code should be "207"
|
||||
|
||||
|
||||
Scenario: An ordinary user cannot create a Space via Graph API
|
||||
Scenario Outline: The user without permissions to create space cannot create a Space via Graph API
|
||||
Given the administrator has given "Alice" the role "<role>" using the settings api
|
||||
When user "Alice" creates a space "Project Mars" of type "project" with the default quota using the GraphApi
|
||||
Then the HTTP status code should be "401"
|
||||
And the user "Alice" should not have a space called "share space"
|
||||
Examples:
|
||||
| role |
|
||||
| User |
|
||||
| Guest |
|
||||
|
||||
|
||||
Scenario: An admin user can create a Space via the Graph API with default quota
|
||||
Given the administrator has given "Alice" the role "Admin" using the settings api
|
||||
Scenario Outline: An admin or space admin user can create a Space via the Graph API with default quota
|
||||
Given the administrator has given "Alice" the role "<role>" using the settings api
|
||||
When user "Alice" creates a space "Project Mars" of type "project" with the default quota using the GraphApi
|
||||
Then the HTTP status code should be "201"
|
||||
And the json responded should contain a space "Project Mars" with these key and value pairs:
|
||||
| key | value |
|
||||
| driveType | project |
|
||||
| driveAlias | project/project-mars |
|
||||
| name | Project Mars |
|
||||
| quota@@@total | 1000000000 |
|
||||
| root@@@webDavUrl | %base_url%/dav/spaces/%space_id% |
|
||||
And the JSON response should contain space called "Project Mars" and match
|
||||
"""
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"driveType",
|
||||
"driveAlias",
|
||||
"name",
|
||||
"id",
|
||||
"quota",
|
||||
"root",
|
||||
"webUrl"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"enum": ["Project Mars"]
|
||||
},
|
||||
"driveType": {
|
||||
"type": "string",
|
||||
"enum": ["project"]
|
||||
},
|
||||
"driveAlias": {
|
||||
"type": "string",
|
||||
"enum": ["project/project-mars"]
|
||||
},
|
||||
"id": {
|
||||
"type": "string",
|
||||
"enum": ["%space_id%"]
|
||||
},
|
||||
"quota": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"total"
|
||||
],
|
||||
"properties": {
|
||||
"state": {
|
||||
"type": "number",
|
||||
"enum": [1000000000]
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"webDavUrl"
|
||||
],
|
||||
"properties": {
|
||||
"webDavUrl": {
|
||||
"type": "string",
|
||||
"enum": ["%base_url%/dav/spaces/%space_id%"]
|
||||
}
|
||||
}
|
||||
},
|
||||
"webUrl": {
|
||||
"type": "string",
|
||||
"enum": ["%base_url%/f/%space_id%"]
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
Examples:
|
||||
| role |
|
||||
| Admin |
|
||||
| Space Admin |
|
||||
|
||||
|
||||
Scenario: An admin user can create a Space via the Graph API with certain quota
|
||||
Given the administrator has given "Alice" the role "Admin" using the settings api
|
||||
Scenario Outline: An admin or space admin user can create a Space via the Graph API with certain quota
|
||||
Given the administrator has given "Alice" the role "<role>" using the settings api
|
||||
When user "Alice" creates a space "Project Venus" of type "project" with quota "2000" using the GraphApi
|
||||
Then the HTTP status code should be "201"
|
||||
And the json responded should contain a space "Project Venus" with these key and value pairs:
|
||||
| key | value |
|
||||
| driveType | project |
|
||||
| name | Project Venus |
|
||||
| quota@@@total | 2000 |
|
||||
| root@@@webDavUrl | %base_url%/dav/spaces/%space_id% |
|
||||
And the JSON response should contain space called "Project Venus" and match
|
||||
"""
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"driveType",
|
||||
"name",
|
||||
"id",
|
||||
"quota",
|
||||
"root",
|
||||
"webUrl"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"enum": ["Project Venus"]
|
||||
},
|
||||
"driveType": {
|
||||
"type": "string",
|
||||
"enum": ["project"]
|
||||
},
|
||||
"id": {
|
||||
"type": "string",
|
||||
"enum": ["%space_id%"]
|
||||
},
|
||||
"quota": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"total"
|
||||
],
|
||||
"properties": {
|
||||
"state": {
|
||||
"type": "number",
|
||||
"enum": [2000]
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"webDavUrl"
|
||||
],
|
||||
"properties": {
|
||||
"webDavUrl": {
|
||||
"type": "string",
|
||||
"enum": ["%base_url%/dav/spaces/%space_id%"]
|
||||
}
|
||||
}
|
||||
},
|
||||
"webUrl": {
|
||||
"type": "string",
|
||||
"enum": ["%base_url%/f/%space_id%"]
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
Examples:
|
||||
| role |
|
||||
| Admin |
|
||||
| Space Admin |
|
||||
|
||||
|
||||
Scenario: A user can list his personal space via multiple endpoints
|
||||
When user "Alice" lists all available spaces via the GraphApi with query "$filter=driveType eq 'personal'"
|
||||
Then the json responded should contain a space "Alice Hansen" owned by "Alice" with these key and value pairs:
|
||||
| key | value |
|
||||
| driveType | personal |
|
||||
| name | Alice Hansen |
|
||||
| root@@@webDavUrl | %base_url%/dav/spaces/%space_id% |
|
||||
| owner@@@user@@@id | %user_id% |
|
||||
Then the HTTP status code should be "200"
|
||||
And the JSON response should contain space called "Alice Hansen" owned by "Alice" and match
|
||||
"""
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"driveType",
|
||||
"name",
|
||||
"root",
|
||||
"owner"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"enum": ["Alice Hansen"]
|
||||
},
|
||||
"driveType": {
|
||||
"type": "string",
|
||||
"enum": ["personal"]
|
||||
},
|
||||
"root": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"webDavUrl"
|
||||
],
|
||||
"properties": {
|
||||
"webDavUrl": {
|
||||
"type": "string",
|
||||
"enum": ["%base_url%/dav/spaces/%space_id%"]
|
||||
}
|
||||
}
|
||||
},
|
||||
"owner": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"user"
|
||||
],
|
||||
"properties": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"id"
|
||||
],
|
||||
"properties": {
|
||||
"type": "string",
|
||||
"enum": ["%user_id%"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
When user "Alice" looks up the single space "Alice Hansen" via the GraphApi by using its id
|
||||
Then the json responded should contain a space "Alice Hansen" with these key and value pairs:
|
||||
| key | value |
|
||||
| driveType | personal |
|
||||
| name | Alice Hansen |
|
||||
| root@@@webDavUrl | %base_url%/dav/spaces/%space_id% |
|
||||
Then the HTTP status code should be "200"
|
||||
And the JSON response should contain space called "Alice Hansen" and match
|
||||
"""
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"driveType",
|
||||
"name",
|
||||
"root"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"enum": ["Alice Hansen"]
|
||||
},
|
||||
"driveType": {
|
||||
"type": "string",
|
||||
"enum": ["personal"]
|
||||
},
|
||||
"root": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"webDavUrl"
|
||||
],
|
||||
"properties": {
|
||||
"webDavUrl": {
|
||||
"type": "string",
|
||||
"enum": ["%base_url%/dav/spaces/%space_id%"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
||||
|
||||
Scenario: A user can list his created spaces via multiple endpoints
|
||||
Given the administrator has given "Alice" the role "Admin" using the settings api
|
||||
Scenario Outline: A user can list his created spaces via multiple endpoints
|
||||
Given the administrator has given "Alice" the role "<role>" using the settings api
|
||||
When user "Alice" creates a space "Project Venus" of type "project" with quota "2000" using the GraphApi
|
||||
Then the HTTP status code should be "201"
|
||||
And the json responded should contain a space "Project Venus" with these key and value pairs:
|
||||
| key | value |
|
||||
| driveType | project |
|
||||
| driveAlias | project/project-venus |
|
||||
| name | Project Venus |
|
||||
| quota@@@total | 2000 |
|
||||
| root@@@webDavUrl | %base_url%/dav/spaces/%space_id% |
|
||||
And the JSON response should contain space called "Project Venus" and match
|
||||
"""
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"driveType",
|
||||
"driveAlias",
|
||||
"name",
|
||||
"id",
|
||||
"quota",
|
||||
"root",
|
||||
"webUrl"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"enum": ["Project Venus"]
|
||||
},
|
||||
"driveType": {
|
||||
"type": "string",
|
||||
"enum": ["project"]
|
||||
},
|
||||
"driveAlias": {
|
||||
"type": "string",
|
||||
"enum": ["project/project-venus"]
|
||||
},
|
||||
"id": {
|
||||
"type": "string",
|
||||
"enum": ["%space_id%"]
|
||||
},
|
||||
"quota": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"total"
|
||||
],
|
||||
"properties": {
|
||||
"total": {
|
||||
"type": "number",
|
||||
"enum": [2000]
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"webDavUrl"
|
||||
],
|
||||
"properties": {
|
||||
"webDavUrl": {
|
||||
"type": "string",
|
||||
"enum": ["%base_url%/dav/spaces/%space_id%"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
When user "Alice" looks up the single space "Project Venus" via the GraphApi by using its id
|
||||
Then the json responded should contain a space "Project Venus" with these key and value pairs:
|
||||
| key | value |
|
||||
| driveType | project |
|
||||
| driveAlias | project/project-venus |
|
||||
| name | Project Venus |
|
||||
| quota@@@total | 2000 |
|
||||
| root@@@webDavUrl | %base_url%/dav/spaces/%space_id% |
|
||||
Then the HTTP status code should be "200"
|
||||
And the JSON response should contain space called "Project Venus" and match
|
||||
"""
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"driveType",
|
||||
"driveAlias",
|
||||
"name",
|
||||
"id",
|
||||
"quota",
|
||||
"root",
|
||||
"webUrl"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"enum": ["Project Venus"]
|
||||
},
|
||||
"driveType": {
|
||||
"type": "string",
|
||||
"enum": ["project"]
|
||||
},
|
||||
"driveAlias": {
|
||||
"type": "string",
|
||||
"enum": ["project/project-venus"]
|
||||
},
|
||||
"id": {
|
||||
"type": "string",
|
||||
"enum": ["%space_id%"]
|
||||
},
|
||||
"quota": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"total"
|
||||
],
|
||||
"properties": {
|
||||
"total": {
|
||||
"type": "number",
|
||||
"enum": [2000]
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"webDavUrl"
|
||||
],
|
||||
"properties": {
|
||||
"webDavUrl": {
|
||||
"type": "string",
|
||||
"enum": ["%base_url%/dav/spaces/%space_id%"]
|
||||
}
|
||||
}
|
||||
},
|
||||
"webUrl": {
|
||||
"type": "string",
|
||||
"enum": ["%base_url%/f/%space_id%"]
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
Examples:
|
||||
| role |
|
||||
| Admin |
|
||||
| Space Admin |
|
||||
|
||||
|
||||
Scenario Outline: A user cannot list space by id if he is not member of the space
|
||||
Given the administrator has given "Alice" the role "<role>" using the settings api
|
||||
And user "Admin" has created a space "Project Venus" with the default quota using the GraphApi
|
||||
When user "Alice" tries to look up the single space "Project Venus" owned by the user "Admin" by using its id
|
||||
Then the HTTP status code should be "404"
|
||||
And the json responded should not contain a space with name "Project Venus"
|
||||
Examples:
|
||||
| role |
|
||||
| Admin |
|
||||
| Space Admin |
|
||||
| User |
|
||||
| Guest |
|
||||
@@ -20,13 +20,49 @@ Feature: State of the quota
|
||||
Scenario Outline: Quota information is returned in the list of spaces returned via the Graph API
|
||||
Given user "Alice" has created a space "<spaceName>" of type "project" with quota "<total>"
|
||||
When user "Alice" uploads a file inside space "<spaceName>" with content "<fileContent>" to "test.txt" using the WebDAV API
|
||||
Then the user "Alice" should have a space called "<spaceName>" with these key and value pairs:
|
||||
| key | value |
|
||||
| name | <spaceName> |
|
||||
| quota@@@state | <state> |
|
||||
| quota@@@total | <total> |
|
||||
| quota@@@remaining| <remaining> |
|
||||
| quota@@@used | <used> |
|
||||
Then for user "Alice" the JSON response should contain space called "<spaceName>" and match
|
||||
"""
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name",
|
||||
"quota"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"enum": ["<spaceName>"]
|
||||
},
|
||||
"quota": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"state",
|
||||
"total",
|
||||
"remaining",
|
||||
"used"
|
||||
],
|
||||
"properties": {
|
||||
"state" : {
|
||||
"type": "string",
|
||||
"enum": ["<state>"]
|
||||
},
|
||||
"total" : {
|
||||
"type": "number",
|
||||
"enum": [<total>]
|
||||
},
|
||||
"remaining" : {
|
||||
"type": "number",
|
||||
"enum": [<remaining>]
|
||||
},
|
||||
"used": {
|
||||
"type": "number",
|
||||
"enum": [<used>]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
Examples:
|
||||
| spaceName | fileContent | state | total | remaining | used |
|
||||
| Quota1% | 1 | normal | 100 | 99 | 1 |
|
||||
@@ -65,3 +101,20 @@ Feature: State of the quota
|
||||
And user "Alice" has uploaded a file inside space "Project Delta" with content "7 bytes" to "test.txt"
|
||||
When user "Alice" uploads a file inside space "Project Delta" with content "00011 bytes" to "test.txt" using the WebDAV API
|
||||
Then the HTTP status code should be "507"
|
||||
|
||||
|
||||
Scenario Outline: Check the relative amount of quota of personal space
|
||||
Given user "Admin" has changed the quota of the personal space of "Alice Hansen" space to "10000"
|
||||
And user "Alice" has uploaded file "<file_upload>" to "/demo.txt"
|
||||
When the user "Alice" requests these endpoints with "GET" with basic auth
|
||||
| endpoint |
|
||||
| <end_point> |
|
||||
Then the HTTP status code should be "200"
|
||||
And the OCS status code should be "<ocs_code>"
|
||||
And the relative quota amount should be "<quota_relative>"
|
||||
Examples:
|
||||
| file_upload | end_point | ocs_code | quota_relative |
|
||||
| /filesForUpload/lorem.txt | /ocs/v1.php/cloud/users/%username% | 100 | 6.99 |
|
||||
| /filesForUpload/lorem-big.txt | /ocs/v1.php/cloud/users/%username% | 100 | 91.17 |
|
||||
| /filesForUpload/lorem.txt | /ocs/v2.php/cloud/users/%username% | 200 | 6.99 |
|
||||
| /filesForUpload/lorem-big.txt | /ocs/v2.php/cloud/users/%username% | 200 | 91.17 |
|
||||
@@ -21,7 +21,9 @@ Feature: Remove files, folder
|
||||
|
||||
|
||||
Scenario Outline: An user deletes a folder with some subfolders in a Space via the webDav API
|
||||
Given user "Alice" has shared a space "delete objects" to user "Brian" with role "<role>"
|
||||
Given user "Alice" has shared a space "delete objects" with settings:
|
||||
| shareWith | Brian |
|
||||
| role | <role> |
|
||||
When user "<user>" removes the folder "folderForDeleting" from space "delete objects"
|
||||
Then the HTTP status code should be "<code>"
|
||||
And for user "<user>" the space "delete objects" <shouldOrNotBeInSpace> contain these entries:
|
||||
@@ -36,7 +38,9 @@ Feature: Remove files, folder
|
||||
|
||||
|
||||
Scenario Outline: An user deletes a subfolder in a Space via the webDav API
|
||||
Given user "Alice" has shared a space "delete objects" to user "Brian" with role "<role>"
|
||||
Given user "Alice" has shared a space "delete objects" with settings:
|
||||
| shareWith | Brian |
|
||||
| role | <role> |
|
||||
When user "<user>" removes the folder "folderForDeleting/sub1" from space "delete objects"
|
||||
Then the HTTP status code should be "<code>"
|
||||
And for user "<user>" the space "delete objects" should contain these entries:
|
||||
@@ -53,16 +57,42 @@ Feature: Remove files, folder
|
||||
|
||||
|
||||
Scenario Outline: An user deletes a file in a Space via the webDav API
|
||||
Given user "Alice" has shared a space "delete objects" to user "Brian" with role "<role>"
|
||||
Given user "Alice" has shared a space "delete objects" with settings:
|
||||
| shareWith | Brian |
|
||||
| role | <role> |
|
||||
When user "<user>" removes the file "text.txt" from space "delete objects"
|
||||
Then the HTTP status code should be "<code>"
|
||||
And for user "<user>" the space "delete objects" <shouldOrNotBeInSpace> contain these entries:
|
||||
| text.txt |
|
||||
And as "<user>" file "text.txt" <shouldOrNotBeInTrash> exist in the trashbin of the space "delete objects"
|
||||
And the user "<user>" should have a space called "delete objects" with these key and value pairs:
|
||||
| key | value |
|
||||
| name | delete objects |
|
||||
| quota@@@used | <quotaValue> |
|
||||
And for user "<user>" the JSON response should contain space called "delete objects" and match
|
||||
"""
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name",
|
||||
"quota"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"enum": ["delete objects"]
|
||||
},
|
||||
"quota": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"used"
|
||||
],
|
||||
"properties": {
|
||||
"used": {
|
||||
"type": "number",
|
||||
"enum": [<quotaValue>]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
Examples:
|
||||
| user | role | code | shouldOrNotBeInSpace | shouldOrNotBeInTrash | quotaValue |
|
||||
| Alice | manager | 204 | should not | should | 0 |
|
||||
@@ -74,6 +104,18 @@ Feature: Remove files, folder
|
||||
Scenario: An user is unable to delete a Space via the webDav API
|
||||
When user "Alice" removes the folder "" from space "delete objects"
|
||||
Then the HTTP status code should be "405"
|
||||
And the user "Alice" should have a space called "delete objects" with these key and value pairs:
|
||||
| key | value |
|
||||
| name | delete objects |
|
||||
And for user "Alice" the JSON response should contain space called "delete objects" and match
|
||||
"""
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"enum": ["delete objects"]
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
@@ -1,68 +1,165 @@
|
||||
@api @skipOnOcV10
|
||||
Feature: Restore files, folder
|
||||
As a user with manager and editor role
|
||||
I want to be able to restore files, folders
|
||||
Users with the viewer role cannot restore objects
|
||||
As a user with manager and editor role
|
||||
I want to be able to restore files, folders
|
||||
Users with the viewer role cannot restore objects
|
||||
|
||||
Note - this feature is run in CI with ACCOUNTS_HASH_DIFFICULTY set to the default for production
|
||||
See https://github.com/owncloud/ocis/issues/1542 and https://github.com/owncloud/ocis/pull/839
|
||||
Note - this feature is run in CI with ACCOUNTS_HASH_DIFFICULTY set to the default for production
|
||||
See https://github.com/owncloud/ocis/issues/1542 and https://github.com/owncloud/ocis/pull/839
|
||||
|
||||
Background:
|
||||
Given these users have been created with default attributes and without skeleton files:
|
||||
| username |
|
||||
| Alice |
|
||||
| Brian |
|
||||
| Bob |
|
||||
| Carol |
|
||||
And using spaces DAV path
|
||||
And the administrator has given "Alice" the role "Space Admin" using the settings api
|
||||
And user "Alice" creates a space "restore objects" of type "project" with the default quota using the GraphApi
|
||||
And user "Alice" has created a folder "newFolder" in space "restore objects"
|
||||
And user "Alice" has uploaded a file inside space "restore objects" with content "test" to "newFolder/file.txt"
|
||||
Background:
|
||||
Given these users have been created with default attributes and without skeleton files:
|
||||
| username |
|
||||
| Alice |
|
||||
| Brian |
|
||||
| Bob |
|
||||
| Carol |
|
||||
And using spaces DAV path
|
||||
And the administrator has given "Alice" the role "Space Admin" using the settings api
|
||||
And user "Alice" creates a space "restore objects" of type "project" with the default quota using the GraphApi
|
||||
And user "Alice" has created a folder "newFolder" in space "restore objects"
|
||||
And user "Alice" has uploaded a file inside space "restore objects" with content "test" to "newFolder/file.txt"
|
||||
|
||||
|
||||
Scenario Outline: An user with different role can see deleted objects in trash bin of the space via the webDav API
|
||||
Given user "Alice" has shared a space "restore objects" to user "Brian" with role "<role>"
|
||||
And user "Alice" has removed the file "newFolder/file.txt" from space "restore objects"
|
||||
And user "Alice" has removed the folder "newFolder" from space "restore objects"
|
||||
When user "<user>" lists all deleted files in the trash bin of the space "restore objects"
|
||||
Then the HTTP status code should be "207"
|
||||
And as "<user>" folder "newFolder" should exist in the trashbin of the space "restore objects"
|
||||
And as "<user>" file "file.txt" should exist in the trashbin of the space "restore objects"
|
||||
Examples:
|
||||
| user | role |
|
||||
| Brian | manager |
|
||||
| Brian | editor |
|
||||
| Brian | viewer |
|
||||
Scenario Outline: The user with different role can see deleted objects in trash bin of the space via the webDav API
|
||||
Given user "Alice" has shared a space "restore objects" with settings:
|
||||
| shareWith | Brian |
|
||||
| role | <role> |
|
||||
And user "Alice" has removed the file "newFolder/file.txt" from space "restore objects"
|
||||
And user "Alice" has removed the folder "newFolder" from space "restore objects"
|
||||
When user "<user>" lists all deleted files in the trash bin of the space "restore objects"
|
||||
Then the HTTP status code should be "207"
|
||||
And as "<user>" folder "newFolder" should exist in the trashbin of the space "restore objects"
|
||||
And as "<user>" file "file.txt" should exist in the trashbin of the space "restore objects"
|
||||
Examples:
|
||||
| user | role |
|
||||
| Brian | manager |
|
||||
| Brian | editor |
|
||||
| Brian | viewer |
|
||||
|
||||
|
||||
Scenario Outline: An user restores a folder with some objects from the trash via the webDav API
|
||||
Given user "Alice" has shared a space "restore objects" to user "Brian" with role "<role>"
|
||||
And user "Alice" has removed the folder "newFolder" from space "restore objects"
|
||||
When user "<user>" restores the folder "newFolder" from the trash of the space "restore objects" to "/newFolder"
|
||||
Then the HTTP status code should be "<code>"
|
||||
And for user "<user>" the space "restore objects" <shouldOrNotBeInSpace> contain these entries:
|
||||
| newFolder |
|
||||
And as "<user>" folder "newFolder" <shouldOrNotBeInTrash> exist in the trashbin of the space "restore objects"
|
||||
Examples:
|
||||
| user | role | code | shouldOrNotBeInSpace | shouldOrNotBeInTrash |
|
||||
| Alice | manager | 201 | should | should not |
|
||||
| Brian | manager | 201 | should | should not |
|
||||
| Brian | editor | 201 | should | should not |
|
||||
| Brian | viewer | 403 | should not | should |
|
||||
Scenario Outline: The user can restore a folder with some objects from the trash via the webDav API
|
||||
Given user "Alice" has shared a space "restore objects" with settings:
|
||||
| shareWith | Brian |
|
||||
| role | <role> |
|
||||
And user "Alice" has removed the folder "newFolder" from space "restore objects"
|
||||
When user "<user>" restores the folder "newFolder" from the trash of the space "restore objects" to "/newFolder"
|
||||
Then the HTTP status code should be "<code>"
|
||||
And for user "<user>" the space "restore objects" <shouldOrNotBeInSpace> contain these entries:
|
||||
| newFolder |
|
||||
And as "<user>" folder "newFolder" <shouldOrNotBeInTrash> exist in the trashbin of the space "restore objects"
|
||||
Examples:
|
||||
| user | role | code | shouldOrNotBeInSpace | shouldOrNotBeInTrash |
|
||||
| Alice | manager | 201 | should | should not |
|
||||
| Brian | manager | 201 | should | should not |
|
||||
| Brian | editor | 201 | should | should not |
|
||||
| Brian | viewer | 403 | should not | should |
|
||||
|
||||
|
||||
Scenario Outline: An user restores a file from the trash via the webDav API
|
||||
Given user "Alice" has shared a space "restore objects" to user "Brian" with role "<role>"
|
||||
And user "Alice" has removed the file "newFolder/file.txt" from space "restore objects"
|
||||
When user "<user>" restores the file "file.txt" from the trash of the space "restore objects" to "newFolder/file.txt"
|
||||
Then the HTTP status code should be "<code>"
|
||||
And for user "<user>" folder "newFolder" of the space "restore objects" <shouldOrNotBeInSpace> contain these files:
|
||||
| file.txt |
|
||||
And as "<user>" file "file.txt" <shouldOrNotBeInTrash> exist in the trashbin of the space "restore objects"
|
||||
Examples:
|
||||
| user | role | code | shouldOrNotBeInSpace | shouldOrNotBeInTrash |
|
||||
| Alice | manager | 201 | should | should not |
|
||||
| Brian | manager | 201 | should | should not |
|
||||
| Brian | editor | 201 | should | should not |
|
||||
| Brian | viewer | 403 | should not | should |
|
||||
Scenario Outline: The user can restore a file from the trash via the webDav API
|
||||
Given user "Alice" has shared a space "restore objects" with settings:
|
||||
| shareWith | Brian |
|
||||
| role | <role> |
|
||||
And user "Alice" has removed the file "newFolder/file.txt" from space "restore objects"
|
||||
When user "<user>" restores the file "file.txt" from the trash of the space "restore objects" to "newFolder/file.txt"
|
||||
Then the HTTP status code should be "<code>"
|
||||
And for user "<user>" folder "newFolder" of the space "restore objects" <shouldOrNotBeInSpace> contain these files:
|
||||
| file.txt |
|
||||
And as "<user>" file "file.txt" <shouldOrNotBeInTrash> exist in the trashbin of the space "restore objects"
|
||||
Examples:
|
||||
| user | role | code | shouldOrNotBeInSpace | shouldOrNotBeInTrash |
|
||||
| Alice | manager | 201 | should | should not |
|
||||
| Brian | manager | 201 | should | should not |
|
||||
| Brian | editor | 201 | should | should not |
|
||||
| Brian | viewer | 403 | should not | should |
|
||||
|
||||
|
||||
Scenario: The user can restore a file even if there is not enough quota to do so
|
||||
Given user "Admin" has changed the quota of the "Brian Murphy" space to "30"
|
||||
And user "Brian" has uploaded file with content "file is less than 30 bytes" to "/file.txt"
|
||||
And user "Brian" has uploaded file with content "reduceContent" to "/file.txt"
|
||||
And user "Brian" has uploaded file with content "some content" to "newFile.txt"
|
||||
When user "Brian" restores version index "1" of file "/file.txt" using the WebDAV API
|
||||
Then the HTTP status code should be "204"
|
||||
And the content of file "/file.txt" for user "Brian" should be "file is less than 30 bytes"
|
||||
And for user "Brian" the JSON response should contain space called "Brian Murphy" and match
|
||||
"""
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"quota"
|
||||
],
|
||||
"properties": {
|
||||
"quota": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"state",
|
||||
"total",
|
||||
"remaining",
|
||||
"used"
|
||||
],
|
||||
"properties": {
|
||||
"state" : {
|
||||
"type": "string",
|
||||
"enum": ["exceeded"]
|
||||
},
|
||||
"total" : {
|
||||
"type": "number",
|
||||
"enum": [30]
|
||||
},
|
||||
"used": {
|
||||
"type": "number",
|
||||
"enum": [38]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
||||
|
||||
Scenario: The recipient can restore a file even if there is not enough owner's quota to do so
|
||||
Given user "Admin" has changed the quota of the "Brian Murphy" space to "30"
|
||||
And user "Brian" has uploaded file with content "file is less than 30 bytes" to "/file.txt"
|
||||
And user "Brian" has uploaded file with content "reduceContent" to "/file.txt"
|
||||
And user "Brian" has uploaded file with content "some content" to "newFile.txt"
|
||||
And user "Brian" has shared file "file.txt" with user "Alice"
|
||||
And user "Alice" has accepted share "/file.txt" offered by user "Brian"
|
||||
And using new DAV path
|
||||
When user "Alice" restores version index "1" of file "/Shares/file.txt" using the WebDAV API
|
||||
Then the HTTP status code should be "204"
|
||||
And the content of file "/Shares/file.txt" for user "Alice" should be "file is less than 30 bytes"
|
||||
And for user "Brian" the JSON response should contain space called "Brian Murphy" and match
|
||||
"""
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"quota"
|
||||
],
|
||||
"properties": {
|
||||
"quota": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"state",
|
||||
"total",
|
||||
"remaining",
|
||||
"used"
|
||||
],
|
||||
"properties": {
|
||||
"state" : {
|
||||
"type": "string",
|
||||
"enum": ["exceeded"]
|
||||
},
|
||||
"total" : {
|
||||
"type": "number",
|
||||
"enum": [30]
|
||||
},
|
||||
"used": {
|
||||
"type": "number",
|
||||
"enum": [38]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
@@ -28,8 +28,12 @@ Feature: Restoring space
|
||||
Scenario: Participants can see the data after the space is restored
|
||||
Given user "Alice" has created a folder "mainFolder" in space "restore a space"
|
||||
And user "Alice" has uploaded a file inside space "restore a space" with content "example" to "test.txt"
|
||||
And user "Alice" has shared a space "restore a space" to user "Brian" with role "editor"
|
||||
And user "Alice" has shared a space "restore a space" to user "Bob" with role "viewer"
|
||||
And user "Alice" has shared a space "restore a space" with settings:
|
||||
| shareWith | Brian |
|
||||
| role | editor |
|
||||
And user "Alice" has shared a space "restore a space" with settings:
|
||||
| shareWith | Bob |
|
||||
| role | viewer |
|
||||
And user "Alice" has disabled a space "restore a space"
|
||||
When user "Alice" restores a disabled space "restore a space"
|
||||
Then for user "Alice" the space "restore a space" should contain these entries:
|
||||
@@ -44,7 +48,9 @@ Feature: Restoring space
|
||||
|
||||
|
||||
Scenario: Participant can create data in the space after restoring
|
||||
Given user "Alice" has shared a space "restore a space" to user "Brian" with role "editor"
|
||||
Given user "Alice" has shared a space "restore a space" with settings:
|
||||
| shareWith | Brian |
|
||||
| role | editor |
|
||||
And user "Alice" has disabled a space "restore a space"
|
||||
And user "Alice" has restored a disabled space "restore a space"
|
||||
When user "Brian" creates a folder "mainFolder" in space "restore a space" using the WebDav Api
|
||||
@@ -55,9 +61,11 @@ Feature: Restoring space
|
||||
|
||||
|
||||
Scenario Outline: User without space manager role cannot restore space
|
||||
Given user "Alice" has shared a space "restore a space" to user "Brian" with role "<role>"
|
||||
Given user "Alice" has shared a space "restore a space" with settings:
|
||||
| shareWith | Brian |
|
||||
| role | <role> |
|
||||
And user "Alice" has disabled a space "restore a space"
|
||||
When user "Brian" restores a disabled space "restore a space" without manager rights
|
||||
When user "Brian" restores a disabled space "restore a space" owned by user "Alice"
|
||||
Then the HTTP status code should be "404"
|
||||
Examples:
|
||||
| role |
|
||||
|
||||
@@ -42,7 +42,10 @@ Feature: Search
|
||||
|
||||
|
||||
Scenario: Brian can find data from the Shares
|
||||
Given user "Alice" shares the following entity "folderMain" inside of space "find data" with user "Brian" with role "viewer"
|
||||
Given user "Alice" has created a share inside of space "find data" with settings:
|
||||
| path | folderMain |
|
||||
| shareWith | Brian |
|
||||
| role | viewer |
|
||||
And user "Brian" has accepted share "/folderMain" offered by user "Alice"
|
||||
When user "Brian" searches for "folder" using the WebDAV API
|
||||
Then the HTTP status code should be "207"
|
||||
@@ -64,7 +67,10 @@ Feature: Search
|
||||
|
||||
|
||||
Scenario: User cannot find pending folder
|
||||
Given user "Alice" shares the following entity "folderMain" inside of space "find data" with user "Brian" with role "viewer"
|
||||
Given user "Alice" has created a share inside of space "find data" with settings:
|
||||
| path | folderMain |
|
||||
| shareWith | Brian |
|
||||
| role | viewer |
|
||||
When user "Brian" searches for "folder" using the WebDAV API
|
||||
Then the HTTP status code should be "207"
|
||||
And the search result should contain "0" entries
|
||||
@@ -75,7 +81,10 @@ Feature: Search
|
||||
|
||||
|
||||
Scenario: User cannot find declined folder
|
||||
Given user "Alice" shares the following entity "folderMain" inside of space "find data" with user "Brian" with role "viewer"
|
||||
Given user "Alice" has created a share inside of space "find data" with settings:
|
||||
| path | folderMain |
|
||||
| shareWith | Brian |
|
||||
| role | viewer |
|
||||
And user "Brian" has declined share "/folderMain" offered by user "Alice"
|
||||
When user "Brian" searches for "folder" using the WebDAV API
|
||||
Then the HTTP status code should be "207"
|
||||
|
||||
@@ -0,0 +1,178 @@
|
||||
@api
|
||||
Feature: Set quota
|
||||
As a user
|
||||
I want to set quota to different users
|
||||
So that users can only take up a certain amount of storage space
|
||||
|
||||
Background:
|
||||
Given these users have been created with default attributes and without skeleton files:
|
||||
| username |
|
||||
| Alice |
|
||||
| Brian |
|
||||
|
||||
|
||||
Scenario Outline: admin sets personal space quota of user with different role
|
||||
Given the administrator has given "Alice" the role "Admin" using the settings api
|
||||
And the administrator has given "Brian" the role "<userRole>" using the settings api
|
||||
When user "Alice" changes the quota of the "Brian Murphy" space to "100" owned by user "Brian"
|
||||
Then the HTTP status code should be "200"
|
||||
And for user "Brian" the JSON response should contain space called "Brian Murphy" and match
|
||||
"""
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"quota"
|
||||
],
|
||||
"properties": {
|
||||
"quota": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"total"
|
||||
],
|
||||
"properties": {
|
||||
"total" : {
|
||||
"type": "number",
|
||||
"enum": [100]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
Examples:
|
||||
| userRole |
|
||||
| Admin |
|
||||
| Space Admin |
|
||||
| User |
|
||||
| Guest |
|
||||
|
||||
|
||||
Scenario Outline: non-admin user tries to set the personal space quota of other users
|
||||
Given the administrator has given "Alice" the role "<role>" using the settings api
|
||||
And the administrator has given "Brian" the role "<userRole>" using the settings api
|
||||
When user "Alice" changes the quota of the "Brian Murphy" space to "100" owned by user "Brian"
|
||||
Then the HTTP status code should be "401"
|
||||
And for user "Brian" the JSON response should contain space called "Brian Murphy" and match
|
||||
"""
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"quota"
|
||||
],
|
||||
"properties": {
|
||||
"quota": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"total"
|
||||
],
|
||||
"properties": {
|
||||
"total" : {
|
||||
"type": "number",
|
||||
"enum": [0]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
Examples:
|
||||
| role | userRole |
|
||||
| Space Admin | Admin |
|
||||
| Space Admin | Space Admin |
|
||||
| Space Admin | User |
|
||||
| Space Admin | Guest |
|
||||
| User | Admin |
|
||||
| User | Space Admin |
|
||||
| User | User |
|
||||
| User | Guest |
|
||||
| Guest | Admin |
|
||||
| Guest | Space Admin |
|
||||
| Guest | User |
|
||||
| Guest | Guest |
|
||||
|
||||
|
||||
Scenario Outline: admin or space admin user sets a quota of a project space
|
||||
Given the administrator has given "Alice" the role "Space Admin" using the settings api
|
||||
And the administrator has given "Brian" the role "<userRole>" using the settings api
|
||||
And user "Alice" has created a space "Project Jupiter" of type "project" with quota "20"
|
||||
When user "Brian" changes the quota of the "Project Jupiter" space to "100" owned by user "Alice"
|
||||
Then the HTTP status code should be "200"
|
||||
And for user "Alice" the JSON response should contain space called "Project Jupiter" and match
|
||||
"""
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name",
|
||||
"quota"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"enum": ["Project Jupiter"]
|
||||
},
|
||||
"quota": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"total"
|
||||
],
|
||||
"properties": {
|
||||
"total" : {
|
||||
"type": "number",
|
||||
"enum": [100]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
Examples:
|
||||
| userRole |
|
||||
| Admin |
|
||||
| Space Admin |
|
||||
|
||||
|
||||
Scenario Outline: normal or guest user tries to set quota of a space
|
||||
Given the administrator has given "Alice" the role "Space Admin" using the settings api
|
||||
And the administrator has given "Brian" the role "<userRole>" using the settings api
|
||||
And user "Alice" has created a space "Project Jupiter" of type "project" with quota "20"
|
||||
And user "Alice" has shared a space "Project Jupiter" with settings:
|
||||
| shareWith | Brian |
|
||||
| role | <spaceRole> |
|
||||
When user "Brian" changes the quota of the "Project Jupiter" space to "100"
|
||||
Then the HTTP status code should be "401"
|
||||
And for user "Alice" the JSON response should contain space called "Project Jupiter" and match
|
||||
"""
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name",
|
||||
"quota"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"enum": ["Project Jupiter"]
|
||||
},
|
||||
"quota": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"total"
|
||||
],
|
||||
"properties": {
|
||||
"total" : {
|
||||
"type": "number",
|
||||
"enum": [20]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
Examples:
|
||||
| userRole | spaceRole |
|
||||
| User | viewer |
|
||||
| User | editor |
|
||||
| User | manager |
|
||||
| Guest | viewer |
|
||||
| Guest | editor |
|
||||
| Guest | manager |
|
||||
@@ -0,0 +1,435 @@
|
||||
@api @skipOnOcV10
|
||||
Feature: Space management
|
||||
As a user with space admin permission
|
||||
I want to be able to manage all existing project space
|
||||
- I can get all project space where I am not member using "graph/v1.0/drives" endpoint
|
||||
- I can edit space: change quota, name, description
|
||||
- I can enable, disable, delete space
|
||||
|
||||
Note - this feature is run in CI with ACCOUNTS_HASH_DIFFICULTY set to the default for production
|
||||
See https://github.com/owncloud/ocis/issues/1542 and https://github.com/owncloud/ocis/pull/839
|
||||
|
||||
Background:
|
||||
Given these users have been created with default attributes and without skeleton files:
|
||||
| username |
|
||||
| Alice |
|
||||
| Brian |
|
||||
| Carol |
|
||||
And using spaces DAV path
|
||||
And the administrator has given "Alice" the role "Space Admin" using the settings api
|
||||
And the administrator has given "Brian" the role "Space Admin" using the settings api
|
||||
And user "Alice" has created a space "Project" of type "project" with quota "10"
|
||||
|
||||
|
||||
Scenario: The space admin user can see another project space even if he is not member of the space
|
||||
When user "Brian" lists all spaces via the GraphApi with query "$filter=driveType eq 'project'"
|
||||
Then the HTTP status code should be "200"
|
||||
And the JSON response should contain space called "Project" and match
|
||||
"""
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"driveType",
|
||||
"name",
|
||||
"id"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"enum": ["Project"]
|
||||
},
|
||||
"driveType": {
|
||||
"type": "string",
|
||||
"enum": ["project"]
|
||||
},
|
||||
"id": {
|
||||
"type": "string",
|
||||
"enum": ["%space_id%"]
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
And the json responded should not contain a space with name "Alice Hansen"
|
||||
|
||||
|
||||
Scenario: The space admin user can see another personal spaces
|
||||
When user "Brian" lists all spaces via the GraphApi with query "$filter=driveType eq 'personal'"
|
||||
Then the HTTP status code should be "200"
|
||||
And the JSON response should contain space called "Alice Hansen" and match
|
||||
"""
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"driveType",
|
||||
"name",
|
||||
"id"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"enum": ["Alice Hansen"]
|
||||
},
|
||||
"driveType": {
|
||||
"type": "string",
|
||||
"enum": ["personal"]
|
||||
},
|
||||
"id": {
|
||||
"type": "string",
|
||||
"enum": ["%space_id%"]
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
And the json responded should not contain a space with name "Project"
|
||||
|
||||
|
||||
Scenario: The user without space admin permissions cannot see another spaces
|
||||
When user "Carol" tries to list all spaces via the GraphApi
|
||||
Then the HTTP status code should be "200"
|
||||
And the json responded should not contain a space with name "Project"
|
||||
And the json responded should not contain a space with name "Alice Hansen"
|
||||
|
||||
|
||||
Scenario: The space admin user changes the quota of the project space
|
||||
When user "Brian" changes the quota of the "Project" space to "20" owned by user "Alice"
|
||||
Then the HTTP status code should be "200"
|
||||
And for user "Alice" the JSON response should contain space called "Project" and match
|
||||
"""
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"quota"
|
||||
],
|
||||
"properties": {
|
||||
"quota": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"total"
|
||||
],
|
||||
"properties": {
|
||||
"total": {
|
||||
"type": "number",
|
||||
"enum": [20]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
||||
|
||||
Scenario: The user without space admin permissions tries to change the quota of the project space
|
||||
When user "Carol" tries to change the quota of the "Project" space to "20" owned by user "Alice"
|
||||
Then the HTTP status code should be "401"
|
||||
And for user "Alice" the JSON response should contain space called "Project" and match
|
||||
"""
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"quota"
|
||||
],
|
||||
"properties": {
|
||||
"quota": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"total"
|
||||
],
|
||||
"properties": {
|
||||
"total": {
|
||||
"type": "number",
|
||||
"enum": [10]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
||||
|
||||
Scenario: The space admin user tries to change the quota of the personal space
|
||||
When user "Brian" tries to change the quota of the "Alice Hansen" space to "20" owned by user "Alice"
|
||||
Then the HTTP status code should be "401"
|
||||
And for user "Alice" the JSON response should contain space called "Project" and match
|
||||
"""
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"quota"
|
||||
],
|
||||
"properties": {
|
||||
"quota": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"total"
|
||||
],
|
||||
"properties": {
|
||||
"total": {
|
||||
"type": "number",
|
||||
"enum": [10]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
||||
|
||||
Scenario: The user without space admin permissions tries to change the quota of the personal space
|
||||
When user "Carol" tries to change the quota of the "Alice Hansen" space to "20" owned by user "Alice"
|
||||
Then the HTTP status code should be "401"
|
||||
And for user "Alice" the JSON response should contain space called "Project" and match
|
||||
"""
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"quota"
|
||||
],
|
||||
"properties": {
|
||||
"quota": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"total"
|
||||
],
|
||||
"properties": {
|
||||
"total": {
|
||||
"type": "number",
|
||||
"enum": [10]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
||||
@skipOnStable2.0
|
||||
Scenario: The space admin user changes the name of the project space
|
||||
When user "Brian" changes the name of the "Project" space to "New Name" owned by user "Alice"
|
||||
Then the HTTP status code should be "200"
|
||||
And for user "Alice" the JSON response should contain space called "Project" and match
|
||||
"""
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"enum": ["New Name"]
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
||||
|
||||
Scenario: The user without space admin permissions tries to change the name of the project space
|
||||
When user "Carol" tries to change the name of the "Project" space to "New Name" owned by user "Alice"
|
||||
Then the HTTP status code should be "403"
|
||||
And for user "Alice" the JSON response should contain space called "Project" and match
|
||||
"""
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"enum": ["Project"]
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
||||
@skipOnStable2.0
|
||||
Scenario: The space admin user changes the description of the project space
|
||||
When user "Brian" changes the description of the "Project" space to "New description" owned by user "Alice"
|
||||
Then the HTTP status code should be "200"
|
||||
And for user "Alice" the JSON response should contain space called "Project" and match
|
||||
"""
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"description"
|
||||
],
|
||||
"properties": {
|
||||
"description": {
|
||||
"type": "string",
|
||||
"enum": ["New description"]
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
||||
|
||||
Scenario: The user without space admin permissions tries to change the description of the project space
|
||||
Given user "Alice" has changed the description of the "Project" space to "old description"
|
||||
When user "Carol" tries to change the description of the "Project" space to "New description" owned by user "Alice"
|
||||
Then the HTTP status code should be "403"
|
||||
And for user "Alice" the JSON response should contain space called "Project" and match
|
||||
"""
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"description"
|
||||
],
|
||||
"properties": {
|
||||
"description": {
|
||||
"type": "string",
|
||||
"enum": ["old description"]
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
||||
@skipOnStable2.0
|
||||
Scenario: The space admin user disables the project space
|
||||
When user "Brian" disables a space "Project" owned by user "Alice"
|
||||
Then the HTTP status code should be "204"
|
||||
And for user "Alice" the JSON response should contain space called "Project" and match
|
||||
"""
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name",
|
||||
"root"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"enum": ["Project"]
|
||||
},
|
||||
"root": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"deleted"
|
||||
],
|
||||
"properties": {
|
||||
"deleted": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"state"
|
||||
],
|
||||
"properties": {
|
||||
"state": {
|
||||
"type": "string",
|
||||
"enum": ["trashed"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
||||
|
||||
Scenario: The user without space admin permissions tries to disable the project space
|
||||
When user "Carol" tries to disable a space "Project" owned by user "Alice"
|
||||
Then the HTTP status code should be "403"
|
||||
|
||||
|
||||
Scenario Outline: The space admin user tries to disable the personal space
|
||||
When user "<user>" disables a space "Alice Hansen" owned by user "Alice"
|
||||
Then the HTTP status code should be "403"
|
||||
Examples:
|
||||
| user |
|
||||
| Brian |
|
||||
| Carol |
|
||||
|
||||
@skipOnStable2.0
|
||||
Scenario: The space admin user deletes the project space
|
||||
Given user "Alice" has disabled a space "Project"
|
||||
When user "Brian" deletes a space "Project" owned by user "Alice"
|
||||
Then the HTTP status code should be "204"
|
||||
And the user "Alice" should not have a space called "Project"
|
||||
|
||||
|
||||
Scenario: The user without space admin permissions tries to delete the project space
|
||||
Given user "Alice" has disabled a space "Project"
|
||||
When user "Carol" tries to delete a space "Project" owned by user "Alice"
|
||||
Then the HTTP status code should be "403"
|
||||
And for user "Alice" the JSON response should contain space called "Project" and match
|
||||
"""
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name",
|
||||
"root"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"enum": ["Project"]
|
||||
},
|
||||
"root": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"deleted"
|
||||
],
|
||||
"properties": {
|
||||
"deleted": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"state"
|
||||
],
|
||||
"properties": {
|
||||
"state": {
|
||||
"type": "string",
|
||||
"enum": ["trashed"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
||||
@skipOnStable2.0
|
||||
Scenario: The space admin user enables the project space
|
||||
Given user "Alice" has disabled a space "Project"
|
||||
When user "Brian" restores a disabled space "Project" owned by user "Alice"
|
||||
Then the HTTP status code should be "200"
|
||||
|
||||
|
||||
Scenario: The user without space admin permissions tries to enable the project space
|
||||
Given user "Alice" has disabled a space "Project"
|
||||
When user "Carol" tries to restore a disabled space "Project" owned by user "Alice"
|
||||
Then the HTTP status code should be "404"
|
||||
And for user "Alice" the JSON response should contain space called "Project" and match
|
||||
"""
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name",
|
||||
"root"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"enum": ["Project"]
|
||||
},
|
||||
"root": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"deleted"
|
||||
],
|
||||
"properties": {
|
||||
"deleted": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"state"
|
||||
],
|
||||
"properties": {
|
||||
"state": {
|
||||
"type": "string",
|
||||
"enum": ["trashed"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
@@ -0,0 +1,255 @@
|
||||
@api @skipOnOcV10 @skipOnStable2.0
|
||||
Feature: Tag
|
||||
The user can add a tag to resources for sorting and quick search
|
||||
|
||||
Note - this feature is run in CI with ACCOUNTS_HASH_DIFFICULTY set to the default for production
|
||||
See https://github.com/owncloud/ocis/issues/1542 and https://github.com/owncloud/ocis/pull/839
|
||||
|
||||
Background:
|
||||
Given these users have been created with default attributes and without skeleton files:
|
||||
| username |
|
||||
| Alice |
|
||||
| Brian |
|
||||
And using spaces DAV path
|
||||
And the administrator has given "Alice" the role "Space Admin" using the settings api
|
||||
And user "Alice" has created a space "use-tag" with the default quota using the GraphApi
|
||||
And user "Alice" has created a folder "folderMain" in space "use-tag"
|
||||
And user "Alice" has uploaded a file inside space "use-tag" with content "some content" to "folderMain/insideTheFolder.txt"
|
||||
|
||||
|
||||
Scenario: Alice creates tags for resources in the project space
|
||||
Given user "Alice" has shared a space "use-tag" with settings:
|
||||
| shareWith | Brian |
|
||||
| role | viewer |
|
||||
When user "Alice" creates the following tags for folder "folderMain" of space "use-tag":
|
||||
| tag level#1 |
|
||||
| tag with symbols @^$#^%$@%!_+) |
|
||||
Then the HTTP status code should be "200"
|
||||
When user "Alice" sends PROPFIND request from the space "use-tag" to the resource "folderMain" using the WebDAV API
|
||||
Then the HTTP status code should be "207"
|
||||
And the "PROPFIND" response should contain a space "use-tag" with these key and value pairs:
|
||||
| key | value |
|
||||
| oc:tags | tag level#1,tag with symbols @^$#^%$@%!_+) |
|
||||
When user "Alice" creates the following tags for file "folderMain/insideTheFolder.txt" of space "use-tag":
|
||||
| fileTag |
|
||||
Then the HTTP status code should be "200"
|
||||
When user "Brian" sends PROPFIND request from the space "use-tag" to the resource "folderMain/insideTheFolder.txt" using the WebDAV API
|
||||
Then the HTTP status code should be "207"
|
||||
And the "PROPFIND" response should contain a space "use-tag" with these key and value pairs:
|
||||
| key | value |
|
||||
| oc:tags | fileTag |
|
||||
When user "Alice" lists all available tags via the GraphApi
|
||||
Then the HTTP status code should be "200"
|
||||
And the response should contain following tags:
|
||||
| tag level#1 |
|
||||
| tag with symbols @^$#^%$@%!_+) |
|
||||
| fileTag |
|
||||
When user "Alice" lists all available tags via the GraphApi
|
||||
Then the HTTP status code should be "200"
|
||||
And the response should contain following tags:
|
||||
| tag level#1 |
|
||||
| tag with symbols @^$#^%$@%!_+) |
|
||||
| fileTag |
|
||||
|
||||
|
||||
Scenario: Alice creates tags for resources in the personal space
|
||||
Given user "Alice" has created a folder "folderMain" in space "Alice Hansen"
|
||||
And user "Alice" has uploaded a file inside space "Alice Hansen" with content "some content" to "file.txt"
|
||||
When user "Alice" creates the following tags for folder "folderMain" of space "Alice Hansen":
|
||||
| my tag |
|
||||
| important |
|
||||
Then the HTTP status code should be "200"
|
||||
When user "Alice" creates the following tags for file "file.txt" of space "Alice Hansen":
|
||||
| fileTag |
|
||||
| tag with symbol @^$#^%$@%!_+) |
|
||||
Then the HTTP status code should be "200"
|
||||
When user "Alice" sends PROPFIND request from the space "Alice Hansen" to the resource "folderMain" using the WebDAV API
|
||||
Then the HTTP status code should be "207"
|
||||
And the "PROPFIND" response to user "Alice" should contain a mountpoint "Alice Hansen" with these key and value pairs:
|
||||
| key | value |
|
||||
| oc:tags | my tag,important |
|
||||
When user "Alice" sends PROPFIND request from the space "Alice Hansen" to the resource "file.txt" using the WebDAV API
|
||||
Then the HTTP status code should be "207"
|
||||
And the "PROPFIND" response to user "Alice" should contain a mountpoint "Alice Hansen" with these key and value pairs:
|
||||
| key | value |
|
||||
| oc:tags | fileTag,tag with symbol @^$#^%$@%!_+) |
|
||||
When user "Alice" lists all available tags via the GraphApi
|
||||
Then the HTTP status code should be "200"
|
||||
And the response should contain following tags:
|
||||
| my tag |
|
||||
| important |
|
||||
| fileTag |
|
||||
| tag with symbol @^$#^%$@%!_+) |
|
||||
|
||||
|
||||
Scenario Outline: Member of the space tries to create tag
|
||||
Given user "Alice" has shared a space "use-tag" with settings:
|
||||
| shareWith | Brian |
|
||||
| role | <role> |
|
||||
When user "Brian" creates the following tags for folder "folderMain/insideTheFolder.txt" of space "use-tag":
|
||||
| tag level#1 |
|
||||
| tag with symbols @^$#^%$@%!_+) |
|
||||
Then the HTTP status code should be "<code>"
|
||||
When user "Alice" lists all available tags via the GraphApi
|
||||
Then the HTTP status code should be "200"
|
||||
And the response <shouldOrNot> contain following tags:
|
||||
| tag level#1 |
|
||||
| tag with symbols @^$#^%$@%!_+) |
|
||||
Examples:
|
||||
| role | code | shouldOrNot |
|
||||
| viewer | 403 | should not |
|
||||
| editor | 200 | should |
|
||||
| manager | 200 | should |
|
||||
|
||||
|
||||
Scenario: The recipient has a created tags if share is accepted
|
||||
Given user "Alice" has created the following tags for folder "folderMain" of the space "use-tag":
|
||||
| folderTag |
|
||||
| marketing |
|
||||
And user "Alice" has created a share inside of space "use-tag" with settings:
|
||||
| path | folderMain |
|
||||
| shareWith | Brian |
|
||||
| role | viewer |
|
||||
When user "Brian" lists all available tags via the GraphApi
|
||||
Then the HTTP status code should be "200"
|
||||
And the response should not contain following tags:
|
||||
| folderTag |
|
||||
| marketing |
|
||||
When user "Brian" accepts share "/folderMain" offered by user "Alice" using the sharing API
|
||||
And user "Brian" lists all available tags via the GraphApi
|
||||
Then the HTTP status code should be "200"
|
||||
And the response should contain following tags:
|
||||
| folderTag |
|
||||
| marketing |
|
||||
|
||||
|
||||
Scenario Outline: The recipient of the shared resource tries to create a tag
|
||||
Given user "Alice" has created a share inside of space "use-tag" with settings:
|
||||
| path | folderMain |
|
||||
| shareWith | Brian |
|
||||
| role | <role> |
|
||||
And user "Brian" has accepted share "/folderMain" offered by user "Alice"
|
||||
When user "Brian" creates the following tags for <resource> "<resourceName>" of space "Shares":
|
||||
| tag in a shared resource |
|
||||
| second tag |
|
||||
Then the HTTP status code should be "<code>"
|
||||
When user "Alice" lists all available tags via the GraphApi
|
||||
Then the HTTP status code should be "200"
|
||||
And the response <shouldOrNot> contain following tags:
|
||||
| tag in a shared resource |
|
||||
| second tag |
|
||||
Examples:
|
||||
| role | resource | resourceName | code | shouldOrNot |
|
||||
| viewer | file | folderMain/insideTheFolder.txt | 403 | should not |
|
||||
| editor | file | folderMain/insideTheFolder.txt | 200 | should |
|
||||
| manager | file | folderMain/insideTheFolder.txt | 200 | should |
|
||||
| viewer | folder | folderMain | 403 | should not |
|
||||
| editor | folder | folderMain | 200 | should |
|
||||
| manager | folder | folderMain | 200 | should |
|
||||
|
||||
|
||||
Scenario Outline: The recipient of the shared resource tries to remove a tag
|
||||
Given user "Alice" has created a share inside of space "use-tag" with settings:
|
||||
| path | folderMain |
|
||||
| shareWith | Brian |
|
||||
| role | <role> |
|
||||
And user "Alice" has created the following tags for <resource> "<resourceName>" of the space "use-tag":
|
||||
| tag in a shared resource |
|
||||
| second tag |
|
||||
And user "Brian" has accepted share "/folderMain" offered by user "Alice"
|
||||
When user "Brian" removes the following tags for <resource> "<resourceName>" of space "Shares":
|
||||
| tag in a shared resource |
|
||||
| second tag |
|
||||
Then the HTTP status code should be "<code>"
|
||||
When user "Alice" lists all available tags via the GraphApi
|
||||
Then the HTTP status code should be "200"
|
||||
And the response <shouldOrNot> contain following tags:
|
||||
| tag in a shared resource |
|
||||
| second tag |
|
||||
Examples:
|
||||
| role | resource | resourceName | code | shouldOrNot |
|
||||
| viewer | file | folderMain/insideTheFolder.txt | 403 | should |
|
||||
| editor | file | folderMain/insideTheFolder.txt | 200 | should not |
|
||||
| manager | file | folderMain/insideTheFolder.txt | 200 | should not |
|
||||
| viewer | folder | folderMain | 403 | should |
|
||||
| editor | folder | folderMain | 200 | should not |
|
||||
| manager | folder | folderMain | 200 | should not |
|
||||
|
||||
|
||||
Scenario: User removes folder tags
|
||||
Given user "Alice" has created the following tags for folder "folderMain" of the space "use-tag":
|
||||
| folderTag |
|
||||
| marketing |
|
||||
| development |
|
||||
When user "Alice" removes the following tags for folder "folderMain" of space "use-tag":
|
||||
| folderTag |
|
||||
| marketing |
|
||||
And user "Alice" sends PROPFIND request from the space "use-tag" to the resource "folderMain" using the WebDAV API
|
||||
Then the HTTP status code should be "207"
|
||||
And the "PROPFIND" response should contain a space "use-tag" with these key and value pairs:
|
||||
| key | value |
|
||||
| oc:tags | development |
|
||||
|
||||
|
||||
Scenario: User lists tags after deleting some folder tags
|
||||
Given user "Alice" has created the following tags for folder "folderMain" of the space "use-tag":
|
||||
| folderTag |
|
||||
| marketing |
|
||||
| development |
|
||||
When user "Alice" removes the following tags for folder "folderMain" of space "use-tag":
|
||||
| folderTag |
|
||||
| marketing |
|
||||
Then the HTTP status code should be "200"
|
||||
When user "Alice" lists all available tags via the GraphApi
|
||||
Then the HTTP status code should be "200"
|
||||
And the response should contain following tags:
|
||||
| development |
|
||||
And the response should not contain following tags:
|
||||
| folderTag |
|
||||
| marketing |
|
||||
|
||||
|
||||
Scenario: User lists the tags after deleting a folder
|
||||
Given user "Alice" has created the following tags for folder "folderMain" of the space "use-tag":
|
||||
| folderTag |
|
||||
| marketing |
|
||||
When user "Alice" removes the folder "folderMain" from space "use-tag"
|
||||
Then the HTTP status code should be "204"
|
||||
When user "Alice" lists all available tags via the GraphApi
|
||||
Then the HTTP status code should be "200"
|
||||
And the response should not contain following tags:
|
||||
| folderTag |
|
||||
| marketing |
|
||||
|
||||
|
||||
Scenario: User lists the tags after deleting a space
|
||||
Given user "Alice" has created the following tags for folder "folderMain" of the space "use-tag":
|
||||
| folderTag |
|
||||
| marketing |
|
||||
And user "Alice" has disabled a space "use-tag"
|
||||
When user "Alice" lists all available tags via the GraphApi
|
||||
Then the HTTP status code should be "200"
|
||||
And the response should contain following tags:
|
||||
| folderTag |
|
||||
| marketing |
|
||||
When user "Alice" deletes a space "use-tag"
|
||||
Then the HTTP status code should be "204"
|
||||
When user "Alice" lists all available tags via the GraphApi
|
||||
Then the HTTP status code should be "200"
|
||||
And the response should not contain following tags:
|
||||
| folderTag |
|
||||
| marketing |
|
||||
|
||||
|
||||
Scenario: User lists the tags after restoring a deleted folder
|
||||
Given user "Alice" has created the following tags for folder "folderMain" of the space "use-tag":
|
||||
| folderTag |
|
||||
| marketing |
|
||||
And user "Alice" has removed the folder "folderMain" from space "use-tag"
|
||||
When user "Alice" restores the folder "folderMain" from the trash of the space "use-tag" to "/folderMain"
|
||||
Then the HTTP status code should be "201"
|
||||
When user "Alice" lists all available tags via the GraphApi
|
||||
Then the HTTP status code should be "200"
|
||||
And the response should contain following tags:
|
||||
| folderTag |
|
||||
| marketing |
|
||||
@@ -21,11 +21,13 @@ Feature: upload resources using TUS protocol
|
||||
|
||||
Scenario: upload a file bigger than the set quota to a project space
|
||||
Given user "Alice" has created a space "Project Jupiter" of type "project" with quota "10"
|
||||
When user "Alice" creates a new TUS resource for the space "Project Jupiter" using the WebDAV API with these headers:
|
||||
| Upload-Length | 100 |
|
||||
When user "Alice" creates a new TUS resource for the space "Project Jupiter" with content "file content is 24 bytes" using the WebDAV API with these headers:
|
||||
| Upload-Length | 24 |
|
||||
# dXBsb2FkLnR4dA== is the base64 encoded value of filename upload.txt
|
||||
| Upload-Metadata | filename dXBsb2FkLnR4dA== |
|
||||
| Tus-Resumable | 1.0.0 |
|
||||
| Upload-Metadata | filename dXBsb2FkLnR4dA== |
|
||||
| Content-Type | application/offset+octet-stream |
|
||||
| Tus-Resumable | 1.0.0 |
|
||||
| Tus-Extension | creation-with-upload |
|
||||
Then the HTTP status code should be "507"
|
||||
And for user "Alice" the space "Project Jupiter" should not contain these entries:
|
||||
| upload.txt |
|
||||
|
||||
@@ -18,7 +18,9 @@ Feature: Upload files into a space
|
||||
|
||||
|
||||
Scenario Outline: An user creates a folder in the Space via the Graph API
|
||||
And user "Alice" has shared a space "Project Ceres" to user "Brian" with role "<role>"
|
||||
Given user "Alice" has shared a space "Project Ceres" with settings:
|
||||
| shareWith | Brian |
|
||||
| role | <role> |
|
||||
When user "Brian" creates a folder "mainFolder" in space "Project Ceres" using the WebDav Api
|
||||
Then the HTTP status code should be "<code>"
|
||||
And for user "Brian" the space "Project Ceres" <shouldOrNot> contain these entries:
|
||||
@@ -31,11 +33,41 @@ Feature: Upload files into a space
|
||||
|
||||
|
||||
Scenario Outline: An user uploads a file in shared Space via the Graph API
|
||||
And user "Alice" has shared a space "Project Ceres" to user "Brian" with role "<role>"
|
||||
Given user "Alice" has shared a space "Project Ceres" with settings:
|
||||
| shareWith | Brian |
|
||||
| role | <role> |
|
||||
When user "Brian" uploads a file inside space "Project Ceres" with content "Test" to "test.txt" using the WebDAV API
|
||||
Then the HTTP status code should be "<code>"
|
||||
And for user "Brian" the space "Project Ceres" <shouldOrNot> contain these entries:
|
||||
| test.txt |
|
||||
And for user "Brian" the JSON response should contain space called "Project Ceres" and match
|
||||
"""
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name",
|
||||
"quota"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"enum": ["Project Ceres"]
|
||||
},
|
||||
"quota": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"used"
|
||||
],
|
||||
"properties": {
|
||||
"used": {
|
||||
"type": "number",
|
||||
"enum": [<usedQuota>]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
And the user "Brian" should have a space called "Project Ceres" with these key and value pairs:
|
||||
| key | value |
|
||||
| name | Project Ceres |
|
||||
|
||||
@@ -3,7 +3,6 @@ Feature: checksums
|
||||
|
||||
Background:
|
||||
Given user "Alice" has been created with default attributes and without skeleton files
|
||||
And the administrator has set the default folder for received shares to "Shares"
|
||||
And auto-accept shares has been disabled
|
||||
And using spaces DAV path
|
||||
And user "Brian" has been created with default attributes and without skeleton files
|
||||
|
||||
@@ -17,7 +17,9 @@ Feature: copy file
|
||||
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 "<role>"
|
||||
And user "Alice" has shared a space "Project" with settings:
|
||||
| shareWith | Brian |
|
||||
| role | <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:
|
||||
@@ -34,7 +36,9 @@ Feature: copy file
|
||||
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"
|
||||
And user "Alice" has shared a space "Project" with settings:
|
||||
| shareWith | Brian |
|
||||
| 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:
|
||||
@@ -46,8 +50,12 @@ Feature: copy file
|
||||
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 "<to_role>"
|
||||
And user "Brian" has shared a space "Project1" to user "Alice" with role "<from_role>"
|
||||
And user "Brian" has shared a space "Project2" with settings:
|
||||
| shareWith | Alice |
|
||||
| role | <to_role> |
|
||||
And user "Brian" has shared a space "Project1" with settings:
|
||||
| shareWith | Alice |
|
||||
| role | <from_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:
|
||||
@@ -66,8 +74,12 @@ Feature: copy file
|
||||
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 "<role>"
|
||||
And user "Brian" has shared a space "Project2" with settings:
|
||||
| shareWith | Alice |
|
||||
| role | viewer |
|
||||
And user "Brian" has shared a space "Project1" with settings:
|
||||
| shareWith | Alice |
|
||||
| role | <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:
|
||||
@@ -82,7 +94,9 @@ Feature: copy file
|
||||
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 "<role>"
|
||||
And user "Brian" has shared a space "Project" with settings:
|
||||
| shareWith | Alice |
|
||||
| role | <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:
|
||||
@@ -100,7 +114,9 @@ Feature: copy file
|
||||
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 "<role>"
|
||||
And user "Brian" has shared a space "Project" with settings:
|
||||
| shareWith | Alice |
|
||||
| role | <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" using the WebDAV API
|
||||
@@ -120,7 +136,9 @@ Feature: copy file
|
||||
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 "<role>"
|
||||
And user "Brian" has shared a space "Project" with settings:
|
||||
| shareWith | Alice |
|
||||
| role | <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" using the WebDAV API
|
||||
@@ -137,7 +155,9 @@ Feature: copy file
|
||||
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 "<role>"
|
||||
And user "Brian" has shared a space "Project" with settings:
|
||||
| shareWith | Alice |
|
||||
| role | <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"
|
||||
@@ -153,7 +173,9 @@ Feature: copy file
|
||||
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 "Brian" has shared a space "Project" with settings:
|
||||
| shareWith | Alice |
|
||||
| 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"
|
||||
@@ -204,7 +226,9 @@ Feature: copy file
|
||||
Scenario Outline: User copies a file from space Shares 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 "<role>"
|
||||
And user "Brian" has shared a space "Project" with settings:
|
||||
| shareWith | Alice |
|
||||
| role | <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 "<permissions>"
|
||||
@@ -225,7 +249,9 @@ Feature: copy file
|
||||
Scenario Outline: User copies a file from space Shares 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 shared a space "Project" with settings:
|
||||
| shareWith | Alice |
|
||||
| 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 "<permissions>"
|
||||
@@ -288,7 +314,9 @@ Feature: copy file
|
||||
And user "Alice" has created a folder "/folder1" in space "Project"
|
||||
And user "Alice" has created a folder "/folder2" in space "Project"
|
||||
And user "Alice" has uploaded a file inside space "Project" with content "some content" to "/folder2/demo.txt"
|
||||
And user "Alice" has shared a space "Project" to user "Brian" with role "<role>"
|
||||
And user "Alice" has shared a space "Project" with settings:
|
||||
| shareWith | Brian |
|
||||
| role | <role> |
|
||||
When user "Brian" copies folder "/folder2" to "/folder1/folder2" inside space "Project" using the WebDAV API
|
||||
Then the HTTP status code should be "<status-code>"
|
||||
And for user "Brian" the space "Project" <shouldOrNot> contain these entries:
|
||||
@@ -306,8 +334,12 @@ Feature: copy file
|
||||
And user "Brian" has created a space "Project2" with the default quota using the GraphApi
|
||||
And user "Brian" has created a folder "/folder1" in space "Project1"
|
||||
And user "Brian" has uploaded a file inside space "Project1" with content "some content" to "/folder1/demo.txt"
|
||||
And user "Brian" has shared a space "Project2" to user "Alice" with role "<to_role>"
|
||||
And user "Brian" has shared a space "Project1" to user "Alice" with role "<from_role>"
|
||||
And user "Brian" has shared a space "Project2" with settings:
|
||||
| shareWith | Alice |
|
||||
| role | <to_role> |
|
||||
And user "Brian" has shared a space "Project1" with settings:
|
||||
| shareWith | Alice |
|
||||
| role | <from_role> |
|
||||
When user "Alice" copies folder "/folder1" from space "Project1" to "/folder1" inside space "Project2" using the WebDAV API
|
||||
Then the HTTP status code should be "<status-code>"
|
||||
And for user "Alice" the space "Project2" <shouldOrNot> contain these entries:
|
||||
@@ -328,7 +360,9 @@ Feature: copy file
|
||||
And user "Brian" has created a space "Project" with the default quota using the GraphApi
|
||||
And user "Brian" has created a folder "/folder1" in space "Project"
|
||||
And user "Brian" has uploaded a file inside space "Project" with content "some content" to "/folder1/demo.txt"
|
||||
And user "Brian" has shared a space "Project" to user "Alice" with role "<role>"
|
||||
And user "Brian" has shared a space "Project" with settings:
|
||||
| shareWith | Alice |
|
||||
| role | <role> |
|
||||
When user "Alice" copies file "/folder1" from space "Project" to "/folder1" 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:
|
||||
@@ -346,7 +380,9 @@ Feature: copy file
|
||||
And user "Brian" has created folder "/testshare"
|
||||
And user "Brian" has created a folder "/folder1" in space "Project"
|
||||
And user "Brian" has uploaded a file inside space "Project" with content "some content" to "/folder1/demo.txt"
|
||||
And user "Brian" has shared a space "Project" to user "Alice" with role "<role>"
|
||||
And user "Brian" has shared a space "Project" with settings:
|
||||
| shareWith | Alice |
|
||||
| role | <role> |
|
||||
And user "Brian" has shared folder "/testshare" with user "Alice" with permissions "<permissions>"
|
||||
And user "Alice" has accepted share "/testshare" offered by user "Brian"
|
||||
When user "Alice" copies folder "/folder1" from space "Project" to "/testshare/folder1" inside space "Shares" using the WebDAV API
|
||||
@@ -366,7 +402,9 @@ Feature: copy file
|
||||
Scenario Outline: User copies a folder 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 "<role>"
|
||||
And user "Brian" has shared a space "Project" with settings:
|
||||
| shareWith | Alice |
|
||||
| role | <role> |
|
||||
And user "Alice" has created folder "/folder1"
|
||||
And user "Alice" has uploaded file with content "some content" to "folder1/demo.txt"
|
||||
When user "Alice" copies folder "/folder1" from space "Personal" to "/folder1" inside space "Project" using the WebDAV API
|
||||
@@ -416,7 +454,9 @@ Feature: copy file
|
||||
Scenario Outline: User copies a folder from space Shares 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 "<role>"
|
||||
And user "Brian" has shared a space "Project" with settings:
|
||||
| shareWith | Alice |
|
||||
| role | <role> |
|
||||
And user "Brian" has created folder "/testshare"
|
||||
And user "Brian" has created folder "/testshare/folder1"
|
||||
And user "Brian" has uploaded file with content "testshare content" to "/testshare/folder1/testshare.txt"
|
||||
@@ -437,7 +477,9 @@ Feature: copy file
|
||||
Scenario Outline: User copies a folder from space Shares 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 shared a space "Project" with settings:
|
||||
| shareWith | Alice |
|
||||
| role | viewer |
|
||||
And user "Brian" has created folder "/testshare"
|
||||
And user "Brian" has created folder "/testshare/folder1"
|
||||
And user "Brian" has uploaded file with content "testshare content" to "/testshare/folder1/testshare.txt"
|
||||
@@ -731,7 +773,10 @@ Feature: copy file
|
||||
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 "/newfolder/personal.txt"
|
||||
And user "Alice" shares the following entity "newfolder" inside of space "Project" with user "Brian" with role "editor"
|
||||
And user "Alice" creates a share inside of space "Project" with settings:
|
||||
| path | newfolder |
|
||||
| shareWith | Brian |
|
||||
| role | editor |
|
||||
And user "Brian" has accepted share "/newfolder" offered by user "Alice"
|
||||
And user "Brian" has uploaded file with content "new content" to "/personal.txt"
|
||||
When user "Brian" copies file "/personal.txt" from space "Personal" to "/newfolder/personal (1).txt" inside space "Shares" using the WebDAV API
|
||||
@@ -751,13 +796,16 @@ Feature: copy file
|
||||
And user "Alice" has created a folder "/newfolder" in space "Project"
|
||||
And user "Alice" has uploaded a file inside space "Project" with content "old content version 1" to "/newfolder/personal.txt"
|
||||
And user "Alice" has uploaded a file inside space "Project" with content "old content version 2" to "/newfolder/personal.txt"
|
||||
And user "Alice" shares the following entity "newfolder" inside of space "Project" with user "Brian" with role "editor"
|
||||
And user "Alice" creates a share inside of space "Project" with settings:
|
||||
| path | newfolder |
|
||||
| shareWith | Brian |
|
||||
| role | editor |
|
||||
And user "Brian" has accepted share "/newfolder" offered by user "Alice"
|
||||
And user "Brian" has uploaded file with content "new content" to "/personal.txt"
|
||||
When user "Brian" overwrites file "/personal.txt" from space "Personal" to "/newfolder/personal.txt" inside space "Shares" while copying using the WebDAV API
|
||||
Then the HTTP status code should be "204"
|
||||
And for user "Alice" the space "Project" should contain these entries:
|
||||
| newfolder/personal.txt |
|
||||
| newfolder/personal.txt |
|
||||
And for user "Alice" the content of the file "/newfolder/personal.txt" of the space "Project" should be "new content"
|
||||
When user "Alice" downloads version of the file "/newfolder/personal.txt" with the index "1" of the space "Project" using the WebDAV API
|
||||
Then the HTTP status code should be "200"
|
||||
|
||||
@@ -17,7 +17,9 @@ Feature: move (rename) file
|
||||
And user "Brian" has created a space "Project" with the default quota using the GraphApi
|
||||
And user "Brian" has created a folder "newfolder" in space "Project"
|
||||
And user "Brian" has uploaded a file inside space "Project" with content "some content" to "insideSpace.txt"
|
||||
And user "Brian" has shared a space "Project" to user "Alice" with role "<role>"
|
||||
And user "Brian" has shared a space "Project" with settings:
|
||||
| shareWith | Alice |
|
||||
| role | <role> |
|
||||
When user "Alice" moves file "insideSpace.txt" to "newfolder/insideSpace.txt" in 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:
|
||||
@@ -35,7 +37,9 @@ Feature: move (rename) file
|
||||
And user "Brian" has created a space "Project" with the default quota using the GraphApi
|
||||
And user "Brian" has created a folder "newfolder" in space "Project"
|
||||
And user "Brian" has uploaded a file inside space "Project" with content "some content" to "insideSpace.txt"
|
||||
And user "Brian" has shared a space "Project" to user "Alice" with role "viewer"
|
||||
And user "Brian" has shared a space "Project" with settings:
|
||||
| shareWith | Alice |
|
||||
| role | viewer |
|
||||
When user "Alice" moves file "insideSpace.txt" to "newfolder/insideSpace.txt" in 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:
|
||||
@@ -49,8 +53,12 @@ Feature: move (rename) file
|
||||
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 "<to_role>"
|
||||
And user "Brian" has shared a space "Project1" to user "Alice" with role "<from_role>"
|
||||
And user "Brian" has shared a space "Project2" with settings:
|
||||
| shareWith | Alice |
|
||||
| role | <to_role> |
|
||||
And user "Brian" has shared a space "Project1" with settings:
|
||||
| shareWith | Alice |
|
||||
| role | <from_role> |
|
||||
When user "Alice" moves file "project1.txt" from space "Project1" to "project1.txt" inside space "Project2" using the WebDAV API
|
||||
Then the HTTP status code should be "<https_status_code>"
|
||||
And for user "Alice" the space "Project1" should contain these entries:
|
||||
@@ -74,7 +82,9 @@ Feature: move (rename) file
|
||||
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 "<role>"
|
||||
And user "Brian" has shared a space "Project" with settings:
|
||||
| shareWith | Alice |
|
||||
| role | <role> |
|
||||
When user "Alice" moves file "project.txt" from space "Project" to "project.txt" inside space "Personal" using the WebDAV API
|
||||
Then the HTTP status code should be "<https_status_code>"
|
||||
And for user "Alice" the space "Project" should contain these entries:
|
||||
@@ -93,7 +103,9 @@ Feature: move (rename) file
|
||||
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 "<role>"
|
||||
And user "Brian" has shared a space "Project" with settings:
|
||||
| shareWith | Alice |
|
||||
| role | <role> |
|
||||
And user "Brian" has shared folder "/testshare" with user "Alice" with permissions "<permissions>"
|
||||
And user "Alice" has accepted share "/testshare" offered by user "Brian"
|
||||
When user "Alice" moves file "project.txt" from space "Project" to "/testshare/project.txt" inside space "Shares" using the WebDAV API
|
||||
@@ -115,7 +127,9 @@ Feature: move (rename) file
|
||||
Scenario Outline: User moves 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 "<role>"
|
||||
And user "Brian" has shared a space "Project" with settings:
|
||||
| shareWith | Alice |
|
||||
| role | <role> |
|
||||
And user "Alice" has uploaded file with content "personal space content" to "/personal.txt"
|
||||
When user "Alice" moves file "personal.txt" from space "Personal" to "personal.txt" inside space "Project" using the WebDAV API
|
||||
Then the HTTP status code should be "<https_status_code>"
|
||||
@@ -169,7 +183,9 @@ Feature: move (rename) file
|
||||
Scenario Outline: User moves a file from space Shares with different role (permissions) 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 "<role>"
|
||||
And user "Brian" has shared a space "Project" with settings:
|
||||
| shareWith | Alice |
|
||||
| role | <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 "<permissions>"
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
@api @skipOnOcV10
|
||||
Feature: Public can download folders from project space public link
|
||||
As a public
|
||||
I want to be able to download folder from public link
|
||||
So that I can gain access to it's contents
|
||||
|
||||
Background:
|
||||
Given these users have been created with default attributes and without skeleton files:
|
||||
| username |
|
||||
| Alice |
|
||||
| Brian |
|
||||
And using spaces DAV path
|
||||
And the administrator has given "Alice" the role "Space Admin" using the settings api
|
||||
And user "Alice" has created a space "new-space" with the default quota using the GraphApi
|
||||
|
||||
|
||||
Scenario: download a folder from public link of a space
|
||||
Given user "Alice" has created a folder "NewFolder" in space "new-space"
|
||||
And user "Alice" has uploaded a file inside space "new-space" with content "some content" to "NewFolder/test.txt"
|
||||
And user "Alice" has created a public link share of the space "new-space" with settings:
|
||||
| permissions | 1 |
|
||||
| name | someName |
|
||||
When public downloads the folder "NewFolder" from the last created public link using the public files API
|
||||
Then the HTTP status code should be "200"
|
||||
And the downloaded tar archive should contain these files:
|
||||
| name | content |
|
||||
| NewFolder/test.txt | some content |
|
||||
|
||||
@issue-5229
|
||||
Scenario: download a folder from public link of a folder inside a space
|
||||
Given user "Alice" has created a folder "NewFolder" in space "new-space"
|
||||
And user "Alice" has created a folder "NewFolder/folder" in space "new-space"
|
||||
And user "Alice" has uploaded a file inside space "new-space" with content "some content" to "NewFolder/folder/test.txt"
|
||||
And user "Alice" has created a public link share inside of space "new-space" with settings:
|
||||
| path | NewFolder |
|
||||
| shareType | 3 |
|
||||
| permissions | 1 |
|
||||
| name | public link |
|
||||
When public downloads the folder "folder" from the last created public link using the public files API
|
||||
Then the HTTP status code should be "200"
|
||||
And the downloaded tar archive should contain these files:
|
||||
| name | content |
|
||||
| folder/test.txt | some content |
|
||||
@@ -17,16 +17,38 @@ Feature: Share spaces
|
||||
And using spaces DAV path
|
||||
|
||||
|
||||
Scenario Outline:: A Space Admin can share a space to another user
|
||||
When user "Alice" shares a space "share space" to user "Brian" with role "<role>"
|
||||
Scenario Outline: A Space Admin can share a space to another user
|
||||
When user "Alice" shares a space "share space" with settings:
|
||||
| shareWith | Brian |
|
||||
| role | <role> |
|
||||
Then the HTTP status code should be "200"
|
||||
And the OCS status code should be "200"
|
||||
And the OCS status message should be "OK"
|
||||
And the user "Brian" should have a space called "share space" with these key and value pairs:
|
||||
| key | value |
|
||||
| driveType | project |
|
||||
| id | %space_id% |
|
||||
| name | share space |
|
||||
And for user "Brian" the JSON response should contain space called "share space" and match
|
||||
"""
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name",
|
||||
"driveType",
|
||||
"id"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"enum": ["share space"]
|
||||
},
|
||||
"driveType": {
|
||||
"type": "string",
|
||||
"enum": ["project"]
|
||||
},
|
||||
"id": {
|
||||
"type": "string",
|
||||
"pattern": "^%space_id_pattern%$"
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
Examples:
|
||||
| role |
|
||||
| manager |
|
||||
@@ -35,43 +57,99 @@ Feature: Share spaces
|
||||
|
||||
|
||||
Scenario: A user can see who has been granted access
|
||||
Given user "Alice" has shared a space "share space" to user "Brian" with role "viewer"
|
||||
And the user "Alice" should have a space called "share space" granted to "Brian" with these key and value pairs:
|
||||
| key | value |
|
||||
| root@@@permissions@@@1@@@grantedTo@@@0@@@user@@@id | %user_id% |
|
||||
| root@@@permissions@@@1@@@roles@@@0 | viewer |
|
||||
When user "Alice" shares a space "share space" with settings:
|
||||
| shareWith | Brian |
|
||||
| role | viewer |
|
||||
Then the user "Alice" should have a space called "share space" granted to user "Brian" with role "viewer"
|
||||
|
||||
@skipOnStable2.0
|
||||
Scenario: A user can see that the group has been granted access
|
||||
Given group "sales" has been created
|
||||
When user "Alice" shares a space "share space" with settings:
|
||||
| shareWith | sales |
|
||||
| shareType | 8 |
|
||||
| role | viewer |
|
||||
Then the HTTP status code should be "200"
|
||||
And the OCS status code should be "200"
|
||||
And the user "Alice" should have a space called "share space" granted to group "sales" with role "viewer"
|
||||
|
||||
|
||||
Scenario: A user can see a file in a received shared space
|
||||
Given user "Alice" has uploaded a file inside space "share space" with content "Test" to "test.txt"
|
||||
And user "Alice" has created a folder "Folder Main" in space "share space"
|
||||
When user "Alice" shares a space "share space" to user "Brian" with role "viewer"
|
||||
When user "Alice" shares a space "share space" with settings:
|
||||
| shareWith | Brian |
|
||||
| role | viewer |
|
||||
Then for user "Brian" the space "share space" should contain these entries:
|
||||
| test.txt |
|
||||
| Folder Main |
|
||||
|
||||
|
||||
Scenario: When a user unshares a space, the space becomes unavailable to the receiver
|
||||
Given user "Alice" has shared a space "share space" to user "Brian" with role "viewer"
|
||||
And the user "Brian" should have a space called "share space" with these key and value pairs:
|
||||
| key | value |
|
||||
| driveType | project |
|
||||
| id | %space_id% |
|
||||
| name | share space |
|
||||
Given user "Alice" has shared a space "share space" with settings:
|
||||
| shareWith | Brian |
|
||||
| role | viewer |
|
||||
And for user "Brian" the JSON response should contain space called "share space" and match
|
||||
"""
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name",
|
||||
"driveType",
|
||||
"id"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"enum": ["share space"]
|
||||
},
|
||||
"driveType": {
|
||||
"type": "string",
|
||||
"enum": ["project"]
|
||||
},
|
||||
"id": {
|
||||
"type": "string",
|
||||
"pattern": "^%space_id_pattern%$"
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
When user "Alice" unshares a space "share space" to user "Brian"
|
||||
Then the HTTP status code should be "200"
|
||||
Then the user "Brian" should not have a space called "share space"
|
||||
But the user "Brian" should not have a space called "share space"
|
||||
|
||||
|
||||
Scenario Outline: Owner of a space cannot see the space after removing his access to the space
|
||||
Given user "Alice" has shared a space "share space" to user "Brian" with role "manager"
|
||||
Given user "Alice" has shared a space "share space" with settings:
|
||||
| shareWith | Brian |
|
||||
| role | manager |
|
||||
When user "<user>" unshares a space "share space" to user "Alice"
|
||||
Then the HTTP status code should be "200"
|
||||
And the user "Brian" should have a space called "share space" owned by "Alice" with these key and value pairs:
|
||||
| key | value |
|
||||
| driveType | project |
|
||||
| id | %space_id% |
|
||||
| name | share space |
|
||||
And for user "Brian" the JSON response should contain space called "share space" owned by "Alice" and match
|
||||
"""
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name",
|
||||
"driveType",
|
||||
"id"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"enum": ["share space"]
|
||||
},
|
||||
"driveType": {
|
||||
"type": "string",
|
||||
"enum": ["project"]
|
||||
},
|
||||
"id": {
|
||||
"type": "string",
|
||||
"pattern": "^%space_id_pattern%$"
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
But the user "Alice" should not have a space called "share space"
|
||||
Examples:
|
||||
| user |
|
||||
@@ -81,9 +159,13 @@ Feature: Share spaces
|
||||
|
||||
Scenario: A user can add another user to the space managers to enable him
|
||||
Given user "Alice" has uploaded a file inside space "share space" with content "Test" to "test.txt"
|
||||
When user "Alice" shares a space "share space" to user "Brian" with role "manager"
|
||||
When user "Alice" shares a space "share space" with settings:
|
||||
| shareWith | Brian |
|
||||
| role | manager |
|
||||
Then the user "Brian" should have a space called "share space" granted to "Brian" with role "manager"
|
||||
When user "Brian" shares a space "share space" to user "Bob" with role "viewer"
|
||||
When user "Brian" shares a space "share space" with settings:
|
||||
| shareWith | Bob |
|
||||
| role | viewer |
|
||||
Then the user "Bob" should have a space called "share space" granted to "Bob" with role "viewer"
|
||||
And for user "Bob" the space "share space" should contain these entries:
|
||||
| test.txt |
|
||||
@@ -91,11 +173,13 @@ Feature: Share spaces
|
||||
|
||||
Scenario Outline: A user cannot share a disabled space to another user
|
||||
Given user "Alice" has disabled a space "share space"
|
||||
When user "Alice" shares a space "share space" to user "Brian" with role "<role>"
|
||||
When user "Alice" shares a space "share space" with settings:
|
||||
| shareWith | Brian |
|
||||
| role | <role> |
|
||||
Then the HTTP status code should be "404"
|
||||
And the OCS status code should be "404"
|
||||
And the OCS status message should be "Wrong path, file/folder doesn't exist"
|
||||
And the user "Brian" should not have a space called "share space"
|
||||
But the user "Brian" should not have a space called "share space"
|
||||
Examples:
|
||||
| role |
|
||||
| manager |
|
||||
@@ -104,16 +188,40 @@ Feature: Share spaces
|
||||
|
||||
|
||||
Scenario Outline: A user with manager role can share a space to another user
|
||||
Given user "Alice" has shared a space "share space" to user "Brian" with role "manager"
|
||||
When user "Brian" shares a space "share space" to user "Bob" with role "<role>"
|
||||
Given user "Alice" has shared a space "share space" with settings:
|
||||
| shareWith | Brian |
|
||||
| role | manager |
|
||||
When user "Brian" shares a space "share space" with settings:
|
||||
| shareWith | Bob |
|
||||
| role | <role> |
|
||||
Then the HTTP status code should be "200"
|
||||
And the OCS status code should be "200"
|
||||
And the OCS status message should be "OK"
|
||||
And the user "Bob" should have a space called "share space" with these key and value pairs:
|
||||
| key | value |
|
||||
| driveType | project |
|
||||
| id | %space_id% |
|
||||
| name | share space |
|
||||
And for user "Brian" the JSON response should contain space called "share space" and match
|
||||
"""
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name",
|
||||
"driveType",
|
||||
"id"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"enum": ["share space"]
|
||||
},
|
||||
"driveType": {
|
||||
"type": "string",
|
||||
"enum": ["project"]
|
||||
},
|
||||
"id": {
|
||||
"type": "string",
|
||||
"pattern": "^%space_id_pattern%$"
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
Examples:
|
||||
| role |
|
||||
| manager |
|
||||
@@ -122,8 +230,12 @@ Feature: Share spaces
|
||||
|
||||
|
||||
Scenario Outline: A user with editor or viewer role cannot share a space to another user
|
||||
Given user "Alice" has shared a space "share space" to user "Brian" with role "<role>"
|
||||
When user "Brian" shares a space "share space" to user "Bob" with role "<new_role>"
|
||||
Given user "Alice" has shared a space "share space" with settings:
|
||||
| shareWith | Brian |
|
||||
| role | <role> |
|
||||
When user "Brian" shares a space "share space" with settings:
|
||||
| shareWith | Bob |
|
||||
| role | <new_role> |
|
||||
Then the HTTP status code should be "404"
|
||||
And the OCS status code should be "404"
|
||||
And the OCS status message should be "No share permission"
|
||||
@@ -139,8 +251,12 @@ Feature: Share spaces
|
||||
|
||||
|
||||
Scenario Outline: space manager can change the role of space members
|
||||
Given user "Alice" has shared a space "share space" to user "Brian" with role "<role>"
|
||||
When user "Alice" updates the space "share space" for user "Brian" changing the role to "<new_role>"
|
||||
Given user "Alice" has shared a space "share space" with settings:
|
||||
| shareWith | Brian |
|
||||
| role | <role> |
|
||||
When user "Alice" shares a space "share space" with settings:
|
||||
| shareWith | Brian |
|
||||
| role | <new_role> |
|
||||
Then the HTTP status code should be "200"
|
||||
And the OCS status code should be "200"
|
||||
And the user "Alice" should have a space called "share space" granted to "Brian" with role "<new_role>"
|
||||
@@ -155,9 +271,15 @@ Feature: Share spaces
|
||||
|
||||
|
||||
Scenario Outline: user without manager role cannot change the role of space members
|
||||
Given user "Alice" has shared a space "share space" to user "Brian" with role "<role>"
|
||||
And user "Alice" has shared a space "share space" to user "Bob" with role "viewer"
|
||||
When user "Brian" updates the space "share space" for user "Bob" changing the role to "<new_role>"
|
||||
Given user "Alice" has shared a space "share space" with settings:
|
||||
| shareWith | Brian |
|
||||
| role | <role> |
|
||||
And user "Alice" has shared a space "share space" with settings:
|
||||
| shareWith | Bob |
|
||||
| role | viewer |
|
||||
When user "Brian" updates the space "share space" with settings:
|
||||
| shareWith | Bob |
|
||||
| role | <new_role> |
|
||||
Then the HTTP status code should be "404"
|
||||
And the OCS status code should be "404"
|
||||
And the user "Alice" should have a space called "share space" granted to "Bob" with role "viewer"
|
||||
@@ -167,3 +289,318 @@ Feature: Share spaces
|
||||
| editor | viewer |
|
||||
| viewer | manager |
|
||||
| viewer | editor |
|
||||
|
||||
@skipOnStable2.0
|
||||
Scenario Outline: A user shares a space with a group
|
||||
Given group "group2" has been created
|
||||
And the administrator has added a user "Brian" to the group "group2" using GraphApi
|
||||
And the administrator has added a user "Bob" to the group "group2" using GraphApi
|
||||
When user "Alice" shares a space "share space" with settings:
|
||||
| shareWith | group2 |
|
||||
| shareType | 8 |
|
||||
| role | <role> |
|
||||
Then the HTTP status code should be "200"
|
||||
And for user "Brian" the JSON response should contain space called "share space" and match
|
||||
"""
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name",
|
||||
"driveType",
|
||||
"id"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"enum": ["share space"]
|
||||
},
|
||||
"driveType": {
|
||||
"type": "string",
|
||||
"enum": ["project"]
|
||||
},
|
||||
"id": {
|
||||
"type": "string",
|
||||
"pattern": "^%space_id_pattern%$"
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
And for user "Bob" the JSON response should contain space called "share space" and match
|
||||
"""
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name",
|
||||
"driveType",
|
||||
"id"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"enum": ["share space"]
|
||||
},
|
||||
"driveType": {
|
||||
"type": "string",
|
||||
"enum": ["project"]
|
||||
},
|
||||
"id": {
|
||||
"type": "string",
|
||||
"pattern": "^%space_id_pattern%$"
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
Examples:
|
||||
| role |
|
||||
| manager |
|
||||
| editor |
|
||||
| viewer |
|
||||
|
||||
@skipOnStable2.0
|
||||
Scenario Outline: The user has no access to the space if access for the group has been removed
|
||||
Given group "group2" has been created
|
||||
And the administrator has added a user "Brian" to the group "group2" using GraphApi
|
||||
And user "Alice" has shared a space "share space" with settings:
|
||||
| shareWith | group2 |
|
||||
| shareType | 8 |
|
||||
| role | <role> |
|
||||
When user "Alice" unshares a space "share space" to group "group2"
|
||||
Then the HTTP status code should be "200"
|
||||
And the user "Brian" should not have a space called "share space"
|
||||
Examples:
|
||||
| role |
|
||||
| manager |
|
||||
| editor |
|
||||
| viewer |
|
||||
|
||||
@skipOnStable2.0
|
||||
Scenario: The user has no access to the space if he has been removed from the group
|
||||
Given group "group2" has been created
|
||||
And the administrator has added a user "Brian" to the group "group2" using GraphApi
|
||||
And the administrator has added a user "Bob" to the group "group2" using GraphApi
|
||||
And user "Alice" has shared a space "share space" with settings:
|
||||
| shareWith | group2 |
|
||||
| shareType | 8 |
|
||||
| role | editor |
|
||||
When the administrator removes the following users from the following groups using the Graph API
|
||||
| username | groupname |
|
||||
| Brian | group2 |
|
||||
Then the HTTP status code of responses on all endpoints should be "204"
|
||||
And the user "Brian" should not have a space called "share space"
|
||||
But for user "Bob" the JSON response should contain space called "share space" and match
|
||||
"""
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name",
|
||||
"driveType",
|
||||
"id"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"enum": ["share space"]
|
||||
},
|
||||
"driveType": {
|
||||
"type": "string",
|
||||
"enum": ["project"]
|
||||
},
|
||||
"id": {
|
||||
"type": "string",
|
||||
"pattern": "^%space_id_pattern%$"
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
||||
@skipOnStable2.0
|
||||
Scenario: Users don't have access to the space if the group has been deleted
|
||||
Given group "group2" has been created
|
||||
And the administrator has added a user "Brian" to the group "group2" using GraphApi
|
||||
And the administrator has added a user "Bob" to the group "group2" using GraphApi
|
||||
And user "Alice" has shared a space "share space" with settings:
|
||||
| shareWith | group2 |
|
||||
| shareType | 8 |
|
||||
| role | editor |
|
||||
When the administrator deletes group "group2" using the Graph API
|
||||
Then the HTTP status code should be "204"
|
||||
And the user "Bob" should not have a space called "share space"
|
||||
And the user "Brian" should not have a space called "share space"
|
||||
|
||||
@skipOnStable2.0
|
||||
Scenario: User increases permissions for one member of the group or for the entire group
|
||||
Given group "sales" has been created
|
||||
And the administrator has added a user "Brian" to the group "sales" using GraphApi
|
||||
And user "Alice" has shared a space "share space" with settings:
|
||||
| shareWith | sales |
|
||||
| shareType | 8 |
|
||||
| role | viewer |
|
||||
When user "Brian" uploads a file inside space "share space" with content "Test" to "test.txt" using the WebDAV API
|
||||
Then the HTTP status code should be "403"
|
||||
When user "Alice" shares a space "share space" with settings:
|
||||
| shareWith | Brian |
|
||||
| role | editor |
|
||||
Then the HTTP status code should be "200"
|
||||
When user "Brian" uploads a file inside space "share space" with content "Test" to "test.txt" using the WebDAV API
|
||||
Then the HTTP status code should be "201"
|
||||
|
||||
@skipOnStable2.0
|
||||
Scenario: User increases permissions for the group, so the user's permissions are increased
|
||||
Given group "sales" has been created
|
||||
And the administrator has added a user "Brian" to the group "sales" using GraphApi
|
||||
And user "Alice" has shared a space "share space" with settings:
|
||||
| shareWith | Brian |
|
||||
| role | viewer |
|
||||
When user "Brian" uploads a file inside space "share space" with content "Test" to "test.txt" using the WebDAV API
|
||||
Then the HTTP status code should be "403"
|
||||
When user "Alice" shares a space "share space" with settings:
|
||||
| shareWith | sales |
|
||||
| shareType | 8 |
|
||||
| role | editor |
|
||||
Then the HTTP status code should be "200"
|
||||
When user "Brian" uploads a file inside space "share space" with content "Test" to "test.txt" using the WebDAV API
|
||||
Then the HTTP status code should be "201"
|
||||
|
||||
|
||||
Scenario Outline: A Space Admin can share a space to the user with an expiration date
|
||||
When user "Alice" shares a space "share space" with settings:
|
||||
| shareWith | Brian |
|
||||
| role | <role> |
|
||||
| expireDate | 2042-03-25T23:59:59+0100 |
|
||||
Then the HTTP status code should be "200"
|
||||
And the user "Brian" should have a space called "share space" granted to user "Brian" with role "<role>" and expiration date "2042-03-25"
|
||||
Examples:
|
||||
| role |
|
||||
| manager |
|
||||
| editor |
|
||||
| viewer |
|
||||
|
||||
@skipOnStable2.0
|
||||
Scenario Outline: A Space Admin can share a space to the group with an expiration date
|
||||
Given group "sales" has been created
|
||||
And the administrator has added a user "Brian" to the group "sales" using GraphApi
|
||||
When user "Alice" shares a space "share space" with settings:
|
||||
| shareWith | sales |
|
||||
| shareType | 8 |
|
||||
| role | <role> |
|
||||
| expireDate | 2042-03-25T23:59:59+0100 |
|
||||
Then the HTTP status code should be "200"
|
||||
And the user "Brian" should have a space called "share space" granted to group "sales" with role "<role>" and expiration date "2042-03-25"
|
||||
Examples:
|
||||
| role |
|
||||
| manager |
|
||||
| editor |
|
||||
| viewer |
|
||||
|
||||
|
||||
Scenario Outline: update the expiration date of a space in user share
|
||||
Given user "Alice" has shared a space "share space" with settings:
|
||||
| shareWith | Brian |
|
||||
| role | <role> |
|
||||
| expireDate | 2042-03-25T23:59:59+0100 |
|
||||
When user "Alice" updates the space "share space" with settings:
|
||||
| shareWith | Brian |
|
||||
| expireDate | 2044-01-01T23:59:59.999+01:00 |
|
||||
| role | <role> |
|
||||
Then the HTTP status code should be "200"
|
||||
And the user "Brian" should have a space called "share space" granted to user "Brian" with role "<role>" and expiration date "2044-01-01"
|
||||
Examples:
|
||||
| role |
|
||||
| manager |
|
||||
| editor |
|
||||
| viewer |
|
||||
|
||||
@skipOnStable2.0
|
||||
Scenario Outline: update the expiration date of a space in group share
|
||||
Given group "sales" has been created
|
||||
And the administrator has added a user "Brian" to the group "sales" using GraphApi
|
||||
And user "Alice" has shared a space "share space" with settings:
|
||||
| shareWith | sales |
|
||||
| shareType | 8 |
|
||||
| role | <role> |
|
||||
| expireDate | 2042-03-25T23:59:59+0100 |
|
||||
When user "Alice" updates the space "share space" with settings:
|
||||
| shareWith | sales |
|
||||
| shareType | 8 |
|
||||
| expireDate | 2044-01-01T23:59:59.999+01:00 |
|
||||
| role | <role> |
|
||||
Then the HTTP status code should be "200"
|
||||
And the user "Brian" should have a space called "share space" granted to group "sales" with role "<role>" and expiration date "2044-01-01"
|
||||
Examples:
|
||||
| role |
|
||||
| manager |
|
||||
| editor |
|
||||
| viewer |
|
||||
|
||||
|
||||
Scenario Outline: delete the expiration date of a space in user share
|
||||
Given user "Alice" has shared a space "share space" with settings:
|
||||
| shareWith | Brian |
|
||||
| role | <role> |
|
||||
| expireDate | 2042-03-25T23:59:59+0100 |
|
||||
When user "Alice" updates the space "share space" with settings:
|
||||
| shareWith | Brian |
|
||||
| expireDate | |
|
||||
| role | <role> |
|
||||
Then the HTTP status code should be "200"
|
||||
And the user "Brian" should have a space called "share space" granted to user "Brian" with role "<role>" and expiration date ""
|
||||
Examples:
|
||||
| role |
|
||||
| manager |
|
||||
| editor |
|
||||
| viewer |
|
||||
|
||||
@skipOnStable2.0
|
||||
Scenario Outline: update the expiration date of a space in group share
|
||||
Given group "sales" has been created
|
||||
And the administrator has added a user "Brian" to the group "sales" using GraphApi
|
||||
And user "Alice" has shared a space "share space" with settings:
|
||||
| shareWith | sales |
|
||||
| shareType | 8 |
|
||||
| role | <role> |
|
||||
| expireDate | 2042-03-25T23:59:59+0100 |
|
||||
When user "Alice" updates the space "share space" with settings:
|
||||
| shareWith | sales |
|
||||
| shareType | 8 |
|
||||
| expireDate | |
|
||||
| role | <role> |
|
||||
Then the HTTP status code should be "200"
|
||||
And the user "Brian" should have a space called "share space" granted to group "sales" with role "<role>" and expiration date ""
|
||||
Examples:
|
||||
| role |
|
||||
| manager |
|
||||
| editor |
|
||||
| viewer |
|
||||
|
||||
@skipOnStable2.0
|
||||
Scenario Outline: check the end of expiration of a space in user share
|
||||
Given user "Alice" has shared a space "share space" with settings:
|
||||
| shareWith | Brian |
|
||||
| role | <role> |
|
||||
| expireDate | 2042-03-25T23:59:59+0100 |
|
||||
When user "Alice" expires the user share of space "share space" for user "Brian"
|
||||
Then the HTTP status code should be "200"
|
||||
And the user "Brian" should not have a space called "share space"
|
||||
Examples:
|
||||
| role |
|
||||
| manager |
|
||||
| editor |
|
||||
| viewer |
|
||||
|
||||
@skipOnStable2.0
|
||||
Scenario Outline: check the end of expiration of a space in group share
|
||||
Given group "sales" has been created
|
||||
And the administrator has added a user "Brian" to the group "sales" using GraphApi
|
||||
And user "Alice" has shared a space "share space" with settings:
|
||||
| shareWith | sales |
|
||||
| shareType | 8 |
|
||||
| role | <role> |
|
||||
| expireDate | 2042-03-25T23:59:59+0100 |
|
||||
When user "Alice" expires the group share of space "share space" for group "sales"
|
||||
Then the HTTP status code should be "200"
|
||||
And the user "Brian" should not have a space called "share space"
|
||||
Examples:
|
||||
| role |
|
||||
| manager |
|
||||
| editor |
|
||||
| viewer |
|
||||
@@ -1,103 +1,107 @@
|
||||
@api @skipOnOcV10
|
||||
Feature: Share spaces via link
|
||||
As the manager of a space
|
||||
I want to be able to share a space via public link
|
||||
As the manager of a space
|
||||
I want to be able to share a space via public link
|
||||
|
||||
Note - this feature is run in CI with ACCOUNTS_HASH_DIFFICULTY set to the default for production
|
||||
See https://github.com/owncloud/ocis/issues/1542 and https://github.com/owncloud/ocis/pull/839
|
||||
Note - this feature is run in CI with ACCOUNTS_HASH_DIFFICULTY set to the default for production
|
||||
See https://github.com/owncloud/ocis/issues/1542 and https://github.com/owncloud/ocis/pull/839
|
||||
|
||||
Background:
|
||||
Given these users have been created with default attributes and without skeleton files:
|
||||
| username |
|
||||
| Alice |
|
||||
| Brian |
|
||||
And using spaces DAV path
|
||||
And the administrator has given "Alice" the role "Space Admin" using the settings api
|
||||
And user "Alice" has created a space "share space" with the default quota using the GraphApi
|
||||
And user "Alice" has uploaded a file inside space "share space" with content "some content" to "test.txt"
|
||||
Background:
|
||||
Given these users have been created with default attributes and without skeleton files:
|
||||
| username |
|
||||
| Alice |
|
||||
| Brian |
|
||||
And using spaces DAV path
|
||||
And the administrator has given "Alice" the role "Space Admin" using the settings api
|
||||
And user "Alice" has created a space "share space" with the default quota using the GraphApi
|
||||
And user "Alice" has uploaded a file inside space "share space" with content "some content" to "test.txt"
|
||||
|
||||
|
||||
Scenario Outline: A manager can share a space to public via link with different permissions
|
||||
When user "Alice" creates a public link share of the space "share space" with settings:
|
||||
| permissions | <permissions> |
|
||||
| password | <password> |
|
||||
| name | <linkName> |
|
||||
| expireDate | <expireDate> |
|
||||
Then the HTTP status code should be "200"
|
||||
And the OCS status code should be "200"
|
||||
And the OCS status message should be "OK"
|
||||
And the fields of the last response to user "Alice" should include
|
||||
| item_type | folder |
|
||||
| mimetype | httpd/unix-directory |
|
||||
| file_target | / |
|
||||
| path | / |
|
||||
| permissions | <expectedPermissions> |
|
||||
| share_type | public_link |
|
||||
| displayname_owner | %displayname% |
|
||||
| uid_owner | %username% |
|
||||
| name | <linkName> |
|
||||
And the public should be able to download file "/test.txt" from inside the last public link shared folder using the new public WebDAV API with password "<password>"
|
||||
And the downloaded content should be "some content"
|
||||
But the public should not be able to download file "/test.txt" from inside the last public link shared folder using the new public WebDAV API with password "wrong pass"
|
||||
Examples:
|
||||
| permissions | expectedPermissions | password | linkName | expireDate |
|
||||
| 1 | read | 123234 | link | 2042-03-25T23:59:59+0100 |
|
||||
| 5 | read,create | qwerty 123 | | 2042-03-25T23:59:59+0100 |
|
||||
| 15 | read,update,create,delete | d*V^o*Y03R9n8Z | link | |
|
||||
Scenario Outline: A manager can share a space to public via link with different permissions
|
||||
When user "Alice" creates a public link share of the space "share space" with settings:
|
||||
| permissions | <permissions> |
|
||||
| password | <password> |
|
||||
| name | <linkName> |
|
||||
| expireDate | <expireDate> |
|
||||
Then the HTTP status code should be "200"
|
||||
And the OCS status code should be "200"
|
||||
And the OCS status message should be "OK"
|
||||
And the fields of the last response to user "Alice" should include
|
||||
| item_type | folder |
|
||||
| mimetype | httpd/unix-directory |
|
||||
| file_target | / |
|
||||
| path | / |
|
||||
| permissions | <expectedPermissions> |
|
||||
| share_type | public_link |
|
||||
| displayname_owner | %displayname% |
|
||||
| uid_owner | %username% |
|
||||
| name | <linkName> |
|
||||
And the public should be able to download file "/test.txt" from inside the last public link shared folder using the new public WebDAV API with password "<password>"
|
||||
And the downloaded content should be "some content"
|
||||
But the public should not be able to download file "/test.txt" from inside the last public link shared folder using the new public WebDAV API with password "wrong pass"
|
||||
Examples:
|
||||
| permissions | expectedPermissions | password | linkName | expireDate |
|
||||
| 1 | read | 123234 | link | 2042-03-25T23:59:59+0100 |
|
||||
| 5 | read,create | qwerty 123 | | 2042-03-25T23:59:59+0100 |
|
||||
| 15 | read,update,create,delete | d*V^o*Y03R9n8Z | link | |
|
||||
|
||||
|
||||
Scenario: An uploader should be able to upload a file
|
||||
When user "Alice" creates a public link share of the space "share space" with settings:
|
||||
| permissions | 4 |
|
||||
| password | 123 |
|
||||
| name | forUpload |
|
||||
| expireDate | 2042-03-25T23:59:59+0100 |
|
||||
Then the HTTP status code should be "200"
|
||||
And the OCS status code should be "200"
|
||||
And the OCS status message should be "OK"
|
||||
And the fields of the last response to user "Alice" should include
|
||||
| item_type | folder |
|
||||
| mimetype | httpd/unix-directory |
|
||||
| file_target | / |
|
||||
| path | / |
|
||||
| permissions | create |
|
||||
| share_type | public_link |
|
||||
| displayname_owner | %displayname% |
|
||||
| uid_owner | %username% |
|
||||
| name | forUpload |
|
||||
And the public should be able to upload file "lorem.txt" into the last public link shared folder using the new public WebDAV API with password "123"
|
||||
And for user "Alice" the space "share space" should contain these entries:
|
||||
| lorem.txt |
|
||||
Scenario: An uploader should be able to upload a file
|
||||
When user "Alice" creates a public link share of the space "share space" with settings:
|
||||
| permissions | 4 |
|
||||
| password | 123 |
|
||||
| name | forUpload |
|
||||
| expireDate | 2042-03-25T23:59:59+0100 |
|
||||
Then the HTTP status code should be "200"
|
||||
And the OCS status code should be "200"
|
||||
And the OCS status message should be "OK"
|
||||
And the fields of the last response to user "Alice" should include
|
||||
| item_type | folder |
|
||||
| mimetype | httpd/unix-directory |
|
||||
| file_target | / |
|
||||
| path | / |
|
||||
| permissions | create |
|
||||
| share_type | public_link |
|
||||
| displayname_owner | %displayname% |
|
||||
| uid_owner | %username% |
|
||||
| name | forUpload |
|
||||
And the public should be able to upload file "lorem.txt" into the last public link shared folder using the new public WebDAV API with password "123"
|
||||
And for user "Alice" the space "share space" should contain these entries:
|
||||
| lorem.txt |
|
||||
|
||||
|
||||
Scenario Outline: An user without manager role cannot share a space to public via link
|
||||
Given user "Alice" has shared a space "share space" to user "Brian" with role "<role>"
|
||||
When user "Brian" creates a public link share of the space "share space" with settings:
|
||||
| permissions | 1 |
|
||||
Then the HTTP status code should be "404"
|
||||
And the OCS status code should be "404"
|
||||
And the OCS status message should be "No share permission"
|
||||
And for user "Alice" the space "share space" should not contain the last created public link
|
||||
Examples:
|
||||
| role |
|
||||
| viewer |
|
||||
| editor |
|
||||
Scenario Outline: An user without manager role cannot share a space to public via link
|
||||
Given user "Alice" has shared a space "share space" with settings:
|
||||
| shareWith | Brian |
|
||||
| role | <role> |
|
||||
When user "Brian" creates a public link share of the space "share space" with settings:
|
||||
| permissions | 1 |
|
||||
Then the HTTP status code should be "404"
|
||||
And the OCS status code should be "404"
|
||||
And the OCS status message should be "No share permission"
|
||||
And for user "Alice" the space "share space" should not contain the last created public link
|
||||
Examples:
|
||||
| role |
|
||||
| viewer |
|
||||
| editor |
|
||||
|
||||
|
||||
Scenario: An user with manager role can share a space to public via link
|
||||
Given user "Alice" has shared a space "share space" to user "Brian" with role "manager"
|
||||
When user "Brian" creates a public link share of the space "share space" with settings:
|
||||
| permissions | 1 |
|
||||
Then the HTTP status code should be "200"
|
||||
And the OCS status code should be "200"
|
||||
And for user "Alice" the space "share space" should contain the last created public link
|
||||
Scenario: An user with manager role can share a space to public via link
|
||||
Given user "Alice" has shared a space "share space" with settings:
|
||||
| shareWith | Brian |
|
||||
| role | manager |
|
||||
When user "Brian" creates a public link share of the space "share space" with settings:
|
||||
| permissions | 1 |
|
||||
Then the HTTP status code should be "200"
|
||||
And the OCS status code should be "200"
|
||||
And for user "Alice" the space "share space" should contain the last created public link
|
||||
|
||||
|
||||
Scenario: A user cannot share a disabled space to public via link
|
||||
Given user "Alice" has disabled a space "share space"
|
||||
When user "Alice" creates a public link share of the space "share space" with settings:
|
||||
| permissions | 1 |
|
||||
Then the HTTP status code should be "404"
|
||||
And the OCS status code should be "404"
|
||||
And the OCS status message should be "Wrong path, file/folder doesn't exist"
|
||||
And for user "Alice" the space "share space" should not contain the last created public link
|
||||
Scenario: A user cannot share a disabled space to public via link
|
||||
Given user "Alice" has disabled a space "share space"
|
||||
When user "Alice" creates a public link share of the space "share space" with settings:
|
||||
| permissions | 1 |
|
||||
Then the HTTP status code should be "404"
|
||||
And the OCS status code should be "404"
|
||||
And the OCS status message should be "Wrong path, file/folder doesn't exist"
|
||||
And for user "Alice" the space "share space" should not contain the last created public link
|
||||
@@ -18,43 +18,62 @@ Feature: Share a file or folder that is inside a space
|
||||
And user "Alice" has created a space "share sub-item" with the default quota using the GraphApi
|
||||
And user "Alice" has created a folder "folder" in space "share sub-item"
|
||||
And user "Alice" has uploaded a file inside space "share sub-item" with content "some content" to "file.txt"
|
||||
And using new DAV path
|
||||
And using new DAV path
|
||||
|
||||
|
||||
|
||||
Scenario Outline: A manager of the space can share an entity inside project space to another user with role
|
||||
When user "Alice" shares the following entity "<entity>" inside of space "share sub-item" with user "Brian" with role "<role>"
|
||||
And user "Alice" creates a share inside of space "share sub-item" with settings:
|
||||
| path | <entity> |
|
||||
| shareWith | Brian |
|
||||
| role | <role> |
|
||||
| expireDate | <expireDate> |
|
||||
Then the HTTP status code should be "200"
|
||||
And the OCS status code should be "200"
|
||||
And the OCS status message should be "OK"
|
||||
When user "Brian" accepts share "/<entity>" offered by user "Alice" using the sharing API
|
||||
And as "Brian" <type> "Shares/<entity>" should exist
|
||||
Then as "Brian" <type> "Shares/<entity>" should exist
|
||||
And the information about the last share for user "Brian" should include
|
||||
| expiration | <expiration> |
|
||||
Examples:
|
||||
| entity | type | role |
|
||||
| folder | folder | viewer |
|
||||
| folder | folder | editor |
|
||||
| file.txt | file | viewer |
|
||||
| file.txt | file | editor |
|
||||
| entity | type | role | expireDate | expiration |
|
||||
| folder | folder | viewer | | |
|
||||
| folder | folder | editor | | |
|
||||
| file.txt | file | viewer | | |
|
||||
| file.txt | file | editor | | |
|
||||
|
||||
|
||||
Scenario Outline: An user participant of the project space with manager role can share an entity to another user
|
||||
Given user "Alice" has shared a space "share sub-item" to user "Brian" with role "manager"
|
||||
When user "Brian" shares the following entity "<entity>" inside of space "share sub-item" with user "Bob" with role "<role>"
|
||||
Scenario Outline: A user participant of the project space with manager role can share an entity to another user
|
||||
Given user "Alice" has shared a space "share sub-item" with settings:
|
||||
| shareWith | Brian |
|
||||
| role | manager |
|
||||
When user "Brian" creates a share inside of space "share sub-item" with settings:
|
||||
| path | <entity> |
|
||||
| shareWith | Bob |
|
||||
| role | <role> |
|
||||
| expireDate | <expireDate> |
|
||||
Then the HTTP status code should be "200"
|
||||
And the OCS status code should be "200"
|
||||
And the OCS status message should be "OK"
|
||||
When user "Bob" accepts share "/<entity>" offered by user "Brian" using the sharing API
|
||||
And as "Bob" <type> "Shares/<entity>" should exist
|
||||
Then as "Bob" <type> "Shares/<entity>" should exist
|
||||
And the information about the last share for user "Brian" should include
|
||||
| expiration | <expiration> |
|
||||
Examples:
|
||||
| entity | type | role |
|
||||
| folder | folder | viewer |
|
||||
| folder | folder | editor |
|
||||
| file.txt | file | viewer |
|
||||
| file.txt | file | editor |
|
||||
| entity | type | role | expireDate | expiration |
|
||||
| folder | folder | viewer | | |
|
||||
| folder | folder | editor | | |
|
||||
| file.txt | file | viewer | | |
|
||||
| file.txt | file | editor | | |
|
||||
|
||||
|
||||
Scenario Outline: An user participant of the project space without space manager role cannot share an entity to another user
|
||||
Given user "Alice" has shared a space "share sub-item" to user "Brian" with role "<spaceRole>"
|
||||
When user "Brian" shares the following entity "<entity>" inside of space "share sub-item" with user "Bob" with role "editor"
|
||||
Scenario Outline: A user participant of the project space without space manager role cannot share an entity to another user
|
||||
Given user "Alice" has shared a space "share sub-item" with settings:
|
||||
| shareWith | Brian |
|
||||
| role | <spaceRole> |
|
||||
When user "Brian" creates a share inside of space "share sub-item" with settings:
|
||||
| path | <entity> |
|
||||
| shareWith | Bob |
|
||||
| role | editor |
|
||||
Then the HTTP status code should be "<statusCode>"
|
||||
And the OCS status code should be "<statusCode>"
|
||||
And the OCS status message should be "<statusMessage>"
|
||||
@@ -66,9 +85,14 @@ Feature: Share a file or folder that is inside a space
|
||||
| folder | viewer | 404 | No share permission |
|
||||
|
||||
|
||||
Scenario Outline: An user participant of the project space can see the created resources share
|
||||
Given user "Alice" has shared a space "share sub-item" to user "Brian" with role "<spaceRole>"
|
||||
When user "Alice" shares the following entity "file.txt" inside of space "share sub-item" with user "Bob" with role "editor"
|
||||
Scenario Outline: A user participant of the project space can see the created resources share
|
||||
Given user "Alice" has shared a space "share sub-item" with settings:
|
||||
| shareWith | Brian |
|
||||
| role | <spaceRole> |
|
||||
When user "Alice" creates a share inside of space "share sub-item" with settings:
|
||||
| path | file.txt |
|
||||
| shareWith | Bob |
|
||||
| role | editor |
|
||||
Then for user "Alice" the space "share sub-item" should contain the last created share of the file "file.txt"
|
||||
And for user "Brian" the space "share sub-item" should contain the last created share of the file "file.txt"
|
||||
Examples:
|
||||
@@ -76,3 +100,76 @@ Feature: Share a file or folder that is inside a space
|
||||
| editor |
|
||||
| viewer |
|
||||
| manager |
|
||||
|
||||
|
||||
Scenario: A user shares the folder to the group
|
||||
Given group "sales" has been created
|
||||
And the administrator has added a user "Brian" to the group "sales" using GraphApi
|
||||
When user "Alice" creates a share inside of space "share sub-item" with settings:
|
||||
| path | folder |
|
||||
| shareWith | sales |
|
||||
| shareType | 1 |
|
||||
| role | viewer |
|
||||
| expireDate | 2042-01-01T23:59:59+0100 |
|
||||
Then the HTTP status code should be "200"
|
||||
And the OCS status code should be "200"
|
||||
And the OCS status message should be "OK"
|
||||
When user "Brian" accepts share "/folder" offered by user "Alice" using the sharing API
|
||||
Then as "Brian" folder "Shares/folder" should exist
|
||||
And the information about the last share for user "Brian" should include
|
||||
| expiration | 2042-01-01 |
|
||||
|
||||
@skipOnStable2.0
|
||||
Scenario: A user changes the expiration date
|
||||
Given user "Alice" has created a share inside of space "share sub-item" with settings:
|
||||
| path | folder |
|
||||
| shareWith | Brian |
|
||||
| role | viewer |
|
||||
| expireDate | 2042-01-01T23:59:59+0100 |
|
||||
And user "Brian" has accepted share "/folder" offered by user "Alice"
|
||||
When user "Alice" changes the last share with settings:
|
||||
| expireDate | 2044-01-01T23:59:59.999+01:00 |
|
||||
Then the HTTP status code should be "200"
|
||||
And the information about the last share for user "Brian" should include
|
||||
| expiration | 2044-01-01 |
|
||||
|
||||
|
||||
Scenario: A user deletes the expiration date
|
||||
Given user "Alice" has created a share inside of space "share sub-item" with settings:
|
||||
| path | folder |
|
||||
| shareWith | Brian |
|
||||
| role | viewer |
|
||||
| expireDate | 2042-01-01T23:59:59+0100 |
|
||||
And user "Brian" has accepted share "/folder" offered by user "Alice"
|
||||
When user "Alice" changes the last share with settings:
|
||||
| expireDate | |
|
||||
Then the HTTP status code should be "200"
|
||||
And the information about the last share for user "Brian" should include
|
||||
| expiration | |
|
||||
|
||||
@skipOnStable2.0
|
||||
Scenario: check the end of expiration date in user share
|
||||
Given user "Alice" has created a share inside of space "share sub-item" with settings:
|
||||
| path | folder |
|
||||
| shareWith | Brian |
|
||||
| role | viewer |
|
||||
| expireDate | 2042-01-01T23:59:59+0100 |
|
||||
And user "Brian" has accepted share "/folder" offered by user "Alice"
|
||||
When user "Alice" expires the last share
|
||||
Then the HTTP status code should be "200"
|
||||
Then as "Brian" folder "Shares/folder" should not exist
|
||||
|
||||
@issue-5823 @skipOnStable2.0
|
||||
Scenario: check the end of expiration date in group share
|
||||
Given group "sales" has been created
|
||||
And the administrator has added a user "Brian" to the group "sales" using GraphApi
|
||||
And user "Alice" has created a share inside of space "share sub-item" with settings:
|
||||
| path | folder |
|
||||
| shareWith | sales |
|
||||
| shareType | 1 |
|
||||
| role | viewer |
|
||||
| expireDate | 2042-01-01T23:59:59+0100 |
|
||||
And user "Brian" has accepted share "/folder" offered by user "Alice"
|
||||
When user "Alice" expires the last share
|
||||
Then the HTTP status code should be "200"
|
||||
Then as "Brian" folder "Shares/folder" should not exist
|
||||
+49
-19
@@ -44,21 +44,30 @@ Feature: Share a file or folder that is inside a space via public link
|
||||
And the OCS status code should be "200"
|
||||
And the OCS status message should be "OK"
|
||||
And the fields of the last response to user "Alice" should include
|
||||
| path | <path> |
|
||||
| item_type | <item_type> |
|
||||
| mimetype | <mimetype> |
|
||||
| file_target | <file_target> |
|
||||
| path | /<entity> |
|
||||
| permissions | <permissions> |
|
||||
| share_type | public_link |
|
||||
| displayname_owner | %displayname% |
|
||||
| name | <name> |
|
||||
Examples:
|
||||
| entity | path | permissions | password | name | expireDate |
|
||||
| folder | /folder |0 | | link | |
|
||||
| folder | /folder |1 | 123 | link | 2042-03-25T23:59:59+0100 |
|
||||
| folder | /folder |4 | | | |
|
||||
| folder | /folder |5 | 200 | | 2042-03-25T23:59:59+0100 |
|
||||
| folder | /folder |15 | | link | |
|
||||
| folder/file.txt | /file.txt |0 | 123 | link | 2042-03-25T23:59:59+0100 |
|
||||
| folder/file.txt | /file.txt |1 | 123 | link | 2042-03-25T23:59:59+0100 |
|
||||
| folder/file.txt | /file.txt |3 | 123 | link | 2042-03-25T23:59:59+0100 |
|
||||
| entity | file_target | permissions | password | name | expireDate | item_type | mimetype |
|
||||
| folder | /folder | 0 | | link | | folder | httpd/unix-directory |
|
||||
| folder | /folder | 1 | 123 | link | 2042-03-25T23:59:59+0100 | folder | httpd/unix-directory |
|
||||
| folder | /folder | 4 | | | | folder | httpd/unix-directory |
|
||||
| folder | /folder | 5 | 200 | | 2042-03-25T23:59:59+0100 | folder | httpd/unix-directory |
|
||||
| folder | /folder | 15 | | link | | folder | httpd/unix-directory |
|
||||
| folder/file.txt | /file.txt | 0 | 123 | link | 2042-03-25T23:59:59+0100 | file | text/plain |
|
||||
| folder/file.txt | /file.txt | 1 | 123 | link | 2042-03-25T23:59:59+0100 | file | text/plain |
|
||||
| folder/file.txt | /file.txt | 3 | 123 | link | 2042-03-25T23:59:59+0100 | file | text/plain |
|
||||
|
||||
|
||||
Scenario Outline: An user participant of the project space with space manager role can share an entity inside project space via public link
|
||||
Given user "Alice" has shared a space "share sub-item" to user "Brian" with role "manager"
|
||||
Given user "Alice" has shared a space "share sub-item" with settings:
|
||||
| shareWith | Brian |
|
||||
| role | manager |
|
||||
When user "Brian" creates a public link share inside of space "share sub-item" with settings:
|
||||
| path | <entity> |
|
||||
| shareType | 3 |
|
||||
@@ -69,16 +78,24 @@ Feature: Share a file or folder that is inside a space via public link
|
||||
Then the HTTP status code should be "200"
|
||||
And the OCS status code should be "200"
|
||||
And the OCS status message should be "OK"
|
||||
And the fields of the last response to user "Alice" should include
|
||||
| path | <path> |
|
||||
And the fields of the last response to user "Brian" should include
|
||||
| item_type | <item_type> |
|
||||
| mimetype | <mimetype> |
|
||||
| file_target | <file_target> |
|
||||
| path | /<entity> |
|
||||
| share_type | public_link |
|
||||
| displayname_owner | %displayname% |
|
||||
| name | public link |
|
||||
Examples:
|
||||
| entity | path |
|
||||
| folder | /folder |
|
||||
| folder/file.txt | /file.txt |
|
||||
| entity | file_target | item_type | mimetype |
|
||||
| folder | /folder | folder | httpd/unix-directory |
|
||||
| folder/file.txt | /file.txt | file | text/plain |
|
||||
|
||||
|
||||
Scenario Outline: An user participant of the project space without space manager role cannot share an entity inside project space via public link
|
||||
Given user "Alice" has shared a space "share sub-item" to user "Brian" with role "<spaceRole>"
|
||||
Given user "Alice" has shared a space "share sub-item" with settings:
|
||||
| shareWith | Brian |
|
||||
| role | <spaceRole> |
|
||||
When user "Brian" creates a public link share inside of space "share sub-item" with settings:
|
||||
| path | <entity> |
|
||||
| shareType | 3 |
|
||||
@@ -125,12 +142,25 @@ Feature: Share a file or folder that is inside a space via public link
|
||||
|
||||
|
||||
Scenario Outline: An user participant of the project space can see the created public resources link
|
||||
Given user "Alice" has shared a space "share sub-item" to user "Brian" with role "<spaceRole>"
|
||||
Given user "Alice" has shared a space "share sub-item" with settings:
|
||||
| shareWith | Brian |
|
||||
| role | <spaceRole> |
|
||||
When user "Alice" creates a public link share inside of space "share sub-item" with settings:
|
||||
| path | folder/file.txt |
|
||||
| shareType | 3 |
|
||||
| permissions | 1 |
|
||||
Then for user "Brian" the space "share sub-item" should contain the last created public link of the file "folder/file.txt"
|
||||
Then the fields of the last response to user "Alice" should include
|
||||
| item_type | file |
|
||||
| mimetype | text/plain |
|
||||
| file_target | /file.txt |
|
||||
| path | folder/file.txt |
|
||||
| permissions | 1 |
|
||||
| share_type | public_link |
|
||||
| displayname_file_owner | %displayname% |
|
||||
| displayname_owner | %displayname% |
|
||||
| uid_file_owner | %username% |
|
||||
| uid_owner | %username% |
|
||||
And for user "Brian" the space "share sub-item" should contain the last created public link of the file "folder/file.txt"
|
||||
Examples:
|
||||
| spaceRole |
|
||||
| editor |
|
||||
|
||||
@@ -134,7 +134,7 @@ Feature: upload resources on share using TUS protocol
|
||||
Given user "Alice" has created folder "/FOLDER"
|
||||
And user "Alice" has shared folder "/FOLDER" with user "Brian"
|
||||
And user "Brian" has accepted share "/FOLDER" offered by user "Alice"
|
||||
And user "Alice" has created a new TUS resource for the space "Personal" using the WebDAV API with these headers:
|
||||
And user "Alice" has created a new TUS resource for the space "Personal" with content "" using the WebDAV API with these headers:
|
||||
| Upload-Length | 5 |
|
||||
# L0ZPTERFUi90ZXh0RmlsZS50eHQ= is the base64 encode of /FOLDER/textFile.txt
|
||||
| Upload-Metadata | filename L0ZPTERFUi90ZXh0RmlsZS50eHQ= |
|
||||
@@ -149,7 +149,7 @@ Feature: upload resources on share using TUS protocol
|
||||
Given user "Alice" has created folder "/FOLDER"
|
||||
And user "Alice" has shared folder "/FOLDER" with user "Brian"
|
||||
And user "Brian" has accepted share "/FOLDER" offered by user "Alice"
|
||||
And user "Alice" has created a new TUS resource for the space "Personal" using the WebDAV API with these headers:
|
||||
And user "Alice" has created a new TUS resource for the space "Personal" with content "" using the WebDAV API with these headers:
|
||||
| Upload-Length | 5 |
|
||||
# L0ZPTERFUi90ZXh0RmlsZS50eHQ= is the base64 encode of /FOLDER/textFile.txt
|
||||
| Upload-Metadata | filename L0ZPTERFUi90ZXh0RmlsZS50eHQ= |
|
||||
@@ -160,7 +160,7 @@ Feature: upload resources on share using TUS protocol
|
||||
|
||||
|
||||
Scenario: Sharer shares a file with correct checksum should return the checksum in the propfind for sharee
|
||||
Given user "Alice" has created a new TUS resource for the space "Personal" using the WebDAV API with these headers:
|
||||
Given user "Alice" has created a new TUS resource for the space "Personal" with content "" using the WebDAV API with these headers:
|
||||
| Upload-Length | 5 |
|
||||
# dGV4dEZpbGUudHh0 is the base64 encode of textFile.txt
|
||||
| Upload-Metadata | filename dGV4dEZpbGUudHh0 |
|
||||
@@ -174,7 +174,7 @@ Feature: upload resources on share using TUS protocol
|
||||
|
||||
|
||||
Scenario: Sharer shares a file with correct checksum should return the checksum in the download header for sharee
|
||||
Given user "Alice" has created a new TUS resource for the space "Personal" using the WebDAV API with these headers:
|
||||
Given user "Alice" has created a new TUS resource for the space "Personal" with content "" using the WebDAV API with these headers:
|
||||
| Upload-Length | 5 |
|
||||
# dGV4dEZpbGUudHh0 is the base64 encode of textFile.txt
|
||||
| Upload-Metadata | filename dGV4dEZpbGUudHh0 |
|
||||
@@ -190,7 +190,7 @@ Feature: upload resources on share using TUS protocol
|
||||
Given user "Alice" has created folder "/FOLDER"
|
||||
And user "Alice" has shared folder "/FOLDER" with user "Brian"
|
||||
And user "Brian" has accepted share "/FOLDER" offered by user "Alice"
|
||||
When user "Brian" creates a new TUS resource for the space "Shares" using the WebDAV API with these headers:
|
||||
When user "Brian" creates a new TUS resource for the space "Shares" with content "" using the WebDAV API with these headers:
|
||||
| Upload-Length | 16 |
|
||||
# L0ZPTERFUi90ZXh0RmlsZS50eHQ= is the base64 encode of /FOLDER/textFile.txt
|
||||
| Upload-Metadata | filename L0ZPTERFUi90ZXh0RmlsZS50eHQ= |
|
||||
@@ -205,13 +205,13 @@ Feature: upload resources on share using TUS protocol
|
||||
Given user "Alice" has created folder "/FOLDER"
|
||||
And user "Alice" has shared folder "/FOLDER" with user "Brian"
|
||||
And user "Brian" has accepted share "/FOLDER" offered by user "Alice"
|
||||
When user "Brian" creates a new TUS resource for the space "Shares" using the WebDAV API with these headers:
|
||||
When user "Brian" creates a new TUS resource for the space "Shares" with content "" using the WebDAV API with these headers:
|
||||
| Upload-Length | 16 |
|
||||
# L0ZPTERFUi90ZXh0RmlsZS50eHQ= is the base64 encode of /FOLDER/textFile.txt
|
||||
| Upload-Metadata | filename L0ZPTERFUi90ZXh0RmlsZS50eHQ= |
|
||||
| Tus-Resumable | 1.0.0 |
|
||||
And user "Brian" uploads file with checksum "MD5 827ccb0eea8a706c4c34a16891f84e8c" to the last created TUS Location with offset "0" and content "uploaded content" via TUS inside of the space "Shares" using the WebDAV API
|
||||
Then the HTTP status code should be "406"
|
||||
Then the HTTP status code should be "460"
|
||||
And for user "Alice" folder "FOLDER" of the space "Personal" should not contain these entries:
|
||||
| textFile.txt |
|
||||
|
||||
@@ -220,13 +220,13 @@ Feature: upload resources on share using TUS protocol
|
||||
Given user "Alice" has created folder "/FOLDER"
|
||||
And user "Alice" has shared folder "/FOLDER" with user "Brian"
|
||||
And user "Brian" has accepted share "/FOLDER" offered by user "Alice"
|
||||
And user "Alice" has created a new TUS resource for the space "Personal" using the WebDAV API with these headers:
|
||||
| Upload-Length | 5 |
|
||||
# L0ZPTERFUi90ZXh0RmlsZS50eHQ= is the base64 encode of /FOLDER/textFile.txt
|
||||
And user "Alice" has created a new TUS resource for the space "Personal" with content "" using the WebDAV API with these headers:
|
||||
| Upload-Length | 16 |
|
||||
# L0ZPTERFUi90ZXh0RmlsZS50eHQ= is the base64 encode of /FOLDER/textFile.txt
|
||||
| Upload-Metadata | filename L0ZPTERFUi90ZXh0RmlsZS50eHQ= |
|
||||
| Tus-Resumable | 1.0.0 |
|
||||
When user "Alice" uploads file with checksum "SHA1 8cb2237d0679ca88db6464eac60da96345513954" to the last created TUS Location with offset "0" and content "uploaded content" via TUS inside of the space "Personal" using the WebDAV API
|
||||
Then the HTTP status code should be "406"
|
||||
Then the HTTP status code should be "460"
|
||||
And for user "Alice" folder "FOLDER" of the space "Personal" should not contain these entries:
|
||||
| textFile.txt |
|
||||
And for user "Brian" folder "FOLDER" of the space "Shares" should not contain these entries:
|
||||
@@ -234,7 +234,7 @@ Feature: upload resources on share using TUS protocol
|
||||
|
||||
|
||||
Scenario: Sharer uploads a chunked file with correct checksum and share it with sharee should work
|
||||
Given user "Alice" has created a new TUS resource for the space "Personal" using the WebDAV API with these headers:
|
||||
Given user "Alice" has created a new TUS resource for the space "Personal" with content "" using the WebDAV API with these headers:
|
||||
| Upload-Length | 10 |
|
||||
# dGV4dEZpbGUudHh0 is the base64 encode of textFile.txt
|
||||
| Upload-Metadata | filename dGV4dEZpbGUudHh0 |
|
||||
@@ -250,7 +250,7 @@ Feature: upload resources on share using TUS protocol
|
||||
Given user "Alice" has created folder "/FOLDER"
|
||||
And user "Alice" has shared folder "/FOLDER" with user "Brian"
|
||||
And user "Brian" has accepted share "/FOLDER" offered by user "Alice"
|
||||
And user "Brian" has created a new TUS resource for the space "Shares" using the WebDAV API with these headers:
|
||||
And user "Brian" has created a new TUS resource for the space "Shares" with content "" using the WebDAV API with these headers:
|
||||
| Upload-Length | 10 |
|
||||
# L0ZPTERFUi90ZXh0RmlsZS50eHQ= is the base64 encode of /FOLDER/textFile.txt
|
||||
| Upload-Metadata | filename L0ZPTERFUi90ZXh0RmlsZS50eHQ= |
|
||||
@@ -264,7 +264,7 @@ Feature: upload resources on share using TUS protocol
|
||||
|
||||
|
||||
Scenario: Sharer uploads a file with checksum and as a sharee overwrites the shared file with new data and correct checksum
|
||||
Given user "Alice" has created a new TUS resource for the space "Personal" using the WebDAV API with these headers:
|
||||
Given user "Alice" has created a new TUS resource for the space "Personal" with content "" using the WebDAV API with these headers:
|
||||
| Upload-Length | 16 |
|
||||
# dGV4dEZpbGUudHh0 is the base64 encode of textFile.txt
|
||||
| Upload-Metadata | filename dGV4dEZpbGUudHh0 |
|
||||
@@ -282,7 +282,7 @@ Feature: upload resources on share using TUS protocol
|
||||
|
||||
|
||||
Scenario: Sharer uploads a file with checksum and as a sharee overwrites the shared file with new data and invalid checksum
|
||||
Given user "Alice" has created a new TUS resource for the space "Personal" using the WebDAV API with these headers:
|
||||
Given user "Alice" has created a new TUS resource for the space "Personal" with content "" using the WebDAV API with these headers:
|
||||
| Upload-Length | 16 |
|
||||
# dGV4dEZpbGUudHh0 is the base64 encode of textFile.txt
|
||||
| Upload-Metadata | filename dGV4dEZpbGUudHh0 |
|
||||
@@ -295,5 +295,5 @@ Feature: upload resources on share using TUS protocol
|
||||
# dGV4dEZpbGUudHh0 is the base64 encode of textFile.txt
|
||||
| Upload-Metadata | filename dGV4dEZpbGUudHh0 |
|
||||
| Tus-Resumable | 1.0.0 |
|
||||
Then the HTTP status code should be "406"
|
||||
Then the HTTP status code should be "460"
|
||||
And for user "Alice" the content of the file "/textFile.txt" of the space "Personal" should be "original content"
|
||||
Loaded 100 of 271 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user