blob: 7404ce302bbf12ffda112663ca8b91c6b821f209 [file] [log] [blame]
Tony Mackf593dba2013-03-24 13:17:43 -04001from PLC.Roles import Roles
2from model import Role
3
4class RoleImporter:
5
6 def __init__(self, importer):
7 self.importer = importer
8 self.roles = {}
9
10 def run(self):
11 roles = self.importer.api.GetRoles()
12 db_roles = Role.objects.all()
13 db_roles_list = [db_role['name'] for db_role in db_roles]
14 for role in roles:
15 if role['name'] not in db_roles_list:
16 new_role = Role(name=role['name'])
17 new_role.save()
18 self.roles[role['role_id']] = role
19
20
21