Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
David Seaward
Keel - LDH Middleware
Commits
2a329f1c
Commit
2a329f1c
authored
Feb 15, 2018
by
David Seaward
Committed by
Gogs
Feb 15, 2018
Browse files
Merge branch 'ldap_mail_field_56' of david.seaward/purist_middleware into master
parents
f4e3a8a8
4ba946ed
Changes
4
Hide whitespace changes
Inline
Side-by-side
ldapregister/admin.py
View file @
2a329f1c
...
...
@@ -14,7 +14,7 @@ class LdapGroupAdmin(admin.ModelAdmin):
class
LdapPersonAdmin
(
admin
.
ModelAdmin
):
exclude
=
[
'dn'
,
'objectClass'
]
list_display
=
[
'uid'
,
'description'
,
]
list_display
=
[
'uid'
,
'mail'
,
'description'
,
]
#
...
...
ldapregister/migrations/0002_auto_20180215_1133.py
0 → 100644
View file @
2a329f1c
# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2018-02-15 11:33
from
__future__
import
unicode_literals
import
ldapdb.models.fields
from
django.db
import
migrations
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'ldapregister'
,
'0001_initial'
),
]
operations
=
[
migrations
.
AddField
(
model_name
=
'ldapperson'
,
name
=
'mail'
,
# field=ldapdb.models.fields.CharField(db_column='mail', default='none', max_length=200),
field
=
ldapdb
.
models
.
fields
.
CharField
(
db_column
=
'mail'
,
max_length
=
200
),
preserve_default
=
False
,
),
]
ldapregister/models.py
View file @
2a329f1c
...
...
@@ -9,7 +9,6 @@ from django.conf import settings
from
django.db
import
connections
,
router
from
ldapdb.models.fields
import
CharField
,
ListField
log
=
logging
.
getLogger
(
__name__
)
...
...
@@ -56,6 +55,7 @@ class LdapPerson(ldapdb.models.Model):
cn
=
CharField
(
db_column
=
'cn'
,
max_length
=
200
)
description
=
CharField
(
db_column
=
'description'
,
max_length
=
200
)
sn
=
CharField
(
db_column
=
'sn'
,
max_length
=
200
)
mail
=
CharField
(
db_column
=
'mail'
,
max_length
=
200
)
def
__str__
(
self
):
return
self
.
uid
...
...
purist/models.py
View file @
2a329f1c
...
...
@@ -77,14 +77,14 @@ class User(AbstractUser):
def
create_ldap
(
self
):
username
=
self
.
get_username
()
LdapPerson
.
objects
.
create
(
uid
=
username
,
cn
=
username
,
sn
=
username
)
mail
=
self
.
get_identity
()
LdapPerson
.
objects
.
create
(
uid
=
username
,
cn
=
username
,
sn
=
username
,
mail
=
mail
)
def
set_ldap_password
(
self
,
raw_password
):
ldap_person
=
self
.
get_ldap
()
ldap_person
.
change_password
(
raw_password
)
def
get_identity
(
self
):
# TODO: associated with https://code.puri.sm/purist/account_web/issues/25
return
self
.
get_username
()
+
"@"
+
settings
.
SITE_DOMAIN
.
lower
()
def
save
(
self
,
force_insert
=
False
,
force_update
=
False
,
using
=
None
,
update_fields
=
None
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment