Class: Authz::ScopingRulesController Private
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- Authz::ScopingRulesController
- Defined in:
- app/controllers/authz/scoping_rules_controller.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Method Summary collapse
- #create ⇒ Object private
- #edit ⇒ Object private
- #new ⇒ Object private
- #update ⇒ Object private
Methods included from Controllers::AuthorizationManager
#apply_authz_scopes, #authorize, #authorized?, #authorized_path?, #skip_authorization, #verify_authorized
Instance Method Details
#create ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/controllers/authz/scoping_rules_controller.rb', line 13 def create @role = Role.find(params[:role_id]) @scopable = scoping_rule_params[:scopable] @scoping_rule = ScopingRule.new(scoping_rule_params.merge(authz_role_id: @role.id)) @available_keywords = @scopable.constantize.available_keywords if @scoping_rule.save flash[:success] = "Configured #{@scoping_rule.scopable}:#{@scoping_rule.keyword} for #{@role.name}" redirect_to role_path(@role) else flash.now[:error] = 'There was an issue adding this scoping rule' render 'new' end end |
#edit ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
27 28 29 30 31 |
# File 'app/controllers/authz/scoping_rules_controller.rb', line 27 def edit @role = Role.find(params[:role_id]) @scoping_rule = ScopingRule.find(params[:id]) @available_keywords = @scoping_rule.scopable.constantize.available_keywords end |
#new ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
6 7 8 9 10 11 |
# File 'app/controllers/authz/scoping_rules_controller.rb', line 6 def new @role = Role.find(params[:role_id]) @scopable = params[:scopable] @scoping_rule = ScopingRule.new(scopable: @scopable) @available_keywords = @scopable.constantize.available_keywords end |
#update ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'app/controllers/authz/scoping_rules_controller.rb', line 33 def update @role = Role.find(params[:role_id]) @scoping_rule = ScopingRule.find(params[:id]) if @scoping_rule.update(scoping_rule_update_params) flash[:success] = "Configured #{@scoping_rule.scopable}:#{@scoping_rule.keyword} for #{@role.name}" redirect_to role_path(@role) else flash.now[:error] = 'There was an issue updating this scoping rule' @available_keywords = @scoping_rule.scopable.constantize.available_keywords render 'edit' end end |