实训开启显示权限控制
This commit is contained in:
parent
90efe7cc35
commit
8bbee334c3
|
@ -144,8 +144,8 @@ module ApplicationHelper
|
||||||
Myshixun.where(:user_id => User.current.id, :parent_id => shixun.id).count > 0 ? true : false
|
Myshixun.where(:user_id => User.current.id, :parent_id => shixun.id).count > 0 ? true : false
|
||||||
end
|
end
|
||||||
|
|
||||||
def tpi_allow_show shixun
|
def allow_shixun_exec shixun
|
||||||
(User.current.logged? && User.current.id != shixun.user_id)
|
(User.current.logged? && User.current.id != shixun.user_id && shixun.status == 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
# 通过系统外部邮箱查找用户,如果用户不存在则用邮箱替换
|
# 通过系统外部邮箱查找用户,如果用户不存在则用邮箱替换
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# status 控制实训的状态,0:未开启;1: 已开启(TPM) 2: 子项目(TPI)
|
# status 控制实训的状态,0:未开启;1: 已开启(TPM)
|
||||||
class Shixun < ActiveRecord::Base
|
class Shixun < ActiveRecord::Base
|
||||||
attr_accessible :description, :is_public, :name, :parent_id, :changeset_num, :forked_form, :status, :user_id, :gpid, :forked_count
|
attr_accessible :description, :is_public, :name, :parent_id, :changeset_num, :forked_form, :status, :user_id, :gpid, :forked_count
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
<%=link_to @shixun.name, shixun_path(@shixun), :class => "pro_new_username break_word" %>
|
<%=link_to @shixun.name, shixun_path(@shixun), :class => "pro_new_username break_word" %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<% if tpi_allow_show(@shixun) %>
|
<% if allow_shixun_exec(@shixun) %>
|
||||||
<div class="fr clear mr15">
|
<div class="fr clear mr15">
|
||||||
<ul>
|
<ul>
|
||||||
<span id="join_in_project_applied">
|
<span id="join_in_project_applied">
|
||||||
|
|
Loading…
Reference in New Issue