projectblacklight / blacklight-access_controls

Provides access controls for Blacklight-based Rails applications.
2 stars 3 forks source link

Blacklight::AccessControls::SearchBuilder doesn't (yet) have access to ability in BL7 #54

Closed dgcliff closed 5 years ago

dgcliff commented 5 years ago

So currently there's a couple of things I think that are needed to get blacklight-access_controls to work in BL7

The first is that the AccessControlsGenerator needs to set the search_builder_class to Blacklight::AccessControls::SearchBuilder

I did this manually in my .internal_test_app and discovered that the Blacklight::AccessControls::SearchBuilder class initializer expects ability as an argument. But Blacklight only initializes with one argument, the SearchService instance.

It looks like in https://github.com/projectblacklight/blacklight/commit/b24a34fc4a078e2e428837fe1b7949cf91ddbc0d that @cbeer has provided context that the SearchBuilder can consume, but that isn't yet in a cut release.

I think if I'm reading that commit correctly, after it's released the SearchBuilder could get the ability by doing something like this in the initializer

@ability = scope.context.ability

dgcliff commented 5 years ago

My bad, I hadn't read the PR https://github.com/projectblacklight/blacklight/pull/2075 that commit was associated with (I found the code while exploring master, and hadn't looked at the git history). Very clear that both projects are aware, so I'll close.