1 ##############################################################################
2 # Copyright (c) 2016 Max Breitenfeldt and others.
3 # Copyright (c) 2018 Parker Berberian, Sawyer Bergeron, and others.
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
12 from celery import shared_task
13 from django.contrib.auth.models import User
14 from jira import JIRAError
16 from account.jira_util import get_jira
20 def sync_jira_accounts():
21 users = User.objects.all()
25 user_dict = jira.myself()
27 # User can be anonymous (local django admin account)
29 user.email = user_dict['emailAddress']
30 user.userprofile.url = user_dict['self']
31 user.userprofile.full_name = user_dict['displayName']
33 user.userprofile.save()