2019-10-17 11:06:17 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class TodoPolicy < BasePolicy
|
|
|
|
desc 'User can only read own todos'
|
|
|
|
condition(:own_todo) do
|
|
|
|
@user && @subject.user_id == @user.id
|
|
|
|
end
|
|
|
|
|
|
|
|
rule { own_todo }.enable :read_todo
|
2019-11-12 10:06:26 -05:00
|
|
|
rule { own_todo }.enable :update_todo
|
2019-10-17 11:06:17 -04:00
|
|
|
end
|