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

authorize global search results #285

Merged
merged 3 commits into from
Aug 4, 2017
Merged

Conversation

jasonfine
Copy link
Member

ended up having to put the auth check on the records set instead of trying to do it on the all_models collection because it won't work with content blocks on that level.

authorize_records(records)
end

def authorize_records(records)
Copy link
Member

Choose a reason for hiding this comment

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

@jasonfine I have some performance concerns with this method since we're looking up the authorization from the model per record. Since we're already looping through models via all_models, what if we filtered that down to authorized_models? I think that would drastically cut down on the Fae::Authorization.access_map look ups. What do you think?

Copy link
Member Author

Choose a reason for hiding this comment

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

that's originally the route i went with this, then realized it doesn't work for situations where users are limited from seeing arbitrary fae::pages, ill take another look in the AM and see what might be possible here

@@ -34,4 +34,34 @@
end
end

# see dummy app's authorization concern for auth mapping used here
scenario "search results get authorized", js: true do
Copy link
Member

Choose a reason for hiding this comment

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

👍 🎉

Copy link
Member Author

Choose a reason for hiding this comment

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

ok moved all this to work on all_models, i didn't realize it was already working on pages because the static items in the global search are built from the already-authorized nav structure. win-win

@jamesmk jamesmk merged commit 59aab27 into v1.6 Aug 4, 2017
@jamesmk jamesmk deleted the 68563-global-search-authorization branch August 4, 2017 07:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants