Esempio n. 1
0
def get_realm_user_list(request, realm_id, status_code=200, success_headline="", success_text=""):
    realm = Realm.objects.get(id=realm_id)
    realm_users = LdapUser.get_users(realm=realm)
    user_wrappers = []
    for user in realm_users:
        user_wrappers.append(LdapUser.get_extended_user(user))
    return render(request,
                  'realm/realm_user.jinja2',
                  {
                      'realm': realm,
                      'realm_user': user_wrappers,
                      'success_headline': success_headline,
                      'success_text': success_text,
                  },
                  status=status_code,
                  )
Esempio n. 2
0
def realm_multiple_user_delete_confirm(request, realm_id):
    realm = Realm.objects.get(id=realm_id)
    if request.method == 'POST':
        form = UserDeleteListForm(request.POST)
        if form.is_valid():
            ldap_users = form.cleaned_data['ldap_users']
            blocked_users, deletable_users = get_deletable_blocked_users(
                ldap_users, realm)
            return render(
                request, 'realm/realm_user_multiple_delete.jinja2', {
                    'form': form,
                    'realm': realm,
                    'deletable_users': deletable_users,
                    'blocked_users': blocked_users,
                    'confirm': True
                })
    # TODO: Form not valid
    form = UserDeleteListForm()
    users = LdapUser.get_users(realm=realm)
    return render(request, 'realm/realm_user_multiple_delete_confirm.jinja2', {
        'form': form,
        'realm': realm,
        'users': users
    })