Open neic opened 6 years ago
Jeg har netop oprettet brugere til BEST via følgende script (pastet ind i manage.py shell).
from tkweb.apps.idm.models import *
from django.contrib.auth.models import User, Group
titles = 'CERM FORM INKA KASS PR SEKR VC'.split()
usernames = [...]
User.objects.filter(username__in=usernames).delete()
passwords = [...]
fudo = User.objects.get(username='fudo')
groups = list(fudo.groups.exclude(name='NF'))
for root, username, password in zip(titles, usernames, passwords):
t = Title.objects.get(period=2018, root=root)
first, last = t.profile.name.split(' ', 1)
user = User(username=username, first_name=first, last_name=last, is_staff=True, email=t.profile.email)
user.set_password(password)
user.save()
user.groups.set(groups)
user.groups.add(Group.objects.get(name=root))
Django auth brugere skalere ikke. Det burde skrives sammen med IDM og man skal kunne logge ind med alle ens aliaser.
Se også #177 om KBESTs adgang.