debian-mirror-gitlab/app/policies/todo_policy.rb

11 lines
216 B
Ruby
Raw Normal View History

2019-12-21 20:55:43 +05:30
# 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
end