trivial: apply black
This commit is contained in:
parent
8e5d585102
commit
8089f03e4a
7
setup.py
7
setup.py
|
@ -8,7 +8,6 @@ from distutils.command.sdist import sdist
|
|||
|
||||
|
||||
class eo_sdist(sdist):
|
||||
|
||||
def run(self):
|
||||
if os.path.exists('VERSION'):
|
||||
os.remove('VERSION')
|
||||
|
@ -56,12 +55,10 @@ setup(
|
|||
package_dir={
|
||||
'': 'src',
|
||||
},
|
||||
package_data={
|
||||
},
|
||||
package_data={},
|
||||
install_requires=[
|
||||
'authentic2',
|
||||
],
|
||||
cmdclass={
|
||||
'sdist': eo_sdist},
|
||||
cmdclass={'sdist': eo_sdist},
|
||||
zip_safe=False,
|
||||
)
|
||||
|
|
|
@ -36,4 +36,5 @@ class AppConfig(django.apps.AppConfig):
|
|||
return True
|
||||
return False
|
||||
|
||||
|
||||
default_app_config = 'authentic2_gnm.AppConfig'
|
||||
|
|
|
@ -28,10 +28,8 @@ from authentic2_auth_oidc.models import OIDCProvider, OIDCAccount
|
|||
|
||||
|
||||
class Command(BaseCommand):
|
||||
|
||||
def add_arguments(self, parser):
|
||||
parser.add_argument(
|
||||
'--delta', metavar='DELTA', type=int, default=300)
|
||||
parser.add_argument('--delta', metavar='DELTA', type=int, default=300)
|
||||
|
||||
def handle(self, *args, **options):
|
||||
verbose = int(options['verbosity']) > 0
|
||||
|
@ -40,7 +38,7 @@ class Command(BaseCommand):
|
|||
# check all existing users
|
||||
def chunks(l, n):
|
||||
for i in range(0, len(l), n):
|
||||
yield l[i:i + n]
|
||||
yield l[i : i + n]
|
||||
|
||||
url = settings.CUT_API_BASE_URL + 'users/synchronization/'
|
||||
cut_users = OIDCProvider.objects.get(slug='cut')
|
||||
|
@ -57,13 +55,15 @@ class Command(BaseCommand):
|
|||
if verbose:
|
||||
print('disabling', account.user.email, account.user.ou)
|
||||
account.user.email = account.user.email + '.%s.invalid' % (
|
||||
datetime.datetime.now().strftime('%Y-%m-%dT%H-%M-%S'))
|
||||
datetime.datetime.now().strftime('%Y-%m-%dT%H-%M-%S')
|
||||
)
|
||||
account.user.save()
|
||||
OIDCAccount.objects.filter(sub__in=unknown_uuids).delete()
|
||||
|
||||
# update recently modified users
|
||||
url = settings.CUT_API_BASE_URL + 'users/?modified__gt=%s' % (
|
||||
datetime.datetime.now() - datetime.timedelta(seconds=delta)).strftime('%Y-%m-%dT%H:%M:%S')
|
||||
datetime.datetime.now() - datetime.timedelta(seconds=delta)
|
||||
).strftime('%Y-%m-%dT%H:%M:%S')
|
||||
while url:
|
||||
resp = requests.get(url, auth=settings.CUT_API_CREDENTIALS)
|
||||
resp.raise_for_status()
|
||||
|
|
|
@ -32,7 +32,8 @@ def is_coming_for(request):
|
|||
try:
|
||||
authn_request = ET.fromstring(force_str(request.session['saml:authnRequest']))
|
||||
next_url = authn_request.findall(
|
||||
'{urn:oasis:names:tc:SAML:2.0:protocol}Extensions/{https://www.entrouvert.com/}next_url')[0].text
|
||||
'{urn:oasis:names:tc:SAML:2.0:protocol}Extensions/{https://www.entrouvert.com/}next_url'
|
||||
)[0].text
|
||||
except (KeyError, IndexError):
|
||||
return 'unknown'
|
||||
if not next_url:
|
||||
|
|
Reference in New Issue