diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index c301ae0f9..06bc1fd38 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -200,7 +200,7 @@ class HomeworkCommonController < ApplicationController end #是不是课程的老师 def teacher_of_course - render_403 unless User.current.allowed_to?(:as_teacher,@course) + render_403 unless User.current.allowed_to?(:as_teacher,@course) || User.current.admin? end def get_assigned_homeworks(student_works, n, index) diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 8c5561d74..30fd0ff50 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -253,13 +253,13 @@ class StudentWorkController < ApplicationController #是不是当前课程的成员 #当前课程成员才可以看到作品列表 def member_of_course - render_403 unless User.current.member_of_course? @course + render_403 unless User.current.member_of_course? @course || User.current.admin? end #判断是不是当前作品的提交者 #提交者 && (非匿评作业 || 未开启匿评) 可以编辑作品 def author_of_work - render_403 unless User.current.id == @work.user_id && (@homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 1 ) + render_403 unless (User.current.id == @work.user_id || User.current.admin?) && (@homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 1 ) end #根据条件过滤作业结果 diff --git a/db/schema.rb b/db/schema.rb index 42c743588..68f00c1cd 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20150602055730) do +ActiveRecord::Schema.define(:version => 20150604153000) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -23,6 +23,20 @@ ActiveRecord::Schema.define(:version => 20150602055730) do add_index "activities", ["user_id", "act_type"], :name => "index_activities_on_user_id_and_act_type" add_index "activities", ["user_id"], :name => "index_activities_on_user_id" + create_table "activity_notifies", :force => true do |t| + t.integer "activity_container_id" + t.string "activity_container_type" + t.integer "activity_id" + t.string "activity_type" + t.integer "notify_to" + t.datetime "created_on" + t.integer "is_read" + end + + add_index "activity_notifies", ["activity_container_id", "activity_container_type"], :name => "index_an_activity_container_id" + add_index "activity_notifies", ["created_on"], :name => "index_an_created_on" + add_index "activity_notifies", ["notify_to"], :name => "index_an_notify_to" + create_table "api_keys", :force => true do |t| t.string "access_token" t.datetime "expires_at" @@ -606,6 +620,13 @@ ActiveRecord::Schema.define(:version => 20150602055730) do t.datetime "updated_at", :null => false end + create_table "invite_lists", :force => true do |t| + t.integer "project_id" + t.integer "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + create_table "issue_categories", :force => true do |t| t.integer "project_id", :default => 0, :null => false t.string "name", :limit => 30, :default => "", :null => false