Esempio n. 1
0
def render_user_detail_view(request, realm_id, user_dn):
    realm = Realm.objects.get(id=realm_id)
    ldap_user = LdapUser.get_user_by_dn(dn=user_dn)
    user_wrapper = LdapUser.get_extended_user(ldap_user)
    LdapGroup.base_dn = LdapGroup.ROOT_DN
    groups = LdapGroup.objects.filter(members=ldap_user.dn)
    return render(request,
                  'user/user_detail.jinja2',
                  {
                      'user': user_wrapper,
                      'groups': groups,
                      'realm': realm,
                  }, )
Esempio n. 2
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. 3
0
def render_realm_user_detail_view(request, realm_id, user_dn, success_headline=None, success_text=None,
                                  error_headline=None, error_text=None, status_code=200):
    realm = Realm.objects.get(id=realm_id)
    LdapUser.base_dn = realm.ldap_base_dn
    LdapGroup.base_dn = LdapGroup.ROOT_DN
    user = LdapUser.objects.get(dn=user_dn)
    user_wrapper = LdapUser.get_extended_user(user)
    groups = LdapGroup.objects.filter(members=user.dn)
    return render(request,
                  'user/realm_user_detail.jinja2',
                  {
                      'user': user_wrapper,
                      'groups': groups,
                      'realm': realm,
                      'success_headline': success_headline,
                      'success_text': success_text,
                      'error_headline': error_headline,
                      'error_text': error_text,
                  }, status=status_code)