Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions build/integration/sharees_features/sharees.feature
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,24 @@ Feature: sharees
And "exact remotes" sharees returned is empty
And "remotes" sharees returned is empty

Scenario: Search without exact match does not return disabled users
Given As an "admin"
And assure user "Sharee1" is disabled
And As an "test"
When getting sharees for
| search | Sharee |
| itemType | file |
Then the OCS status code should be "100"
And the HTTP status code should be "200"
And "exact users" sharees returned is empty
And "users" sharees returned are
| Sharee2 | 0 | Sharee2 | sharee2@system.com |
And "exact groups" sharees returned is empty
And "groups" sharees returned are
| ShareeGroup | 1 | ShareeGroup |
And "exact remotes" sharees returned is empty
And "remotes" sharees returned is empty

Scenario: Search only with group members - denied
Given As an "test"
And parameter "shareapi_only_share_with_group_members" of app "core" is set to "yes"
Expand Down Expand Up @@ -254,6 +272,22 @@ Feature: sharees
Then "exact remotes" sharees returned is empty
Then "remotes" sharees returned is empty

Scenario: Search with exact match does not return disabled users
Given As an "admin"
And assure user "Sharee1" is disabled
And As an "test"
When getting sharees for
| search | Sharee1 |
| itemType | file |
Then the OCS status code should be "100"
And the HTTP status code should be "200"
And "exact users" sharees returned is empty
And "users" sharees returned is empty
And "exact groups" sharees returned is empty
And "groups" sharees returned is empty
And "exact remotes" sharees returned is empty
And "remotes" sharees returned is empty

Scenario: Search with exact match not-exact casing
Given As an "test"
When getting sharees for
Expand Down Expand Up @@ -364,6 +398,21 @@ Feature: sharees
And "exact emails" sharees returned is empty
And "emails" sharees returned is empty

Scenario: Search user by system e-mail address does not return disabled users
Given As an "admin"
And assure user "Sharee2" is disabled
And As an "test"
When getting sharees for
| search | sharee2@system.com |
| itemType | file |
| shareType | 0 |
Then the OCS status code should be "100"
And the HTTP status code should be "200"
And "exact users" sharees returned is empty
And "users" sharees returned is empty
And "exact emails" sharees returned is empty
And "emails" sharees returned is empty

Scenario: Search user by system e-mail address without exact match
Given As an "test"
When getting sharees for
Expand Down
7 changes: 5 additions & 2 deletions lib/private/Collaboration/Collaborators/UserPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public function search($search, $limit, $offset, ISearchResult $searchResult): b

if ($shareeEnumerationFullMatchUserId) {
$user = $this->userManager->get($search);
if ($user !== null) {
if ($user !== null && $user->isEnabled()) {
$users[$user->getUID()] = ['exact', $user];
}
}
Expand All @@ -135,7 +135,10 @@ public function search($search, $limit, $offset, ISearchResult $searchResult): b
$uid = $row['uid'];
$email = $row['value'];
$isAdditional = $row['name'] === 'additional_mail';
$users[$uid] = ['exact', $this->userManager->get($uid), $isAdditional ? $email : null];
$user = $this->userManager->get($uid);
if ($user !== null && $user->isEnabled()) {
$users[$uid] = ['exact', $user, $isAdditional ? $email : null];
}
}
$result->closeCursor();
}
Expand Down
Loading