运营人员有权限查看课程相应列表的权限

dev_trainings
daiao 6 years ago
parent 2bcf334ecb
commit 7126019a38

@ -496,7 +496,7 @@ class StudentWorkController < ApplicationController
def _index
# REDO:分班信息提前查出来,然后循环中根据匹配去取
@is_teacher = User.current.logged? ? (User.current.allowed_to?(:as_teacher,@course) || User.current.admin?) : false
@is_teacher = User.current.logged? ? (User.current.allowed_to?(:as_teacher,@course) || User.current.admin? || User.current.business?) : false
@member = @course.members.where(:user_id => User.current.id).first
# 判断学生是否有权限查看(作业未发布、作业已发布但不是统一设置的未分班学生、分班设置的作业未发布)
if User.current.member_of_course?(@course) && !@is_teacher

@ -1119,7 +1119,7 @@ class User < Principal
end
def member_of_course?(course)
courses.to_a.include?(course)
courses.to_a.include?(course) || User.current.business?
end
def member_of_contest?(contest)
@ -1323,7 +1323,7 @@ class User < Principal
if Project === context
return false unless context.allows_to?(action)
# Admin users are authorized for anything else
return true if admin?
return true if admin? || business?
# 课程:作品关联项目的老师也可以访问私有项目
course_ids = context.student_work_projects.blank? ? "(-1)" : "(" + context.student_work_projects.map{|swp| swp.course_id}.join(",") + ")"

@ -46,7 +46,7 @@
<%#= render :partial => "users/course_item", :locals => {:objects => @objects} %>
<% @objects.each do |object| %>
<% allow_visit = @show_all || object.is_public == 1 || User.current.member_of_course?(object) %>
<% allow_visit = @show_all || object.is_public == 1 || User.current.member_of_course?(object) || User.current.business? %>
<div class="square-Item" onclick="open_course(<%= object.id %>, <%= allow_visit %>)" style="cursor: pointer;">
<% if object.is_public == 1 %>
<div class="publicpart <%= object.id == 1309 ? 'orangeBlack' : '' %>"></div>

Loading…
Cancel
Save