Conversation
tlconnor
left a comment
There was a problem hiding this comment.
There is a very large amount of code duplication between AuthorizationInPraxisController and AuthorizationInController. I suspect that most of it is unnecessary for praxis. This is ok for testing, but before merging I would expect to see this refactored.
I think the best approach would be to have a base module with all of the shared functionality, then have subclasses for the rails controller / praxis controller cases.
Gemfile
Outdated
| gem 'appraisal', '~> 2.1' | ||
| gem 'mocha', '~> 1.0', require: false | ||
| gem 'sqlite3' | ||
| gem 'praxis', path: '/Users/zachwalker/Playground/praxis' |
There was a problem hiding this comment.
This is pointing to your home drive, probably shouldn't merge like this
|
|
||
| # Returns the Authorization::Engine for the current controller. | ||
| def authorization_engine | ||
| @authorization_engine ||= Authorization::Engine.instance |
There was a problem hiding this comment.
Is this existing code, or added? It seems very specific to our use case but this is supposed to be an open source library
| include Praxis::Controller | ||
|
|
||
| implements Endpoints::Foo | ||
| # include Authorization::AuthorizationInPraxisController |
| @@ -0,0 +1,449 @@ | |||
| # Authorization::AuthorizationInController | |||
There was a problem hiding this comment.
This comment needs to be either updated or removed
test/praxis_dummy/design/api.rb
Outdated
| consumes 'json' | ||
| produces 'json' | ||
| end | ||
| # |
| action :action_group_action_2 do | ||
| description 'action_group_action_2' | ||
| routing {get '/action_group_action_2'} | ||
| # params do |
| # Use Rack::ContentLength middleware | ||
| application.middleware Rack::ContentLength | ||
|
|
||
| # TODO: this is required for "at least" adding the identity_map in the controller methods... |
6771f32 to
8659c2b
Compare
Removes params related to strong params which is a rails concept. Removes filter_resource_access from the praxis version as it isn't needed for our current use case and requires more work to convert over to praxis
…orization modules
8659c2b to
582549d
Compare
Setting the current user sets a value in Thread.local which may impact ther results of other tests run in the same Thread since the value will persist between test executions. Prior to this change, there were some flakey tests that flaked depending on test execution order
This PR makes declarative authorization directives usable inside of controllers written using the Praxis framework.