2026-07-23 10:41:46 -04:00
|
|
|
class Baclight::BrokerPolicy < ApplicationPolicy
|
|
|
|
|
|
2026-09-16 12:41:44 -04:00
|
|
|
def employers_list?; broker_rule?; end
|
2026-07-23 10:41:46 -04:00
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
|
|
def broker_rule?
|
|
|
|
|
user.admin? ||
|
2026-09-16 12:41:44 -04:00
|
|
|
(user.broker? && record.id == user.keychain[:id]) ||
|
2026-07-23 10:41:46 -04:00
|
|
|
(user.carrier? && record.carrier_id == user.keychain[:id])
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
end
|