添加课程列表查看权限(需用管理员账户将Non member的查看课程列表权限勾选并保存方能查看)

This commit is contained in:
z9hang 2014-05-28 18:04:16 +08:00
parent 91497d3f95
commit 2e36949604
4 changed files with 14 additions and 2 deletions

View File

@ -37,7 +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, # 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, # :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] # :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,:view_homework_attaches] 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 :authorize_global, :only => [:new, :create,:view_homework_attaches]
before_filter :require_admin, :only => [ :copy, :archive, :unarchive, :destroy, :calendar] before_filter :require_admin, :only => [ :copy, :archive, :unarchive, :destroy, :calendar]
before_filter :file, :statistics, :watcherlist before_filter :file, :statistics, :watcherlist

View File

@ -686,7 +686,12 @@ class User < Principal
(block_given? ? yield(role, self) : true) (block_given? ? yield(role, self) : true)
} }
else else
false if admin?
return true
end
#无项目时 查看Non memberid为1角色是否有权限执行action
Role.find('1').allowed_to?(action)
# false
end end
end end

View File

@ -453,6 +453,7 @@ zh:
permission_export_wiki_pages: 导出 wiki 页面 permission_export_wiki_pages: 导出 wiki 页面
permission_manage_subtasks: 管理子任务 permission_manage_subtasks: 管理子任务
permission_view_journals_for_messages: 查看留言 permission_view_journals_for_messages: 查看留言
permission_view_courses: 查看课程列表
project_module_issue_tracking: 问题跟踪 project_module_issue_tracking: 问题跟踪
project_module_time_tracking: 时间跟踪 project_module_time_tracking: 时间跟踪
@ -464,6 +465,7 @@ zh:
project_module_boards: 讨论区 project_module_boards: 讨论区
project_module_calendar: 日历 project_module_calendar: 日历
project_module_gantt: 甘特图 project_module_gantt: 甘特图
project_module_course: 课程
label_module_share: DTS测试工具 label_module_share: DTS测试工具
label_user: 用户 label_user: 用户

View File

@ -178,6 +178,11 @@ Redmine::AccessControl.map do |map|
map.permission :manage_related_issues, {:repositories => [:add_related_issue, :remove_related_issue]} map.permission :manage_related_issues, {:repositories => [:add_related_issue, :remove_related_issue]}
end end
#课程权限模块
map.project_module :course do
map.permission :view_courses,{:projects => [:course]},:read => true
end
#作业模块权限 #作业模块权限
map.project_module :bids do |map| map.project_module :bids do |map|
map.permission :view_homework_attaches, {:bids => [:show, :show_project, :revision]}, :read => true map.permission :view_homework_attaches, {:bids => [:show, :show_project, :revision]}, :read => true