Removed check_owner def of activity model - a logged in user can update/destroy any activity

This commit is contained in:
Lou 2021-04-29 15:50:41 +02:00
commit 9a28dba9cb
3 changed files with 1 additions and 28 deletions

View file

@ -1,7 +1,6 @@
class Api::V1::ActivitiesController < ApplicationController
before_action :set_activity, only: %i[show update destroy]
before_action :check_login
before_action :check_owner, only: %i[update destroy]
def index
render json: Activity.all
@ -43,8 +42,4 @@ class Api::V1::ActivitiesController < ApplicationController
def set_activity
@activity = Activity.find(params[:id])
end
def check_owner
head :forbidden unless @activity.author_id == current_user&.id
end
end