mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-11 09:41:40 -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
|
end
|
||||||
|
|
||||||
def update_location_sharing
|
def update_location_sharing
|
||||||
|
authorize @family, :update_location_sharing?
|
||||||
|
|
||||||
result = Families::UpdateLocationSharing.new(
|
result = Families::UpdateLocationSharing.new(
|
||||||
user: current_user,
|
user: current_user,
|
||||||
enabled: params[:enabled],
|
enabled: params[:enabled],
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,10 @@ class FamilyPolicy < ApplicationPolicy
|
||||||
user.family == record && user.family_owner?
|
user.family == record && user.family_owner?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def update_location_sharing?
|
||||||
|
user.family == record && user.family_owner?
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def family_owner_with_members?
|
def family_owner_with_members?
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue