#1647 正式版--资源搜索窗口搜索课程资源进行下载返回500错误(资源可见性判断修复)
This commit is contained in:
parent
2fdc6ff988
commit
d8e9dba404
|
@ -7,7 +7,7 @@ class Course < ActiveRecord::Base
|
||||||
STATUS_ARCHIVED = 9
|
STATUS_ARCHIVED = 9
|
||||||
|
|
||||||
attr_accessible :code, :extra, :name, :state, :tea_id, :time , :location, :state, :term, :password,:is_public,:description,:class_period, :open_student
|
attr_accessible :code, :extra, :name, :state, :tea_id, :time , :location, :state, :term, :password,:is_public,:description,:class_period, :open_student
|
||||||
belongs_to :project, :class_name => 'Course', :foreign_key => :extra, primary_key: :identifier
|
#belongs_to :project, :class_name => 'Course', :foreign_key => :extra, primary_key: :identifier
|
||||||
belongs_to :teacher, :class_name => 'User', :foreign_key => :tea_id # 定义一个方法teacher,该方法通过tea_id来调用User表
|
belongs_to :teacher, :class_name => 'User', :foreign_key => :tea_id # 定义一个方法teacher,该方法通过tea_id来调用User表
|
||||||
belongs_to :school, :class_name => 'School', :foreign_key => :school_id #定义一个方法school,该方法通过school_id来调用School表
|
belongs_to :school, :class_name => 'School', :foreign_key => :school_id #定义一个方法school,该方法通过school_id来调用School表
|
||||||
has_many :bid
|
has_many :bid
|
||||||
|
@ -31,7 +31,7 @@ class Course < ActiveRecord::Base
|
||||||
|
|
||||||
acts_as_taggable
|
acts_as_taggable
|
||||||
acts_as_nested_set :order => 'name', :dependent => :destroy
|
acts_as_nested_set :order => 'name', :dependent => :destroy
|
||||||
acts_as_attachable :view_permission => :view_files,
|
acts_as_attachable :view_permission => :view_course_files,
|
||||||
:delete_permission => :manage_files
|
:delete_permission => :manage_files
|
||||||
|
|
||||||
validates_presence_of :password, :term,:name,:description
|
validates_presence_of :password, :term,:name,:description
|
||||||
|
|
|
@ -46,6 +46,9 @@ module Redmine
|
||||||
if self.respond_to?(:project)
|
if self.respond_to?(:project)
|
||||||
(respond_to?(:visible?) ? visible?(user) : true) &&
|
(respond_to?(:visible?) ? visible?(user) : true) &&
|
||||||
user.allowed_to?(self.class.attachable_options[:view_permission], self.project)
|
user.allowed_to?(self.class.attachable_options[:view_permission], self.project)
|
||||||
|
elsif self.is_a?(Course)
|
||||||
|
(respond_to?(:visible?) ? visible?(user) : true) &&
|
||||||
|
user.allowed_to?(self.class.attachable_options[:view_permission], self)
|
||||||
else
|
else
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue