mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-10 01:01:39 -05:00
23 lines
498 B
Ruby
23 lines
498 B
Ruby
|
|
# frozen_string_literal: true
|
||
|
|
|
||
|
|
class Family::InvitationPolicy < ApplicationPolicy
|
||
|
|
def show?
|
||
|
|
# Public endpoint for invitation acceptance - no authentication required
|
||
|
|
true
|
||
|
|
end
|
||
|
|
|
||
|
|
def create?
|
||
|
|
user.family == record.family && user.family_owner?
|
||
|
|
end
|
||
|
|
|
||
|
|
def accept?
|
||
|
|
# Users can accept invitations sent to their email
|
||
|
|
user.email == record.email
|
||
|
|
end
|
||
|
|
|
||
|
|
def destroy?
|
||
|
|
# Only family owners can cancel invitations
|
||
|
|
user.family == record.family && user.family_owner?
|
||
|
|
end
|
||
|
|
end
|