Skip to content

Commit 2e9f5bc

Browse files
committed
Add integration test for authenticating as a disabled user
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
1 parent 9dedd93 commit 2e9f5bc

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

tests/integration/features/EnvironmentVariable.feature

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,13 @@ Feature: EnvironmentVariable
2727
And The environment variable "REMOTE_USER" is set to "certainly-not-provisioned-user"
2828
When I send a GET request to "http://localhost:8080/index.php/login"
2929
Then I should be redirected to "http://localhost:8080/index.php/apps/user_saml/saml/notProvisioned"
30+
31+
Scenario: Authenticating using environment variable with SSO as a disabled user on backend
32+
Given A local user with uid "provisioned-disabled-user" exists
33+
And A local user with uid "provisioned-disabled-user" is disabled
34+
And The setting "type" is set to "environment-variable"
35+
And The setting "general-require_provisioned_account" is set to "1"
36+
And The setting "general-uid_mapping" is set to "REMOTE_USER"
37+
And The environment variable "REMOTE_USER" is set to "provisioned-disabled-user"
38+
When I send a GET request to "http://localhost:8080/index.php/login"
39+
Then I should be redirected to "http://localhost:8080/index.php/apps/user_saml/saml/error"

tests/integration/features/bootstrap/FeatureContext.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,21 @@ public function aLocalUserWithUidExists($uid) {
493493
);
494494
}
495495

496+
/**
497+
* @Given A local user with uid :uid is disabled
498+
* @param string $uid
499+
*/
500+
public function aLocalUserWithUidIsDisabled($uid) {
501+
shell_exec(
502+
sprintf(
503+
'OC_PASS=password %s %s user:disable %s',
504+
PHP_BINARY,
505+
__DIR__ . '/../../../../../../occ',
506+
$uid
507+
)
508+
);
509+
}
510+
496511
/**
497512
* @Then I hack :uid into existence
498513
*/

0 commit comments

Comments
 (0)