game锁定权限控制

This commit is contained in:
huang 2017-03-31 13:57:32 +08:00
parent 6a77410d80
commit 8c99bc495a
1 changed files with 6 additions and 0 deletions

View File

@ -6,6 +6,7 @@ class GamesController < ApplicationController
before_filter :find_game, :only => [:show, :game_build, :entry,:next_step, :outputs_show, :file_edit, :file_update, :game_status, :change_status] before_filter :find_game, :only => [:show, :game_build, :entry,:next_step, :outputs_show, :file_edit, :file_update, :game_status, :change_status]
before_filter :find_repository, :only => [:show, :entry, :file_edit, :file_update] before_filter :find_repository, :only => [:show, :entry, :file_edit, :file_update]
before_filter :allowd_manager before_filter :allowd_manager
before_filter :allowd_view, :only => [:show, :game_build, :next_step, :change_status, :file_update]
include ApplicationHelper include ApplicationHelper
def index def index
@ -211,6 +212,11 @@ class GamesController < ApplicationController
render_403 unless (User.current.manager_of_myshixun?(@myshixun) || User.current.admin? || User.current.id == @myshixun.shixun.try(:user_id)) render_403 unless (User.current.manager_of_myshixun?(@myshixun) || User.current.admin? || User.current.id == @myshixun.shixun.try(:user_id))
end end
# 判断成员是否允许查看
def allowd_view
render_403 if @game.status == 3
end
# Find myshixun of id params[:id] # Find myshixun of id params[:id]
def find_myshixun def find_myshixun
myshixun_id = params[:myshixun_id] || (params[:game] && params[:game][:myshixun_id]) myshixun_id = params[:myshixun_id] || (params[:game] && params[:game][:myshixun_id])