1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-02 09:51:09 +03:00

Fixed JT migration issue

Role.__contains__ is not defined here, so we needed to drop in the
implementation instead.
This commit is contained in:
Akita Noek 2016-05-02 11:14:31 -04:00
parent 8a5e22cb4a
commit 58e9c4ef87

View File

@ -408,7 +408,7 @@ def migrate_job_templates(apps, schema_editor):
jt.execute_role.members.add(user)
logger.info(smart_text(u'adding User({}) access to JobTemplate({})'.format(user.username, jt.name)))
if user in jt.execute_role:
if jt.execute_role.ancestors.filter(members=user).exists(): # aka "user in jt.execute_role"
# If the job template is already accessible by the user, because they
# are a sytem, organization, or project admin, then don't add an explicit
# role entry for them