aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo Chatzimichos <tampakrap@gmail.com>2013-08-12 01:34:23 -0700
committerTheo Chatzimichos <tampakrap@gmail.com>2013-08-12 01:34:23 -0700
commit24986b2df8ed57068aa506c88c1502b19c0bfd51 (patch)
treeda12ff77e0450c82099a975fc1f8db0ff948d427 /okupy/accounts
parentMerge pull request #55 from tampakrap/unittests (diff)
parentuse LDAPUser and ldapdb in profile page (diff)
downloadidentity.gentoo.org-24986b2df8ed57068aa506c88c1502b19c0bfd51.tar.gz
identity.gentoo.org-24986b2df8ed57068aa506c88c1502b19c0bfd51.tar.bz2
identity.gentoo.org-24986b2df8ed57068aa506c88c1502b19c0bfd51.zip
Merge pull request #47 from dastergon/prof_page_ldapdb
Use LDAPUser and ldapdb in profile page
Diffstat (limited to 'okupy/accounts')
-rw-r--r--okupy/accounts/views.py37
1 files changed, 2 insertions, 35 deletions
diff --git a/okupy/accounts/views.py b/okupy/accounts/views.py
index b401d92..f111c67 100644
--- a/okupy/accounts/views.py
+++ b/okupy/accounts/views.py
@@ -64,42 +64,9 @@ class DevListsView(View):
@otp_required
def index(request):
- anon_ldap_user = get_ldap_connection()
- results = anon_ldap_user.search_s(settings.AUTH_LDAP_USER_DN_TEMPLATE % {
- 'user': request.user}, ldap.SCOPE_SUBTREE, '(uid=%s)' % (request.user))
- attrs = results[0][1]
- personal_attributes = {
- 'cn': 'Real Name', 'uid': 'Nickname', 'gentooLocation': 'Location'}
- contact_attributes = {'mail': 'Email', 'gentooIM': 'IM Nickname'}
- gentoo_attributes = {
- 'herd': 'Herds', 'gentooRoles': 'Roles', 'gentooJoin': 'Date Joined',
- 'gentooMentor': 'Mentor', 'gentooDevBug': 'Recruitment Bug',
- 'gentooRetired': 'Retired'}
- ldap_personal_info = {}
- ldap_contact_info = {}
- ldap_gentoo_info = {}
-
- for k, v in personal_attributes.items():
- attrs[k] = attrs.get(k, ['Empty, when it should be'])
- ldap_personal_info[v] = attrs[k][0]
-
- for k, v in contact_attributes.items():
- attrs[k] = attrs.get(k, [''])
- ldap_contact_info[v] = attrs[k][0]
-
- for k, v in gentoo_attributes.items():
- if k == 'gentooRetired' and k not in attrs:
- continue
- else:
- attrs[k] = attrs.get(k, [''])
- ldap_gentoo_info[v] = attrs[k][0]
-
- anon_ldap_user.unbind_s()
-
+ ldb_user = LDAPUser.objects.filter(username=request.user.username)
return render(request, 'index.html', {
- 'ldap_personal_info': ldap_personal_info,
- 'ldap_contact_info': ldap_contact_info,
- 'ldap_gentoo_info': ldap_gentoo_info
+ 'ldb_user': ldb_user
})