diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 1cf14a830..16d9d71d4 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -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, # :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,: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 :require_admin, :only => [ :copy, :archive, :unarchive, :destroy, :calendar] before_filter :file, :statistics, :watcherlist diff --git a/app/models/user.rb b/app/models/user.rb index cf8e3c0cf..edf703873 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -686,7 +686,12 @@ class User < Principal (block_given? ? yield(role, self) : true) } else - false + if admin? + return true + end + #无项目时 查看Non member(id为1)角色是否有权限执行action + Role.find('1').allowed_to?(action) + # false end end diff --git a/config/locales/zh.yml b/config/locales/zh.yml index a0d90f8a2..d5964c011 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -453,6 +453,7 @@ zh: permission_export_wiki_pages: 导出 wiki 页面 permission_manage_subtasks: 管理子任务 permission_view_journals_for_messages: 查看留言 + permission_view_courses: 查看课程列表 project_module_issue_tracking: 问题跟踪 project_module_time_tracking: 时间跟踪 @@ -464,6 +465,7 @@ zh: project_module_boards: 讨论区 project_module_calendar: 日历 project_module_gantt: 甘特图 + project_module_course: 课程 label_module_share: DTS测试工具 label_user: 用户 diff --git a/lib/redmine.rb b/lib/redmine.rb index dd0973902..f53860293 100644 --- a/lib/redmine.rb +++ b/lib/redmine.rb @@ -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 :course do + map.permission :view_courses,{:projects => [:course]},:read => true + end + #作业模块权限 map.project_module :bids do |map| map.permission :view_homework_attaches, {:bids => [:show, :show_project, :revision]}, :read => true