Skip to content

Ace praxis support #4

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Ace praxis support #4

wants to merge 5 commits into from

Conversation

zwalker
Copy link
Contributor

@zwalker zwalker commented Aug 9, 2018

This PR makes declarative authorization directives usable inside of controllers written using the Praxis framework.

Copy link

@tlconnor tlconnor left a comment

Choose a reason for hiding this comment

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

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
@@ -5,3 +5,6 @@ gemspec
gem 'appraisal', '~> 2.1'
gem 'mocha', '~> 1.0', require: false
gem 'sqlite3'
gem 'praxis', path: '/Users/zachwalker/Playground/praxis'
Copy link

Choose a reason for hiding this comment

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

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
Copy link

Choose a reason for hiding this comment

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

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
Copy link

Choose a reason for hiding this comment

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

Can we delete this commented code?

@@ -0,0 +1,449 @@
# Authorization::AuthorizationInController
Copy link

Choose a reason for hiding this comment

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

This comment needs to be either updated or removed

consumes 'json'
produces 'json'
end
#
Copy link

Choose a reason for hiding this comment

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

Can this be deleted?

action :action_group_action_2 do
description 'action_group_action_2'
routing {get '/action_group_action_2'}
# params do
Copy link

Choose a reason for hiding this comment

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

Can this be deleted?

# Use Rack::ContentLength middleware
application.middleware Rack::ContentLength

# TODO: this is required for "at least" adding the identity_map in the controller methods...
Copy link

Choose a reason for hiding this comment

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

Is this still TODO?

@zwalker zwalker force-pushed the AcePraxisSupport2 branch 2 times, most recently from 6771f32 to 8659c2b Compare September 5, 2018 20:01
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
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
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