예제 #1
0
 def get(self, *args, **kwargs):
     if self.request.user.is_authenticated():
         if is_officer(self.request.user):
             return redirect('dash-campgrounds')
         return redirect('public_my_bookings')
     kwargs['form'] = LoginForm
     return super(MarinastayRoutingView, self).get(*args, **kwargs)
예제 #2
0
def mooring_url(request):
    web_url = request.META.get('HTTP_HOST', None)
    tg = 'pvs'
    if web_url in settings.ROTTNEST_ISLAND_URL:
        tg = 'ria'
    else:
        tg = 'pvs'
    authed = request.user.is_authenticated
    mooring_url = mooring_url_group(tg)

    is_officer = False
    is_inventory = False
    is_admin = False
    is_payment_officer = False
    is_customer = False

    failed_refund_count = 0
    if authed:
        if request.user.is_staff or request.user.is_superuser:
            failed_refund_count = models.RefundFailed.objects.filter(
                status=0).count()
        is_officer = helpers.is_officer(request.user)
        is_inventory = helpers.is_inventory(request.user)
        is_admin = helpers.is_admin(request.user)
        is_payment_officer = helpers.is_payment_officer(request.user)
        is_customer = helpers.is_customer(request.user)

    mooring_url['REFUND_FAILED_COUNT'] = failed_refund_count
    mooring_url['IS_OFFICER'] = is_officer
    mooring_url['IS_INVENTORY'] = is_inventory
    mooring_url['IS_ADMIN'] = is_admin
    mooring_url['IS_PAYMENT_OFFICER'] = is_payment_officer
    mooring_url['IS_CUSTOMER'] = is_customer
    return mooring_url
예제 #3
0
def mooring_url(request):
    #web_url = request.META['HTTP_HOST']
    web_url = request.META.get('HTTP_HOST', None)
    if web_url in settings.ROTTNEST_ISLAND_URL:
        template_group = 'rottnest'
        TERMS = "https://www.rottnestisland.com/~/media/Files/boating-documents/marine-hire-facilities-tcs.pdf?la=en"
        PUBLIC_URL = 'https://mooring-ria.dbca.wa.gov.au/'
        mooring_group = 'ria'
    else:
        template_group = 'pvs'
        TERMS = "/know/online-mooring-site-booking-terms-and-conditions"
        PUBLIC_URL = 'https://mooring.dbca.wa.gov.au'
        mooring_group = 'pvs'

    is_officer = False
    is_inventory = False
    is_admin = False
    is_payment_officer = False
    is_customer = False

    failed_refund_count = 0
    if request.user.is_authenticated:
        if request.user.is_staff or request.user.is_superuser:
            failed_refund_count = models.RefundFailed.objects.filter(
                status=0).count()
        is_officer = helpers.is_officer(request.user)
        is_inventory = helpers.is_inventory(request.user)
        is_admin = helpers.is_admin(request.user)
        is_payment_officer = helpers.is_payment_officer(request.user)
        is_customer = helpers.is_customer(request.user)

    return {
        'EXPLORE_PARKS_SEARCH': '/map',
        'EXPLORE_PARKS_CONTACT': '/contact-us',
        'EXPLORE_PARKS_CONSERVE': '/know/conserving-our-moorings',
        'EXPLORE_PARKS_PEAK_PERIODS': '/know/when-visit',
        'EXPLORE_PARKS_ENTRY_FEES': '/know/entry-fees',
        'EXPLORE_PARKS_TERMS': TERMS,
        'PARKSTAY_EXTERNAL_URL': settings.PARKSTAY_EXTERNAL_URL,
        'DEV_STATIC': settings.DEV_STATIC,
        'DEV_STATIC_URL': settings.DEV_STATIC_URL,
        'TEMPLATE_GROUP': template_group,
        'GIT_COMMIT_DATE': settings.GIT_COMMIT_DATE,
        'GIT_COMMIT_HASH': settings.GIT_COMMIT_HASH,
        'SYSTEM_NAME': settings.SYSTEM_NAME,
        'REFUND_FAILED_COUNT': failed_refund_count,
        'IS_OFFICER': is_officer,
        'IS_INVENTORY': is_inventory,
        'IS_ADMIN': is_admin,
        'IS_PAYMENT_OFFICER': is_payment_officer,
        'IS_CUSTOMER': is_customer,
        'PUBLIC_URL': PUBLIC_URL,
        'MOORING_GROUP': mooring_group
    }
예제 #4
0
def mooring_url(request):
    web_url = request.META['HTTP_HOST']
    if web_url in settings.ROTTNEST_ISLAND_URL:
        template_group = 'rottnest'
        TERMS = "https://www.rottnestisland.com/boating/moorings/Rental%20Moorings%20and%20Jetty%20Pens"
    else:
        template_group = 'pvs'
        TERMS = "/know/online-mooring-site-booking-terms-and-conditions"

    is_officer = False
    is_inventory = False
    is_admin = False
    is_payment_officer = False
    is_customer = False

    failed_refund_count = 0
    if request.user.is_authenticated:
        if request.user.is_staff or request.user.is_superuser:
            failed_refund_count = models.RefundFailed.objects.filter(
                status=0).count()
        is_officer = helpers.is_officer(request.user)
        is_inventory = helpers.is_inventory(request.user)
        is_admin = helpers.is_admin(request.user)
        is_payment_officer = helpers.is_payment_officer(request.user)
        is_customer = helpers.is_customer(request.user)

    return {
        'EXPLORE_PARKS_SEARCH': '/map',
        'EXPLORE_PARKS_CONTACT': '/contact-us',
        'EXPLORE_PARKS_CONSERVE': '/know/conserving-our-moorings',
        'EXPLORE_PARKS_PEAK_PERIODS': '/know/when-visit',
        'EXPLORE_PARKS_ENTRY_FEES': '/know/entry-fees',
        'EXPLORE_PARKS_TERMS': TERMS,
        'PARKSTAY_EXTERNAL_URL': settings.PARKSTAY_EXTERNAL_URL,
        'DEV_STATIC': settings.DEV_STATIC,
        'DEV_STATIC_URL': settings.DEV_STATIC_URL,
        'TEMPLATE_GROUP': template_group,
        'GIT_COMMIT_DATE': settings.GIT_COMMIT_DATE,
        'GIT_COMMIT_HASH': settings.GIT_COMMIT_HASH,
        'SYSTEM_NAME': settings.SYSTEM_NAME,
        'REFUND_FAILED_COUNT': failed_refund_count,
        'IS_OFFICER': is_officer,
        'IS_INVENTORY': is_inventory,
        'IS_ADMIN': is_admin,
        'IS_PAYMENT_OFFICER': is_payment_officer,
        'IS_CUSTOMER': is_customer
    }
예제 #5
0
def mooring_url(request):
    web_url = request.META['HTTP_HOST']
    if web_url in settings.ROTTNEST_ISLAND_URL:
       template_group = 'rottnest'
       TERMS  = "https://www.rottnestisland.com/boating/moorings/Rental%20Moorings%20and%20Jetty%20Pens"
    else:
       template_group = 'pvs'
       TERMS = "/know/online-mooring-site-booking-terms-and-conditions"

    is_officer = False
    is_inventory = False
    is_admin = False
    is_payment_officer = False
    is_customer = False
 
    failed_refund_count = 0
    if request.user.is_authenticated:
         if request.user.is_staff or request.user.is_superuser:
             failed_refund_count = models.RefundFailed.objects.filter(status=0).count()
         is_officer = helpers.is_officer(request.user)
         is_inventory = helpers.is_inventory(request.user)
         is_admin = helpers.is_admin(request.user)
         is_payment_officer = helpers.is_payment_officer(request.user)
         is_customer = helpers.is_customer(request.user)

    return {
        'EXPLORE_PARKS_SEARCH': '/map',
        'EXPLORE_PARKS_CONTACT': '/contact-us',
        'EXPLORE_PARKS_CONSERVE': '/know/conserving-our-moorings',
        'EXPLORE_PARKS_PEAK_PERIODS': '/know/when-visit',
        'EXPLORE_PARKS_ENTRY_FEES': '/know/entry-fees',
        'EXPLORE_PARKS_TERMS': TERMS,
        'PARKSTAY_EXTERNAL_URL': settings.PARKSTAY_EXTERNAL_URL,
        'DEV_STATIC': settings.DEV_STATIC,
        'DEV_STATIC_URL': settings.DEV_STATIC_URL,
        'TEMPLATE_GROUP' : template_group,
        'GIT_COMMIT_DATE' : settings.GIT_COMMIT_DATE,
        'GIT_COMMIT_HASH' : settings.GIT_COMMIT_HASH,
        'SYSTEM_NAME' : settings.SYSTEM_NAME,
        'REFUND_FAILED_COUNT': failed_refund_count,
        'IS_OFFICER' : is_officer,
        'IS_INVENTORY' : is_inventory,
        'IS_ADMIN' : is_admin,
        'IS_PAYMENT_OFFICER' : is_payment_officer,
        'IS_CUSTOMER' : is_customer
        }
예제 #6
0
    def __call__(self, request, *args, **kwargs):
        if not is_officer(self.request.user):
            raise Http403('Insufficient permissions')

        return super(ICalFeed, self).__call__(request, *args, **kwargs)
예제 #7
0
 def test_func(self):
     return is_officer(self.request.user)
예제 #8
0
 def has_permission(self, request, view):
     return is_officer(request.user)
예제 #9
0
 def has_permission(self, request, view):
     if request.method == 'GET':
         return True
     return is_officer(request.user)