Add PasswordConfirmationPolicy
This commit is contained in:
parent
734bfe1dc1
commit
220063b670
2 changed files with 35 additions and 0 deletions
10
app/policies/passport_confirmation_policy.rb
Normal file
10
app/policies/passport_confirmation_policy.rb
Normal file
|
@ -0,0 +1,10 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class PassportConfirmationPolicy < ApplicationPolicy
|
||||
def create?
|
||||
return false if record.passport.nil?
|
||||
return false if record.user != user
|
||||
|
||||
policy(record.passport).show?
|
||||
end
|
||||
end
|
25
spec/policies/passport_confirmation_policy_spec.rb
Normal file
25
spec/policies/passport_confirmation_policy_spec.rb
Normal file
|
@ -0,0 +1,25 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe PassportConfirmationPolicy do
|
||||
permissions '.scope' do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
||||
|
||||
permissions :show? do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
||||
|
||||
permissions :create? do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
||||
|
||||
permissions :update? do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
||||
|
||||
permissions :destroy? do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
||||
end
|
Reference in a new issue