Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
I
ipv6-dot-work
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ungleich-public
ipv6-dot-work
Commits
a0ecec66
Commit
a0ecec66
authored
Feb 04, 2019
by
PCoder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor code
parent
67c1dcb1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
21 deletions
+20
-21
ipv6work/settings.py
ipv6work/settings.py
+18
-19
users/ldap_funcs.py
users/ldap_funcs.py
+2
-2
No files found.
ipv6work/settings.py
View file @
a0ecec66
...
...
@@ -177,6 +177,23 @@ MEDIA_URL = FORCE_SCRIPT_NAME + 'media/'
CRISPY_TEMPLATE_PACK
=
'bootstrap4'
LDAP_SEARCH_BASE
=
config
(
'LDAP_SEARCH_BASE'
,
default
=
'ou=customer,dc=ungleich,dc=ch'
)
LDAP_MAX_UID_PATH
=
os
.
path
.
join
(
os
.
path
.
abspath
(
os
.
path
.
dirname
(
__file__
)),
'ldap_max_uid_file'
)
LDAP_IPV6_WORK_USER_GROUP
=
config
(
'LDAP_IPV6_WORK_USER_GROUP'
,
cast
=
int
)
LDAP_DEFAULT_START_UID
=
config
(
'LDAP_DEFAULT_START_UID'
,
cast
=
int
,
default
=
10000
)
LDAP_CUSTOMER_DN
=
config
(
'LDAP_CUSTOMER_DN'
,
default
=
'ou=customer,dc=ungleich,dc=ch'
)
AUTH_LDAP_SERVER_URI
=
config
(
'AUTH_LDAP_SERVER_URI'
)
AUTH_LDAP_BIND_DN
=
config
(
'AUTH_LDAP_BIND_DN'
)
...
...
@@ -184,7 +201,7 @@ AUTH_LDAP_BIND_PASSWORD = config('AUTH_LDAP_BIND_PASSWORD')
AUTH_LDAP_USER_SEARCH
=
LDAPSearchUnion
(
LDAPSearch
(
"ou=users,dc=ungleich,dc=ch"
,
ldap
.
SCOPE_SUBTREE
,
"(uid=%(user)s)"
),
LDAPSearch
(
"ou=customers,dc=ungleich,dc=ch"
,
LDAPSearch
(
LDAP_CUSTOMER_DN
,
ldap
.
SCOPE_SUBTREE
,
"(uid=%(user)s)"
),
)
...
...
@@ -210,24 +227,6 @@ LOGGING = {
},
}
LDAP_SEARCH_BASE
=
config
(
'LDAP_SEARCH_BASE'
,
default
=
'ou=customer,dc=ungleich,dc=ch'
)
LDAP_MAX_UID_PATH
=
os
.
path
.
join
(
os
.
path
.
abspath
(
os
.
path
.
dirname
(
__file__
)),
'ldap_max_uid_file'
)
LDAP_IPV6_WORK_USER_GROUP
=
config
(
'LDAP_IPV6_WORK_USER_GROUP'
,
cast
=
int
)
LDAP_DEFAULT_START_UID
=
config
(
'LDAP_DEFAULT_START_UID'
,
cast
=
int
,
default
=
10000
)
LDAP_USER_DN
=
config
(
'LDAP_USER_DN'
,
default
=
'ou=customer,dc=ungleich,dc=ch'
)
if
config
(
'ENABLE_DEBUG_LOG'
,
cast
=
bool
,
default
=
False
):
loggers_dict
=
{}
MODULES_TO_LOG
=
config
(
'MODULES_TO_LOG'
,
'django'
)
...
...
users/ldap_funcs.py
View file @
a0ecec66
...
...
@@ -20,7 +20,7 @@ def create_user(user, password, firstname, lastname, email):
results
=
True
while
results
:
results
=
conn
.
search
(
search_base
=
settings
.
LDAP_
SEARCH_BASE
,
search_base
=
settings
.
LDAP_
CUSTOMER_DN
,
search_filter
=
(
'(&(objectClass=inetOrgPerson)(objectClass=posixAccount)'
'(objectClass=top)(uidNumber={uidNumber}))'
.
format
(
...
...
@@ -37,7 +37,7 @@ def create_user(user, password, firstname, lastname, email):
logger
.
debug
(
"{uid} does not exist. Using it"
.
format
(
uid
=
uidNumber
))
set_max_uid
(
uidNumber
)
w
=
Writer
(
conn
,
obj_new_user
)
dn
=
'uid=%s,%s'
%
(
user
,
settings
.
LDAP_
US
ER_DN
)
dn
=
'uid=%s,%s'
%
(
user
,
settings
.
LDAP_
CUSTOM
ER_DN
)
w
.
new
(
dn
)
w
[
0
].
givenName
=
firstname
w
[
0
].
sn
=
lastname
...
...
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