mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-10 17:21:38 -05:00
Add authorization for updating location sharing in FamiliesController
This commit is contained in:
parent
58ae4cf2ae
commit
749d1d0031
2 changed files with 6 additions and 0 deletions
|
|
@ -77,6 +77,8 @@ class FamiliesController < ApplicationController
|
|||
end
|
||||
|
||||
def update_location_sharing
|
||||
authorize @family, :update_location_sharing?
|
||||
|
||||
result = Families::UpdateLocationSharing.new(
|
||||
user: current_user,
|
||||
enabled: params[:enabled],
|
||||
|
|
|
|||
|
|
@ -34,6 +34,10 @@ class FamilyPolicy < ApplicationPolicy
|
|||
user.family == record && user.family_owner?
|
||||
end
|
||||
|
||||
def update_location_sharing?
|
||||
user.family == record && user.family_owner?
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def family_owner_with_members?
|
||||
|
|
|
|||
Loading…
Reference in a new issue