Sha256: 39e099e9d66e825dfb5cfd0988a7e13c99fca7d49d719b3e36ccda16d1d270bb

Contents?: true

Size: 672 Bytes

Versions: 16

Compression:

Stored size: 672 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]
  end

  private

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

  def permissible_params
    super + [:email, :image_url, 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

16 entries across 16 versions & 1 rubygems

Version Path
mumuki-laboratory-7.4.2 app/controllers/concerns/users_controller_template.rb
mumuki-laboratory-7.4.1 app/controllers/concerns/users_controller_template.rb
mumuki-laboratory-7.4.0 app/controllers/concerns/users_controller_template.rb
mumuki-laboratory-7.3.1 app/controllers/concerns/users_controller_template.rb
mumuki-laboratory-7.3.0 app/controllers/concerns/users_controller_template.rb
mumuki-laboratory-7.2.0 app/controllers/concerns/users_controller_template.rb
mumuki-laboratory-7.1.0 app/controllers/concerns/users_controller_template.rb
mumuki-laboratory-7.0.12 app/controllers/concerns/users_controller_template.rb
mumuki-laboratory-7.0.11 app/controllers/concerns/users_controller_template.rb
mumuki-laboratory-7.0.10 app/controllers/concerns/users_controller_template.rb
mumuki-laboratory-7.0.9 app/controllers/concerns/users_controller_template.rb
mumuki-laboratory-7.0.8 app/controllers/concerns/users_controller_template.rb
mumuki-laboratory-7.0.7 app/controllers/concerns/users_controller_template.rb
mumuki-laboratory-7.0.6 app/controllers/concerns/users_controller_template.rb
mumuki-laboratory-7.0.5 app/controllers/concerns/users_controller_template.rb
mumuki-laboratory-7.0.4 app/controllers/concerns/users_controller_template.rb