mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-26 17:24:23 -04:00
Make a service model and use for permissions
Having the service floating about as JSON is a bit flakey. Could easily introduce a mistake where you mistype the name of a key and silently get `None`. Also means doing awkward things like `if 'permission' in current_service['permissions']`, whereas for users we can do the much cleaner `user.has_permission()`. So this commit: - introduces a model - adds a `.has_permission` method similar to the one we have for users
This commit is contained in:
@@ -91,7 +91,7 @@ def view_notification(service_id, notification_id):
|
||||
help=get_help_argument(),
|
||||
estimated_letter_delivery_date=get_letter_timings(notification['created_at']).earliest_delivery,
|
||||
notification_id=notification['id'],
|
||||
can_receive_inbound=('inbound_sms' in current_service['permissions']),
|
||||
can_receive_inbound=(current_service.has_permission('inbound_sms')),
|
||||
is_precompiled_letter=notification['template']['is_precompiled_letter']
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user