This commit is contained in:
nwb 2014-07-17 09:10:38 +08:00
commit 63e855725f
6 changed files with 243 additions and 5 deletions

View File

@ -996,4 +996,4 @@ class AnonymousUser < User
def destroy
false
end
end
end

View File

@ -103,3 +103,54 @@ enabled_modules_026:
name: repository
project_id: 2
id: 26
#trustie
enabled_modules_trustie_001:
id: 415
project_id: -1
name: issue_tracking
course_id: 8
enabled_modules_trustie_002:
id: 416
project_id: -1
name: time_tracking
course_id: 8
enabled_modules_trustie_003:
id: 417
project_id: -1
name: news
course_id: 8
enabled_modules_trustie_004:
id: 418
project_id: -1
name: documents
course_id: 8
enabled_modules_trustie_005:
id: 419
project_id: -1
name: files
course_id: 8
enabled_modules_trustie_006:
id: 420
project_id: -1
name: wiki
course_id: 8
enabled_modules_trustie_007:
id: 421
project_id: -1
name: repository
course_id: 8
enabled_modules_trustie_008:
id: 422
project_id: -1
name: boards
course_id: 8
enabled_modules_trustie_009:
id: 423
project_id: -1
name: calendar
course_id: 8
enabled_modules_trustie_010:
id: 424
project_id: -1
name: gantt
course_id: 8

View File

@ -47,3 +47,8 @@ member_roles_011:
role_id: 2
member_id: 10
inherited_from: 10
member_roles_179:
id: 179
member_id: 126
role_id: 3
inherited_from:

View File

@ -60,3 +60,10 @@ members_010:
project_id: 2
user_id: 8
mail_notification: false
members_course_001:
id: 126
user_id: 5
project_id: -1
created_on: 2013-09-30 15:36:00.000000000 Z
mail_notification: false
course_id: 8

View File

@ -199,4 +199,158 @@ roles_005:
- :view_changesets
position: 5
roles_trustie_001:
id: 7
name: 助教
position: 6
assignable: true
builtin: 0
permissions:
- :add_project
- :edit_project
- :manage_members
- :view_journals_for_messages
- :add_course
- :edit_course
- :close_course
- :select_course_modules
- :view_course_journals_for_messages
- :manage_files
- :view_course_files
- :comment_news
- :manage_boards
- :add_messages
- :delete_own_messages
- :view_calendar
- :view_documents
- :view_files
- :view_gantt
- :view_issues
- :add_issues
- :add_issue_notes
- :save_queries
- :browse_repository
- :view_changesets
- :view_time_entries
- :view_wiki_pages
- :export_wiki_pages
- :view_wiki_edits
- :edit_wiki_pages
- :delete_wiki_pages_attachments
- :as_teacher
issues_visibility: default
roles_trustie_002:
id: 9
name: 老师
position: 7
assignable: true
builtin: 0
permissions:
- :add_project
- :edit_project
- :close_project
- :select_project_modules
- :manage_members
- :manage_versions
- :add_subprojects
- :view_journals_for_messages
- :add_course
- :edit_course
- :close_course
- :select_course_modules
- :view_course_journals_for_messages
- :manage_files
- :view_course_files
- :manage_news
- :comment_news
- :manage_boards
- :add_messages
- :edit_messages
- :edit_own_messages
- :delete_messages
- :delete_own_messages
- :view_calendar
- :add_documents
- :edit_documents
- :delete_documents
- :view_documents
- :view_files
- :view_gantt
- :manage_categories
- :view_issues
- :add_issues
- :edit_issues
- :manage_issue_relations
- :manage_subtasks
- :set_issues_private
- :set_own_issues_private
- :add_issue_notes
- :edit_issue_notes
- :edit_own_issue_notes
- :view_private_notes
- :set_notes_private
- :move_issues
- :delete_issues
- :manage_public_queries
- :save_queries
- :view_issue_watchers
- :add_issue_watchers
- :delete_issue_watchers
- :manage_repository
- :browse_repository
- :view_changesets
- :commit_access
- :manage_related_issues
- :log_time
- :view_time_entries
- :edit_time_entries
- :edit_own_time_entries
- :manage_project_activities
- :manage_wiki
- :rename_wiki_pages
- :delete_wiki_pages
- :view_wiki_pages
- :export_wiki_pages
- :view_wiki_edits
- :edit_wiki_pages
- :delete_wiki_pages_attachments
- :protect_wiki_pages
- :as_teacher
issues_visibility: default
roles_trustie_003:
id: 10
name: 学生
position: 8
assignable: true
builtin: 0
permissions:
- :add_project
- :view_journals_for_messages
- :add_course
- :edit_course
- :close_course
- :select_course_modules
- :view_course_journals_for_messages
- :view_course_files
- :comment_news
- :manage_boards
- :add_messages
- :edit_own_messages
- :delete_own_messages
- :view_calendar
- :view_documents
- :view_files
- :view_gantt
- :view_issues
- :add_issues
- :add_issue_notes
- :save_queries
- :browse_repository
- :view_changesets
- :view_time_entries
- :view_wiki_pages
- :view_wiki_edits
- :paret_in_homework
- :as_student
issues_visibility: default

View File

@ -19,14 +19,35 @@ class CoursesControllerTest < ActionController::TestCase
assert courses.all?(&:is_public?)
end
test "test_create_courses_anyone_temporary" do
# 人员添加课程的权限是不属于任何角色
def test_new_course_anyone_temporary
@request.session[:user_id] = 5
Role.find(2).add_permisstion! :add_course
Role.find_by_name("Non member").add_permission! :add_course #Non member
get :new
assert_redirected_to new_course_path
assert_response :success
assert_template :new
end
def test_create_course_anyone_temporary
@request.session[:user_id] = 5
Role.find_by_name("Non member").add_permission! :add_course #Non member
post :create,
:class_period => '32',
:time => '2014',
:term => 'spring',
:course => {
:name => 'course one',
:password => '1234',
:description => 'description',
:is_public => '1234',
:course_type => '1'
}
assert_response :found
course = Course.find_by_name('course one')
assert_redirected_to "courses/#{course.id}/settings"
#assert_redirected_to "courses/#{course.id}/settings"
end
# test "#index by non-admin user with view_time_entries permission should show overall spent time link" do