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

Fixes #9133: #1209

Conversation

VinceMacBuche
Copy link
Member

import QuickSearchResultId._
results.filter { _.id match {
case QRNodeId(_) => CurrentUser.checkRights(Read("node"))
case QRGroupId(_) => CurrentUser.checkRights(Read("group"))
Copy link
Member

Choose a reason for hiding this comment

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

you could test with: _:QRNodeID etc. "isInstanceOf" is amazingly fast on the jvm.
On the same idea, it would be quicker to have val nodeOK = CurrentUser.checkRights(Read("node")) etc; and to put everything in a dedicated method "filterResultByRights(results, user)

@VinceMacBuche
Copy link
Member Author

Commit modified

@VinceMacBuche
Copy link
Member Author

Commit modified

@Normation-Quality-Assistant
Copy link
Contributor

OK, merging this PR

@Normation-Quality-Assistant Normation-Quality-Assistant merged commit 3789530 into Normation:branches/rudder/3.1 Sep 27, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants