添加文本文件的预览功能
This commit is contained in:
parent
0f340a7cda
commit
5a5db45af2
|
@ -209,7 +209,12 @@ private
|
|||
end
|
||||
|
||||
def read_authorize
|
||||
@attachment.visible? ? true : deny_access
|
||||
if @attachment.container_type == "HomeworkAttach"
|
||||
true
|
||||
#User.current.allowed_to?(:view_homework_attaches, @attachment.project) ? true : deny_access
|
||||
else
|
||||
@attachment.visible? ? true : deny_access
|
||||
end
|
||||
end
|
||||
|
||||
def delete_authorize
|
||||
|
|
|
@ -33,12 +33,12 @@ class ProjectsController < ApplicationController
|
|||
menu_item l(:label_course_news), :only => :index
|
||||
|
||||
|
||||
before_filter :find_project, :except => [ :index, :search,:list, :new, :create, :copy, :statistics, :new_join, :course, :enterprise_course, :course_enterprise]
|
||||
before_filter :find_project, :except => [ :index, :search,:list, :new, :create, :copy, :statistics, :new_join, :course, :enterprise_course, :course_enterprise,:view_homework_attaches]
|
||||
# before_filter :authorize, :except => [:new_join, :new_homework, :homework, :statistics, :search, :watcherlist, :index, :list, :new, :create, :copy, :archive, :unarchive, :destroy, :member, :focus, :file,
|
||||
# :statistics, :feedback, :course, :enterprise_course, :course_enterprise, :project_respond, :share,
|
||||
# :show_projects_score, :issue_score_index, :news_score_index, :file_score_index, :code_submit_score_index, :projects_topic_score_index]
|
||||
before_filter :authorize, :only => [:show, :settings, :edit, :sort_project_members, :update, :modules, :close, :reopen]
|
||||
before_filter :authorize_global, :only => [:new, :create]
|
||||
before_filter :authorize, :only => [:show, :settings, :edit, :sort_project_members, :update, :modules, :close, :reopen,:view_homework_attaches]
|
||||
before_filter :authorize_global, :only => [:new, :create,:view_homework_attaches]
|
||||
before_filter :require_admin, :only => [ :copy, :archive, :unarchive, :destroy, :calendar]
|
||||
before_filter :file, :statistics, :watcherlist
|
||||
|
||||
|
|
|
@ -29,6 +29,13 @@ class HomeworkAttach < ActiveRecord::Base
|
|||
result
|
||||
end
|
||||
|
||||
def project
|
||||
work = HomeworkForCourse.find_by_bid_id(self.bid_id)
|
||||
if work
|
||||
work.project
|
||||
end
|
||||
end
|
||||
|
||||
def add_jours options
|
||||
jfm = self.journals_for_messages.build(options)
|
||||
jfm.save
|
||||
|
|
|
@ -178,6 +178,11 @@ Redmine::AccessControl.map do |map|
|
|||
map.permission :manage_related_issues, {:repositories => [:add_related_issue, :remove_related_issue]}
|
||||
end
|
||||
|
||||
#作业模块权限
|
||||
map.project_module :bids do |map|
|
||||
map.permission :view_homework_attaches, {:bids => [:show, :show_project, :revision]}, :read => true
|
||||
end
|
||||
|
||||
map.project_module :boards do |map|
|
||||
map.permission :manage_boards, {:boards => [:new, :create, :edit, :update, :destroy]}, :require => :member
|
||||
map.permission :view_messages, {:boards => [:index, :show], :messages => [:show]}, :public => true, :read => true
|
||||
|
|
Loading…
Reference in New Issue