Merge branch 'develop' of https://bdgit.trustie.net/hushasha/bigdata into develop

This commit is contained in:
cxt 2017-06-12 14:30:06 +08:00
commit f5b1bc0886
11 changed files with 46 additions and 25 deletions

View File

@ -28,25 +28,25 @@
<data-source source="LOCAL" name="Rails bigdata: production" uuid="a2967bb5-941b-447d-ba0e-5e62ade5fb7d">
<driver-ref>mysql</driver-ref>
<jdbc-driver>com.mysql.jdbc.Driver</jdbc-driver>
<jdbc-url>jdbc:mysql://127.0.0.1/trustie2</jdbc-url>
<jdbc-url>jdbc:mysql://127.0.0.1/0604new</jdbc-url>
<user-name>root</user-name>
<user-password>df9bdf98df99df9edf9fdf9c</user-password>
<user-password>df9bdf98df99df9e</user-password>
<libraries />
</data-source>
<data-source source="LOCAL" name="Rails bigdata: development" uuid="ea7cc5a3-1ef5-4a23-93bb-2c9650c10d07">
<driver-ref>mysql</driver-ref>
<jdbc-driver>com.mysql.jdbc.Driver</jdbc-driver>
<jdbc-url>jdbc:mysql://127.0.0.1/trustie2</jdbc-url>
<jdbc-url>jdbc:mysql://127.0.0.1/20161227data</jdbc-url>
<user-name>root</user-name>
<user-password>df9bdf98df99df9edf9fdf9c</user-password>
<user-password>df9bdf98df99df9e</user-password>
<libraries />
</data-source>
<data-source source="LOCAL" name="Rails bigdata: test" uuid="9f93a163-6133-42ac-a16d-9bd67f458fd6">
<driver-ref>mysql</driver-ref>
<jdbc-driver>com.mysql.jdbc.Driver</jdbc-driver>
<jdbc-url>jdbc:mysql://127.0.0.1/trustie2</jdbc-url>
<jdbc-url>jdbc:mysql://127.0.0.1/0623newblank</jdbc-url>
<user-name>root</user-name>
<user-password>df9bdf98df99df9edf9fdf9c</user-password>
<user-password>df9bdf98df99df9e</user-password>
<libraries />
</data-source>
</component>

View File

@ -45,8 +45,8 @@ class ApplicationController < ActionController::Base
before_filter :find_first_page
before_filter :find_web_footer
before_filter :session_expiration, :user_setup, :check_if_login_required, :set_localization, :check_authentication
before_filter :user_agent
before_filter :session_expiration, :user_setup, :check_if_login_required, :set_localization
before_filter :user_agent
rescue_from ActionController::InvalidAuthenticityToken, :with => :invalid_authenticity_token
rescue_from ::Unauthorized, :with => :deny_access
@ -61,18 +61,18 @@ class ApplicationController < ActionController::Base
end
# 判断用户是否认证
def check_authentication
# return true
if params[:action] == "on_search" || params[:action] == "apply_trail" # 之所以这样处理是为了避开account页面ajax加载
return true
end
authentication = ApplyAction.where(:user_id => User.current.id, :status => 1).first
user_identity = User.current.try(:user_extensions).try(:identity)
if user_identity.blank? || authentication.blank?
redirect_to my_account_path
return
end
end
# def check_authentication
# # return true
# if params[:action] == "on_search" || params[:action] == "apply_trail" # 之所以这样处理是为了避开account页面ajax加载
# return true
# end
# authentication = ApplyAction.where(:user_id => User.current.id, :status => 1).first
# user_identity = User.current.try(:user_extensions).try(:identity)
# if user_identity.blank? || authentication.blank?
# redirect_to my_account_path
# return
# end
# end
def session_expiration
if session[:user_id]

View File

@ -14,6 +14,7 @@ class CoursesController < ApplicationController
before_filter :auth_login1, :only => [:show, :course_activity, :feedback]
skip_before_filter :verify_authenticity_token, :only => [:update_position]
before_filter :check_authentication, :except => [:update_position]
menu_item :overview
menu_item :feedback, :only => :feedback
menu_item :homework, :only => :homework

View File

@ -8,6 +8,7 @@ class ForumsController < ApplicationController
before_filter :authenticate_user_edit, :only => [:edit, :update]
before_filter :authenticate_user_destroy, :only => [:destroy]
before_filter :require_login, :only => [:new, :create,:destroy,:update,:edit]
before_filter :check_authentication
helper :sort
include SortHelper

View File

@ -3,6 +3,7 @@ class MyshixunsController < ApplicationController
layout 'base_myshixun'
skip_before_filter :verify_authenticity_token, :only => [:training_task_status]
before_filter :require_login, :except => [:training_task_status]
before_filter :check_authentication, :except => [:training_task_status]
before_filter :find_myshixun, :only => [:show, :myshixun_reset]
include ApplicationHelper

View File

@ -3,6 +3,7 @@
class ShixunsController < ApplicationController
layout 'base_shixun'
before_filter :require_login
before_filter :check_authentication
before_filter :find_shixun, :except => [ :index, :new, :create, :index, :search ]
before_filter :shixun_view_allow, :only => [:show]
before_filter :require_manager, :only => [ :settings, :add_script, :publish, :collaborators_delete, :shixun_members_added, :add_collaborators]

View File

@ -7,6 +7,7 @@ class SyllabusesController < ApplicationController
include SyllabusesHelper
include UsersHelper
before_filter :is_logged, :only => [:index, :show, :edit, :new, :update, :destroy, :delete_syllabus, :syllabus_resources, :syllabus_homeworks]
before_filter :check_authentication
before_filter :find_syllabus, :only => [:show, :edit, :update, :destroy, :syllabus_courselist, :edit_syllabus_eng_name, :edit_syllabus_title, :update_base_info, :delete_syllabus,
:delete_des, :members, :update_des, :edit_ref, :update_ref, :add_sy_member_alert, :search_not_sy_member, :syllabus_resources, :syllabus_homeworks,
:send_homeworks_to_course, :choose_user_course, :send_resources_to_course, :send_r_and_h_to_course]

View File

@ -35,6 +35,8 @@ class UsersController < ApplicationController
#
before_filter :can_show_course, :only => [:user_courses,:user_homeworks]
before_filter :check_authentication
before_filter :find_user, :only => [:user_fanslist, :user_watchlist, :show, :edit, :update, :destroy, :edit_membership, :user_courses, :unsolved_issues_list, :unfinished_homework_list, :user_manage_homeworks,
:unfinished_poll_list, :user_homeworks,:student_homeworks, :destroy_membership, :user_activities, :user_projects, :user_newfeedback, :user_comments, :update_message_viewed,
:anonymous_evaluation_list,:unfinished_test_list, :watch_contests, :info, :watch_projects, :show_score, :topic_score_index, :project_score_index, :user_receive_homeworks,
@ -665,14 +667,13 @@ class UsersController < ApplicationController
@shixuns = paginateHelper @shixuns, @limit
# 我参入的
id = []
ids = Shixun.find_by_sql("select id from shixun_members where role=2 and user_id=#{@user.id}")
ids2 = Shixun.find_by_sql("select id from shixuns where id in (select shixun_id from myshixuns where user_id = #{@user.id})")
ids = ids.map{|shixun| shixun.id} unless ids.blank?
ids2 = ids2.map{|shixun| shixun.id} unless ids2.blank?
id = ids + ids2
id = id.uniq
@join_shixuns = Shixun.where(:shixun_id => id)
@join_shixuns = Shixun.where(:id => id)
# @join_shixuns_count = @join_shixuns.count
# @join_shixuns_pages = Paginator.new @join_shixuns_count, @limit, params['page'] || 1
# @join_shixuns_offset ||= @join_shixuns_pages.offset

View File

@ -33,6 +33,21 @@ module ApplicationHelper
extend Forwardable
def_delegators :wiki_helper, :wikitoolbar_for, :heads_for_wiki_formatter
# 判断用户是否认证
def check_authentication
# return true
# if params[:action] == "on_search" || params[:action] == "apply_trail" # 之所以这样处理是为了避开account页面ajax加载
# return true
# end
authentication = ApplyAction.where(:user_id => User.current.id, :status => 1).first
user_identity = User.current.try(:user_extensions).try(:identity)
if user_identity.blank? || authentication.blank?
redirect_to my_account_path
return
end
end
# 积分表中建立记录行为,有过奖励则不重复奖励
def reward_grade(user, container_id, container_type, score)
grade = Grade.where(:user_id => user.id, :container_id => container_id, :container_type => container_type).first

View File

@ -6,8 +6,8 @@
<span class="ml5 mr5 fl">/ </span><p class="task-header-title fl" title="<%= @shixun.name %>"><%= @shixun.name %></p>
</h2>
<% if allow_shixun_exec(@shixun) %>
<% if @shixun %>
<% if User.current.manager_of_shixun?(@shixun) %>
<% if User.current.manager_of_shixun?(@shixun) %>
<% if @shixun.status == 1 %>
<%= link_to "重新发布", publish_shixun_path(@shixun, :type => "retry"), :class => "fr shixun-task-btn task-btn-orange mr15", :id => "challenge_begin", :remote => true %>
<% else %>
<%= link_to "发布实训", publish_shixun_path(@shixun), :class => "fr shixun-task-btn task-btn-orange mr15", :id => "challenge_begin", :remote => true %>

View File

@ -21,7 +21,7 @@
<%#= tip2 %>
</p>-->
<div class="clearfix task-popup-submit04">
<a href="<%= url %>" class="task-btn task-btn-blue" id="btn_mask"><%= btn %></a>
<a href="<%= url %>" class="task-btn task-btn-blue" id="btn_mask">知道了</a>
</div>
</div>
</div>