Skip to content
This repository has been archived by the owner on Jan 27, 2021. It is now read-only.

Update index after adding/deleting new users and groups #58

Closed
wants to merge 1 commit into from

Conversation

dpakach
Copy link
Contributor

@dpakach dpakach commented Jul 15, 2020

Update index after adding new users and groups

Related Issue #57

@update-docs
Copy link

update-docs bot commented Jul 15, 2020

Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes.

@dpakach dpakach self-assigned this Jul 15, 2020
@dpakach dpakach added the help wanted Extra attention is needed label Jul 15, 2020
@dpakach dpakach requested review from kulmann and butonic and removed request for kulmann July 15, 2020 03:21
@ownclouders
Copy link

Codacy Here is an overview of what got changed by this pull request:

Clones added
============
- pkg/service/v0/groups.go  3
- pkg/service/v0/accounts.go  3
         

See the complete overview on Codacy

@sonarcloud
Copy link

sonarcloud bot commented Jul 15, 2020

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

Copy link
Member

@kulmann kulmann left a comment

Choose a reason for hiding this comment

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

Just above the code that you added there is an s.index.Index() and s.index.Delete() call, which is supposed to update the index properly for the created or deleted entity. Recreating the whole index is not an option.

However, the existing code has a bug for indexing new accounts and groups, that I can confirm. The fix is, to wrap the Account / Group into the respective BleveAccount / BleveGroup type. Have a look at the initial indexing to see how it's done:

a := &proto.BleveAccount{

So instead of passing an account, you wrap it first:

a := &proto.BleveAccount{
        BleveType: "account",
        Account:    in.Account,
}

and then pass that a into the Index function of the index.

Deleting should work, as it only deletes from the index by Id. Didn't test it, please try / confirm. :-)

@kulmann
Copy link
Member

kulmann commented Jul 15, 2020

Oh, seeing now, that the account is expanded within the BleveAccount type. Creating it like I stated it above doesn't work. I made this pull request now to fix the broken indexing. Please have a look @dpakach

@dpakach dpakach closed this Jul 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants