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