增加访问作业显示列表的权限
This commit is contained in:
parent
56ce9e8bdb
commit
ed9b97f987
|
@ -450,6 +450,7 @@ class BidsController < ApplicationController
|
|||
# 显示作业课程
|
||||
# add by nwb
|
||||
def show_courseEx
|
||||
if (User.current.logged? && User.current.member_of_course?(@bid.courses.first))
|
||||
# flash[:notice] = ""
|
||||
@membership = User.current.coursememberships.all(:conditions => Course.visible_condition(User.current))
|
||||
@option = []
|
||||
|
@ -523,6 +524,9 @@ class BidsController < ApplicationController
|
|||
end
|
||||
format.api
|
||||
end
|
||||
else
|
||||
render_403 :message => :notice_not_authorized
|
||||
end
|
||||
end
|
||||
|
||||
##### by huang
|
||||
|
|
|
@ -39,7 +39,9 @@ module ApplicationHelper
|
|||
# REVIEW: 目测menu的机制,貌似不是很需要转换,再说
|
||||
def link_class(label)
|
||||
labels = label.is_a?(Array) ? label : ([] << label)
|
||||
#a = current_menu_item
|
||||
labels.include?(current_menu_item) ? 'selected' : ''
|
||||
|
||||
end
|
||||
#Ended by young
|
||||
# Return true if user is authorized for controller/action, otherwise false
|
||||
|
|
|
@ -214,10 +214,9 @@
|
|||
<% if User.current.member_of_course? course %>
|
||||
<li>
|
||||
<% if User.current.logged? && course && (!Member.where('user_id = ? and course_id = ?', User.current.id, course.id).first.nil? && (Member.where('user_id = ? and course_id = ?', User.current.id, course.id).first.roles&Role.where('id = ? or id = ? or id =?', 5, 10, 7)).size >0) %>
|
||||
<%= link_to l(:label_homework_commit), {:controller => 'bids', :action => 'show_course'}, :class => link_class(:course) %>
|
||||
<%= link_to l(:label_homework_commit), course_for_bid_path, :class => link_class(:course) %>
|
||||
<% else %>
|
||||
<%= link_to l(:label_homework_info), {:controller => 'bids', :action => 'show_course'}, :class => link_class(:course) %>
|
||||
|
||||
<%#= link_to l(:label_homework_info), course_for_bid_path, :class => link_class(:course) %>
|
||||
<% end %>
|
||||
</li>
|
||||
<% end %>
|
||||
|
|
Loading…
Reference in New Issue