From 48ddf9a407e0f98949301de7a2cbd7d62f8a4e47 Mon Sep 17 00:00:00 2001 From: Douglas Barbosa Alexandre Date: Tue, 16 Feb 2016 11:14:30 -0200 Subject: [PATCH] Remove task abilities, since we will only ever show the user their own --- app/controllers/dashboard/tasks_controller.rb | 8 -------- app/models/ability.rb | 11 ----------- 2 files changed, 19 deletions(-) diff --git a/app/controllers/dashboard/tasks_controller.rb b/app/controllers/dashboard/tasks_controller.rb index 2f049da661..d5f835babd 100644 --- a/app/controllers/dashboard/tasks_controller.rb +++ b/app/controllers/dashboard/tasks_controller.rb @@ -1,6 +1,4 @@ class Dashboard::TasksController < Dashboard::ApplicationController - before_action :authorize_destroy_task!, only: [:destroy] - def index @tasks = case params[:state] when 'done' @@ -23,12 +21,6 @@ class Dashboard::TasksController < Dashboard::ApplicationController private - def authorize_destroy_task! - unless can?(current_user, :destroy_task, task) - return render_404 - end - end - def task @task ||= current_user.tasks.find(params[:id]) end diff --git a/app/models/ability.rb b/app/models/ability.rb index 5e0c76004d..a866eadeeb 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -17,7 +17,6 @@ class Ability when Namespace then namespace_abilities(user, subject) when GroupMember then group_member_abilities(user, subject) when ProjectMember then project_member_abilities(user, subject) - when Task then task_abilities(user, subject) else [] end.concat(global_abilities(user)) end @@ -417,16 +416,6 @@ class Ability rules end - def task_abilities(user, task) - rules = [] - - if task && task.user == user - rules << :destroy_task - end - - rules - end - def abilities @abilities ||= begin abilities = Six.new