def security_test(view, extra_tests=None):
    view = user_passes_test(
        has_provided_job_information,
        login_url='job_information',
    )(view)
    view = user_passes_test(
        can_skip_confirming_prisons,
        login_url='confirm_prisons',
    )(view)
    view = user_passes_test(
        is_hmpps_employee,
        login_url='security:hmpps_employee',
    )(view)

    for extra_test in (extra_tests or []):
        view = user_passes_test(
            extra_test,
            login_url='root',
        )(view)

    view = user_test(required_permissions)(view)
    return view
from django.conf.urls import url

from mtp_noms_ops.utils import user_test
from prisoner_location_admin import required_permissions, views

urlpatterns = [
    url(r'^$',
        user_test(required_permissions)(
            views.LocationFileUploadView.as_view()),
        name='location_file_upload'),
]
from django.conf.urls import url

from . import required_permissions, views
from mtp_noms_ops.utils import user_test

security_test = user_test(required_permissions)

app_name = 'security'
urlpatterns = [
    url(r'^$', security_test(views.CreditsView.as_view()),
        name='credits'),
    url(r'^export$', security_test(views.CreditsExportView.as_view()),
        name='credits_export'),

    url(r'^sender-grouped/$', security_test(views.SenderGroupedView.as_view()),
        name='sender_grouped'),
    url(r'^sender-grouped/credits/$', security_test(views.SenderGroupedView.as_view(listing_credits=True)),
        name='sender_grouped_credits'),

    url(r'^prisoner-grouped/$', security_test(views.PrisonerGroupedView.as_view()),
        name='prisoner_grouped'),
    url(r'^prisoner-grouped/credits/$', security_test(views.PrisonerGroupedView.as_view(listing_credits=True)),
        name='prisoner_grouped_credits'),

    url(r'^review-credits/$', security_test(views.ReviewCreditsView.as_view()),
        name='review_credits'),
]
from django.conf.urls import url

from . import required_permissions, views
from mtp_noms_ops.utils import user_test


urlpatterns = [
    url(r'^$', user_test(required_permissions)(views.LocationFileUploadView.as_view()),
        name='location_file_upload'),
]