Skip to content

Commit

Permalink
Allow configuring length of time for auto-approval.
Browse files Browse the repository at this point in the history
  • Loading branch information
amanning9 committed Feb 28, 2024
1 parent 4bacf09 commit 0cfc04b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions jasmin_services/views/role_apply.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import datetime as dt
import logging
from datetime import date

import django.conf
import django.contrib.auth.mixins
import django.core.exceptions
import django.views.generic
import django.views.generic.edit
from dateutil.relativedelta import relativedelta
from django.contrib import messages
from django.db import transaction

Expand Down Expand Up @@ -149,7 +150,10 @@ def form_valid(self, form):
req.resulting_grant = Grant.objects.create(
access=access,
granted_by="automatic",
expires=date.today() + relativedelta(years=1),
expires=date.today()
+ dt.timedelta(
days=django.conf.settings.JASMIN_SERVICES.get("AUTO_ACCEPT_GRANT_TIME", 365)
),
)

if self.previous_request is not None:
Expand Down

0 comments on commit 0cfc04b

Please sign in to comment.