further delete (db queries)

This commit is contained in:
yqbk
2016-07-04 17:40:01 +02:00
parent 2bb1362520
commit b962400fab
2 changed files with 1 additions and 17 deletions

View File

@ -25,8 +25,7 @@ class ExercisePolicy < AdminOrAuthorPolicy
if @user.admin?
@scope.all
elsif @user.internal_user?
#need to remove team query
@scope.where('user_id = ? OR public = TRUE OR (team_id IS NOT NULL AND team_id IN (SELECT t.id FROM teams t JOIN internal_users_teams iut ON t.id = iut.team_id WHERE iut.internal_user_id = ?))', @user.id, @user.id)
@scope.where('user_id = ? OR public = TRUE', @user.id, @user.id)
else
@scope.none
end

View File

@ -87,7 +87,6 @@ ActiveRecord::Schema.define(version: 20160624130951) do
t.boolean "public"
t.string "user_type"
t.string "token"
t.integer "team_id"
t.boolean "hide_file_tree"
t.boolean "allow_file_creation"
end
@ -173,14 +172,6 @@ ActiveRecord::Schema.define(version: 20160624130951) do
add_index "internal_users", ["remember_me_token"], name: "index_internal_users_on_remember_me_token", using: :btree
add_index "internal_users", ["reset_password_token"], name: "index_internal_users_on_reset_password_token", using: :btree
create_table "internal_users_teams", force: true do |t|
t.integer "internal_user_id"
t.integer "team_id"
end
add_index "internal_users_teams", ["internal_user_id"], name: "index_internal_users_teams_on_internal_user_id", using: :btree
add_index "internal_users_teams", ["team_id"], name: "index_internal_users_teams_on_team_id", using: :btree
create_table "request_for_comments", force: true do |t|
t.integer "user_id", null: false
t.integer "exercise_id", null: false
@ -203,12 +194,6 @@ ActiveRecord::Schema.define(version: 20160624130951) do
t.string "user_type"
end
create_table "teams", force: true do |t|
t.string "name"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "testruns", force: true do |t|
t.boolean "passed"
t.text "output"