You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
class Cooperative::LaboratoryUsersController < Cooperative::BaseController
|
|
|
|
def index
|
|
|
|
laboratory_users = current_laboratory.laboratory_users
|
|
|
|
@laboratory_users = paginate laboratory_users.includes(user: { user_extension: [:school, :department] })
|
|
|
|
end
|
|
|
|
|
|
|
|
def create
|
|
|
|
Admins::AddLaboratoryUserService.call(current_laboratory, params.permit(user_ids: []))
|
|
|
|
render_ok
|
|
|
|
end
|
|
|
|
|
|
|
|
def destroy
|
|
|
|
return render_error('不能删除自己', type: :notify) if current_laboratory_user.user_id == current_user.id
|
|
|
|
current_laboratory_user.destroy!
|
|
|
|
|
|
|
|
render_delete_success
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def current_laboratory_user
|
|
|
|
@_current_laboratory_user ||= current_laboratory.laboratory_users.find(params[:id])
|
|
|
|
end
|
|
|
|
end
|