修改用户的课程列表接口
This commit is contained in:
parent
4518fe4355
commit
40d06011f8
|
@ -15,7 +15,6 @@ module Mobile
|
|||
raise('Unauthorized. Invalid or expired token.') unless current_user
|
||||
end
|
||||
|
||||
|
||||
def current_user
|
||||
token = ApiKey.where(access_token: params[:token]).first
|
||||
if token && !token.expired?
|
||||
|
|
|
@ -114,12 +114,13 @@ class UsersService
|
|||
end
|
||||
|
||||
#用户课程列表
|
||||
def user_courses_list params
|
||||
if !User.current.admin? && !@user.active?
|
||||
def user_courses_list params,current_user
|
||||
@user = User.find(params[:id])
|
||||
if !current_user.admin? && !@user.active?
|
||||
raise '404'
|
||||
return
|
||||
end
|
||||
if User.current == @user || User.current.admin?
|
||||
if current_user == @user || current_user.admin?
|
||||
membership = @user.coursememberships.all
|
||||
else
|
||||
membership = @user.coursememberships.all(:conditions => Course.visible_condition(User.current))
|
||||
|
|
Loading…
Reference in New Issue