Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Nounous
re2o
Commits
e55d3a9e
Commit
e55d3a9e
authored
Dec 12, 2016
by
Gabriel Detraz
Committed by
root
Dec 12, 2016
Browse files
Reactive ldap sync
parent
9b142b30
Changes
1
Hide whitespace changes
Inline
Side-by-side
users/models.py
View file @
e55d3a9e
...
...
@@ -44,8 +44,7 @@ def linux_user_validator(login):
def
get_fresh_user_uid
():
uids
=
list
(
range
(
int
(
min
(
UID_RANGES
[
'users'
])),
int
(
max
(
UID_RANGES
[
'users'
]))))
#used_uids = [ user.uid_number for user in User.objects.all()]
used_uids
=
[
10000
]
used_uids
=
[
user
.
uid_number
for
user
in
User
.
objects
.
all
()]
free_uids
=
[
id
for
id
in
uids
if
id
not
in
used_uids
]
return
min
(
free_uids
)
...
...
@@ -249,7 +248,6 @@ class User(AbstractBaseUser):
def
ldap_sync
(
self
,
base
=
True
,
access_refresh
=
True
,
mac_refresh
=
True
):
self
.
refresh_from_db
()
return
try
:
user_ldap
=
LdapUser
.
objects
.
get
(
uidNumber
=
self
.
uid_number
)
except
LdapUser
.
DoesNotExist
:
...
...
@@ -302,7 +300,6 @@ class ServiceUser(AbstractBaseUser):
objects
=
UserManager
()
def
ldap_sync
(
self
):
return
try
:
user_ldap
=
LdapServiceUser
.
objects
.
get
(
name
=
self
.
pseudo
)
except
LdapServiceUser
.
DoesNotExist
:
...
...
@@ -372,7 +369,6 @@ class ListRight(models.Model):
return
self
.
listright
def
ldap_sync
(
self
):
return
try
:
group_ldap
=
LdapUserGroup
.
objects
.
get
(
gid
=
self
.
gid
)
except
LdapUserGroup
.
DoesNotExist
:
...
...
Write
Preview
Supports
Markdown
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