添加新建任务、编辑任务、删除任务、新建占位、编辑占位、删除占位、查看任务、查看占位、查看留言权限代码(未应用)
This commit is contained in:
parent
cb03669085
commit
d83899e3e4
|
@ -264,6 +264,14 @@ class ApplicationController < ActionController::Base
|
|||
render_404
|
||||
end
|
||||
|
||||
#根据course_id找project
|
||||
def find_project_by_course_id
|
||||
@bid = Bid.find params[:course_id]
|
||||
@project = @bid.courses[0]
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_404
|
||||
end
|
||||
|
||||
# Find a project based on params[:project_id]
|
||||
# TODO: some subclasses override this, see about merging their logic
|
||||
def find_optional_project
|
||||
|
|
|
@ -16,6 +16,13 @@ class BidsController < ApplicationController
|
|||
|
||||
before_filter :memberAccess, only: :show_project
|
||||
|
||||
#判断当前角色权限时需先找到当前操作的project
|
||||
before_filter :find_project_by_project_id, :only => [:edit]
|
||||
before_filter :find_project_by_course_id, :only => [:homework_destroy]
|
||||
before_filter :find_project_by_bid_id, :only => [:show_project]
|
||||
#判断当前角色是否有操作权限
|
||||
#勿删 before_filter :authorize, :only => [:edit,:homework_destroy,:show_project]
|
||||
|
||||
helper :watchers
|
||||
helper :attachments
|
||||
include AttachmentsHelper
|
||||
|
@ -26,6 +33,13 @@ class BidsController < ApplicationController
|
|||
helper :words
|
||||
helper :welcome
|
||||
|
||||
def find_project_by_bid_id
|
||||
@bid = Bid.find(params[:id])
|
||||
@project = @bid.courses[0]
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_404
|
||||
end
|
||||
|
||||
def homework_ajax_modal
|
||||
@bid = Bid.find_by_id(params[:id])
|
||||
# find_bid
|
||||
|
@ -523,6 +537,7 @@ class BidsController < ApplicationController
|
|||
message = params[:bid_message][:message] + "\n" + params[:reference_content]
|
||||
else
|
||||
message = params[:bid_message][:message]
|
||||
@m = message
|
||||
end
|
||||
refer_user_id = params[:bid_message][:reference_user_id].to_i
|
||||
@bid.add_jour(User.current, message, refer_user_id)
|
||||
|
|
|
@ -1,5 +1,23 @@
|
|||
class HomeworkAttachController < ApplicationController
|
||||
###############################
|
||||
#判断当前角色权限时需先找到当前操作的project
|
||||
before_filter :find_project_by_bid_id, :only => [:new]
|
||||
before_filter :find_project_by_hoemwork_id, :only => [:edit,:update,:destroy]
|
||||
#判断当前角色是否有操作权限
|
||||
#勿删 before_filter :authorize, :only => [:new,:edit,:update,:destroy]
|
||||
|
||||
def find_project_by_bid_id
|
||||
@bid = Bid.find(params[:id])
|
||||
@project = @bid.courses[0]
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_404
|
||||
end
|
||||
|
||||
def find_project_by_hoemwork_id
|
||||
@homework = HomeworkAttach.find(params[:id])
|
||||
@project = @homework.bid.courses[0]
|
||||
end
|
||||
|
||||
def index
|
||||
@homeworks = HomeworkAttach.all
|
||||
respond_to do |format|
|
||||
|
|
|
@ -37,6 +37,7 @@ class ProjectsController < ApplicationController
|
|||
# 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]
|
||||
#此条勿删 课程相关权限 ,:new_homework,:homework,:feedback
|
||||
before_filter :authorize, :only => [:show, :settings, :edit, :sort_project_members, :update, :modules, :close, :reopen,:view_homework_attaches,:course]
|
||||
before_filter :authorize_global, :only => [:new, :create,:view_homework_attaches]
|
||||
before_filter :require_admin, :only => [ :copy, :archive, :unarchive, :destroy, :calendar]
|
||||
|
|
|
@ -473,6 +473,27 @@ en:
|
|||
permission_export_wiki_pages: Export wiki pages
|
||||
permission_manage_subtasks: Manage subtasks
|
||||
permission_manage_related_issues: Manage related issues
|
||||
permission_view_journals_for_messages: View journals messages
|
||||
permission_view_courses: View courses
|
||||
permission_new_course: Create course
|
||||
permission_configure_course: Configure course
|
||||
permission_close_course: Close/open course
|
||||
permission_new_assignment: Create assignment
|
||||
permission_edit_assignment: Edit assignment
|
||||
permission_delete_assignment: Delete assignment
|
||||
permission_new_placeholder: Create placeholder
|
||||
permission_edit_placeholder: Edit placeholder
|
||||
permission_delete_placeholder: Delete placeholder
|
||||
permission_commit_content: Commit content
|
||||
permission_new_course_notify: Create course notify
|
||||
permission_edit_course_notify: Eidt course notify
|
||||
permission_delete_course_notify: Delete course notify
|
||||
permission_view_assignment: View assignment
|
||||
permission_view_placeholder: View placeholder
|
||||
permission_view_course_messages: View course messages
|
||||
permission_view_real_name: View real name
|
||||
permission_view_students: View students
|
||||
permission_export_homeworks: Export homeworks
|
||||
|
||||
project_module_issue_tracking: Issue tracking
|
||||
project_module_time_tracking: Time tracking
|
||||
|
|
|
@ -471,7 +471,8 @@ zh:
|
|||
permission_view_placeholder: 查看占位
|
||||
permission_view_course_messages: 查看留言
|
||||
permission_view_real_name: 查看真名
|
||||
|
||||
permission_view_students: 查看学生列表
|
||||
permission_export_homeworks: 导出作业
|
||||
|
||||
|
||||
project_module_issue_tracking: 问题跟踪
|
||||
|
|
|
@ -188,16 +188,18 @@ Redmine::AccessControl.map do |map|
|
|||
map.permission :edit_assignment,{:bids => [:edit]},:read => true
|
||||
map.permission :delete_assignment,{:bids => [:homework_destroy]},:read => true
|
||||
map.permission :new_placeholder,{:homework_attach => [:new]},:read => true
|
||||
map.permission :edit_placeholder,{},:read => true
|
||||
map.permission :delete_placeholder,{},:read => true
|
||||
map.permission :commit_content,{},:read => true
|
||||
map.permission :edit_placeholder,{:homework_attach => [:edit,:update]},:read => true
|
||||
map.permission :delete_placeholder,{:homework_attach => [:destroy]},:read => true
|
||||
#map.permission :commit_content,{},:read => true
|
||||
#map.permission :new_course_notify,{},:read => true
|
||||
#map.permission :edit_course_notify,{},:read => true
|
||||
#map.permission :delete_course_notify,{},:read => true
|
||||
map.permission :view_assignment,{},:read => true
|
||||
map.permission :view_placeholder,{},:read => true
|
||||
map.permission :view_course_messages,{},:read => true
|
||||
map.permission :view_assignment,{:projects => [:homework]},:read => true
|
||||
map.permission :view_placeholder,{:bids => [:show_project]},:read => true
|
||||
map.permission :view_course_messages,{:projects => [:feedback]},:read => true
|
||||
map.permission :view_real_name,{},:read => true
|
||||
map.permission :view_students,{}, :read=>true
|
||||
map.permission :export_homeworks,{},:read => true
|
||||
end
|
||||
|
||||
map.project_module :boards do |map|
|
||||
|
|
Loading…
Reference in New Issue