diff options
Diffstat (limited to 'app/policies/concerns/member_policy_helpers.rb')
-rw-r--r-- | app/policies/concerns/member_policy_helpers.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/app/policies/concerns/member_policy_helpers.rb b/app/policies/concerns/member_policy_helpers.rb new file mode 100644 index 00000000000..6c4a3caf8bf --- /dev/null +++ b/app/policies/concerns/member_policy_helpers.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +module MemberPolicyHelpers + extend ActiveSupport::Concern + + private + + def record_is_access_request_of_self? + record_is_access_request? && record_belongs_to_self? + end + + def record_is_access_request? + @subject.request? # rubocop:disable Gitlab/ModuleWithInstanceVariables + end + + def record_belongs_to_self? + @user && @subject.user == @user # rubocop:disable Gitlab/ModuleWithInstanceVariables + end +end |