Sha256: 0d038192e9121f34c44b358c14c7e2c1af4e4ba62a410b10e17f18e42369e7df

Contents?: true

Size: 820 Bytes

Versions: 86

Compression:

Stored size: 820 Bytes

Contents

module UsersControllerTemplate
  extend ActiveSupport::Concern
  include WithUserParams

  included do
    before_action :set_user!, only: [:show, :update]
    before_action :set_new_user!, only: :create
    before_action :protect_permissions_assignment!, only: [:create, :update]
    after_action :verify_user_name!, only: :create
  end

  private

  def verify_user_name!
    @user.verify_name!
  end

  def protect_permissions_assignment!
    current_user.protect_permissions_assignment! user_params[:permissions], @user.permissions_was
  end

  def permissible_params
    super + [:email, :image_url, :verified_first_name, :verified_last_name, permissions: Mumukit::Auth::Roles::ROLES]
  end

  def set_user!
    @user = User.locate! params[:id]
  end

  def set_new_user!
    @user = User.new user_params
  end
end

Version data entries

86 entries across 86 versions & 1 rubygems

Version Path
mumuki-laboratory-9.23.0 app/controllers/concerns/users_controller_template.rb
mumuki-laboratory-9.22.0 app/controllers/concerns/users_controller_template.rb
mumuki-laboratory-9.21.0 app/controllers/concerns/users_controller_template.rb
mumuki-laboratory-9.20.1 app/controllers/concerns/users_controller_template.rb
mumuki-laboratory-9.20.0 app/controllers/concerns/users_controller_template.rb
mumuki-laboratory-9.19.0 app/controllers/concerns/users_controller_template.rb
mumuki-laboratory-9.18.1 app/controllers/concerns/users_controller_template.rb
mumuki-laboratory-9.18.0 app/controllers/concerns/users_controller_template.rb
mumuki-laboratory-9.17.0 app/controllers/concerns/users_controller_template.rb
mumuki-laboratory-9.16.0 app/controllers/concerns/users_controller_template.rb
mumuki-laboratory-9.15.0 app/controllers/concerns/users_controller_template.rb
mumuki-laboratory-9.14.1 app/controllers/concerns/users_controller_template.rb
mumuki-laboratory-9.14.0 app/controllers/concerns/users_controller_template.rb
mumuki-laboratory-9.13.2 app/controllers/concerns/users_controller_template.rb
mumuki-laboratory-9.13.1 app/controllers/concerns/users_controller_template.rb
mumuki-laboratory-9.13.0 app/controllers/concerns/users_controller_template.rb
mumuki-laboratory-9.12.1 app/controllers/concerns/users_controller_template.rb
mumuki-laboratory-9.12.0 app/controllers/concerns/users_controller_template.rb
mumuki-laboratory-9.11.0 app/controllers/concerns/users_controller_template.rb
mumuki-laboratory-9.10.0 app/controllers/concerns/users_controller_template.rb