实训开启显示权限控制

This commit is contained in:
huang 2017-03-13 15:18:53 +08:00
parent 90efe7cc35
commit 8bbee334c3
3 changed files with 4 additions and 4 deletions

View File

@ -144,8 +144,8 @@ module ApplicationHelper
Myshixun.where(:user_id => User.current.id, :parent_id => shixun.id).count > 0 ? true : false
end
def tpi_allow_show shixun
(User.current.logged? && User.current.id != shixun.user_id)
def allow_shixun_exec shixun
(User.current.logged? && User.current.id != shixun.user_id && shixun.status == 1)
end
# 通过系统外部邮箱查找用户,如果用户不存在则用邮箱替换

View File

@ -1,4 +1,4 @@
# status 控制实训的状态0未开启1: 已开启TPM 2: 子项目TPI
# status 控制实训的状态0未开启1: 已开启TPM
class Shixun < ActiveRecord::Base
attr_accessible :description, :is_public, :name, :parent_id, :changeset_num, :forked_form, :status, :user_id, :gpid, :forked_count

View File

@ -11,7 +11,7 @@
<%=link_to @shixun.name, shixun_path(@shixun), :class => "pro_new_username break_word" %>
</div>
<% if tpi_allow_show(@shixun) %>
<% if allow_shixun_exec(@shixun) %>
<div class="fr clear mr15">
<ul>
<span id="join_in_project_applied">