|
|
|
@ -39,9 +39,10 @@ class UsersController < ApplicationController
|
|
|
|
|
:user_homeworks, :destroy_membership, :user_activities, :user_projects, :user_newfeedback, :user_comments,
|
|
|
|
|
:watch_bids, :watch_contests, :info, :watch_projects, :show_score, :topic_score_index, :project_score_index,
|
|
|
|
|
:activity_score_index, :influence_score_index, :score_index,:show_new_score, :topic_new_score_index, :project_new_score_index,
|
|
|
|
|
:activity_new_score_index, :influence_new_score_index, :score_new_index]
|
|
|
|
|
:activity_new_score_index, :influence_new_score_index, :score_new_index,:user_projects_index]
|
|
|
|
|
before_filter :auth_user_extension, only: :show
|
|
|
|
|
before_filter :rest_user_score, only: :show
|
|
|
|
|
#before_filter :select_entry, only: :user_projects
|
|
|
|
|
accept_api_auth :index, :show, :create, :update, :destroy,:tag_save , :tag_saveEx
|
|
|
|
|
|
|
|
|
|
#william
|
|
|
|
@ -80,6 +81,21 @@ class UsersController < ApplicationController
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def user_projects_index
|
|
|
|
|
if User.current.admin?
|
|
|
|
|
memberships = @user.memberships.all(conditions: "projects.project_type = #{Project::ProjectType_project}").first
|
|
|
|
|
else
|
|
|
|
|
cond = Project.visible_condition(User.current) + " AND projects.project_type <> 1"
|
|
|
|
|
memberships = @user.memberships.all(:conditions => cond).first
|
|
|
|
|
end
|
|
|
|
|
watch_projects = Project.joins(:watchers).where("project_type <>? and watchable_type = ? and `watchers`.user_id = ?", '1','Project', @user.id).first
|
|
|
|
|
if memberships.nil? && watch_projects
|
|
|
|
|
redirect_to(:watch_projects_user) and return
|
|
|
|
|
else
|
|
|
|
|
redirect_to(:user_projects_user) and return
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
#added by young
|
|
|
|
|
def user_projects
|
|
|
|
|
|
|
|
|
@ -92,8 +108,6 @@ class UsersController < ApplicationController
|
|
|
|
|
#events = Redmine::Activity::Fetcher.new(User.current, :author => @user).events(nil, nil, :limit => 20)
|
|
|
|
|
#@events_by_day = events.group_by(&:event_date)
|
|
|
|
|
@state = 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#add by huang
|
|
|
|
|
unless User.current.admin?
|
|
|
|
|
if !@user.active? #|| (@user != User.current && @memberships.empty? && events.empty?)
|
|
|
|
|