-
Notifications
You must be signed in to change notification settings - Fork 2
Conversation
mnoack
commented
Apr 13, 2018
- Some missing requires
- Improve error handling in ByGroup
- Merging the controller extensions
- Minor fixes
* One was cancanright's other was right_on's, both depended on each other
end | ||
|
||
format.json do | ||
render status: :unauthorized, json: @permission_denied_response.to_json |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Metrics/LineLength: Line is too long. [81/80]
format.html do | ||
render status: :unauthorized, | ||
template: 'permission_denied', | ||
layout: ( permission_denied_layout || false ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Layout/SpaceInsideParens: Space inside parentheses detected.
end | ||
|
||
def rescue_access_denied(exception) | ||
@permission_denied_response = RightOn::PermissionDeniedResponse.new(params, controller_action_options) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Metrics/LineLength: Line is too long. [108/80]
can? :access, [params[:controller], params[:action]].join('#') | ||
end | ||
|
||
def rescue_access_denied(exception) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lint/UnusedMethodArgument: Unused method argument - exception. If it's necessary, use _ or _exception as an argument name to indicate that it won't be used. You can also write as rescue_access_denied(*) if you want the method to accept any arguments but don't care about them.
@@ -10,14 +19,34 @@ def authorize_action! | |||
end | |||
|
|||
def can_access_controller_action?(controller, action) | |||
(can?(:access, controller) && !Right.where(subject: controller + '#' + action).exists?) || | |||
(can?(:access, controller) && !Right.where(ccr_subject: controller + '#' + action).exists?) || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Metrics/LineLength: Line is too long. [100/80]
@@ -42,7 +42,9 @@ def action_rights(controller, actions) | |||
end | |||
|
|||
def rights_by_name!(name) | |||
@rights_by_name[name] or fail name.inspect | |||
@rights_by_name[name] or fail RightOn::RightNotFound, name.inspect |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/AndOr: Use || instead of or.