debian-mirror-gitlab/app/policies/todo_policy.rb
2019-12-26 22:10:19 +05:30

11 lines
256 B
Ruby

# 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
rule { own_todo }.enable :update_todo
end