Sha256: 771d80246f1184e0c824dd1a43a758d3f1c2e17ecf8bcd4c596589b4699f48cd
Contents?: true
Size: 902 Bytes
Versions: 62
Compression:
Stored size: 902 Bytes
Contents
module Api class RolesController < BaseController before_action :set_slug! before_action :set_course! before_action :set_user!, except: :create before_action :authorize_janitor! def create @user = User.create_if_necessary(user_params) @user.attach! role, @course render json: @user end def attach @user.attach! role, @course head :ok end def detach @user.detach! role, @course head :ok end private def role raise 'Not Implemented' end def user_params params.require(role).permit(:first_name, :last_name, :email, :uid, :image_url) end def set_course! @course = Course.find_by!(slug: @slug) end def set_user! @user = User.find_by!(uid: params[:uid]) end def set_slug! @slug = Mumukit::Auth::Slug.join_s params.to_unsafe_h end end end
Version data entries
62 entries across 62 versions & 1 rubygems