mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-05 22:48:24 -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:
@@ -27,7 +27,7 @@
|
||||
smaller=smaller_font_size
|
||||
) }}
|
||||
</div>
|
||||
{% if 'letter' in current_service['permissions'] %}
|
||||
{% if current_service.has_permission('letter') %}
|
||||
<div id="total-letters" class="{{column_width}}">
|
||||
{{ big_number_with_status(
|
||||
statistics['letter']['requested'],
|
||||
|
||||
@@ -92,7 +92,7 @@
|
||||
'Basic view'
|
||||
) }}
|
||||
{% endif %}
|
||||
{% if 'email_auth' in current_service['permissions'] %}
|
||||
{% if current_service.has_permission('email_auth') %}
|
||||
<div class="tick-cross-list-hint">
|
||||
{% if user.auth_type == 'sms_auth' %}
|
||||
Signs in with a text message code
|
||||
|
||||
Reference in New Issue
Block a user