mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-14 05:05:55 +08:00
22 lines
500 B
Ruby
22 lines
500 B
Ruby
# frozen_string_literal: true
|
|
|
|
module Api
|
|
module V1
|
|
class UsersController < BaseController
|
|
before_action :load_user, only: :show
|
|
|
|
def show
|
|
render jsonapi: @user, serializer: UserSerializer
|
|
end
|
|
|
|
private
|
|
|
|
def load_user
|
|
@user = User.joins(:user_teams)
|
|
.where('user_teams.team': current_user.teams)
|
|
.find_by_id(params[:id])
|
|
raise PermissionError.new(User, :read) unless @user
|
|
end
|
|
end
|
|
end
|
|
end
|