修改用户的课程列表接口

This commit is contained in:
z9hang 2014-12-23 15:38:45 +08:00
parent 4518fe4355
commit 40d06011f8
2 changed files with 4 additions and 4 deletions

View File

@ -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?

View File

@ -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))