Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: make groups index case sensitive #2109

Merged
merged 1 commit into from
Jun 1, 2021
Merged
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
4 changes: 2 additions & 2 deletions accounts/pkg/service/v0/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ func recreateContainers(idx *indexer.Indexer, cfg *config.Config) error {
}

// Groups
if err := idx.AddIndex(&proto.Group{}, "OnPremisesSamAccountName", "Id", "groups", "unique", nil, true); err != nil {
if err := idx.AddIndex(&proto.Group{}, "OnPremisesSamAccountName", "Id", "groups", "unique", nil, false); err != nil {
return err
}

if err := idx.AddIndex(&proto.Group{}, "DisplayName", "Id", "groups", "non_unique", nil, true); err != nil {
if err := idx.AddIndex(&proto.Group{}, "DisplayName", "Id", "groups", "non_unique", nil, false); err != nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait, why is searching for display names supposed to be case sensitive?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because if you are creating a new group with via the OCS API like this

curl -sk -u moss:vista -X POST 'https://localhost:9200/ocs/v2.php/cloud/groups' -d 'groupid=Group1'

Then the OnPremisesSamAccountName and DisplayName are the same. And if there would be the groups Group1 and group1 then you couldn't search for them using the DisplayName if it was case insensitive.

return err
}

Expand Down
5 changes: 5 additions & 0 deletions changelog/unreleased/fix-groups-index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Bugfix: Change the groups index to be case sensitive

Groups are considered to be case sensitive. The index must handle them case sensitive too otherwise we will have undeterministic behavior while editing or deleting groups.

https://github.com/owncloud/ocis/pull/2109