Sha256: 2ff79419207f88dd3ab96ae86c2a8f6cfd181f3c041346c23762c946a409cd78

Contents?: true

Size: 870 Bytes

Versions: 4

Compression:

Stored size: 870 Bytes

Contents

# frozen_string_literal: true

module Masks
  # @visibility private
  module Manage
    class ActorController < BaseController
      before_action :find_actor

      def update
        Masks::Rails::Actor.transaction do
          if params[:add_scope]
            @actor.assign_scopes!(params[:add_scope])
            flash[:info] = "added scope"
          elsif params[:remove_scope]
            @actor.remove_scopes!(params[:remove_scope])
            flash[:info] = "removed scope"
          elsif params[:remove_factor2]
            @actor.remove_factor2! if params[:remove_factor2]
            flash[:info] = "removed second factor authentication"
          end

          redirect_to actor_path(@actor)
        end

        @actor
      end

      private

      def find_actor
        @actor = Masks::Rails::Actor.find(params[:actor])
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
masks-0.3.2 app/controllers/masks/manage/actor_controller.rb
masks-0.3.1 app/controllers/masks/manage/actor_controller.rb
masks-0.3.0 app/controllers/masks/manage/actor_controller.rb
masks-0.2.0 app/controllers/masks/manage/actor_controller.rb