Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
authserv
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
ai
authserv
Commits
27382f91
Commit
27382f91
authored
10 years ago
by
ale
Browse files
Options
Downloads
Patches
Plain Diff
add shard information to the User
parent
71310004
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
authserv/ldap_model.py
+18
-3
18 additions, 3 deletions
authserv/ldap_model.py
authserv/model.py
+2
-1
2 additions, 1 deletion
authserv/model.py
with
20 additions
and
4 deletions
authserv/ldap_model.py
+
18
−
3
View file @
27382f91
...
...
@@ -7,6 +7,15 @@ from ldap.ldapobject import LDAPObject
from
authserv
import
model
# Define the LDAP schema attributes that we will use.
SCHEMA
=
{
'
password
'
:
'
userPassword
'
,
'
otp_secret
'
:
'
totpSecret
'
,
'
app_specific_password
'
:
'
appSpecificPassword
'
,
'
shard
'
:
'
host
'
}
class
Error
(
Exception
):
pass
...
...
@@ -101,16 +110,19 @@ class User(model.User):
self
.
_dn
=
dn
self
.
_otp_enabled
=
False
self
.
_asps
=
[]
self
.
_shard
=
None
for
key
,
values
in
data
.
iteritems
():
if
key
==
'
userP
assword
'
:
if
key
==
SCHEMA
[
'
p
assword
'
]
:
self
.
_password
=
values
[
0
]
if
self
.
_password
.
startswith
(
'
{crypt}
'
):
self
.
_password
=
self
.
_password
[
7
:]
elif
key
==
'
t
otp
S
ecret
'
:
elif
key
==
SCHEMA
[
'
otp
_s
ecret
'
]
:
self
.
_otp_enabled
=
True
self
.
_totp_secret
=
values
[
0
]
elif
key
==
'
app
S
pecific
P
assword
'
:
elif
key
==
SCHEMA
[
'
app
_s
pecific
_p
assword
'
]
:
self
.
_asps
=
[
v
.
split
(
'
:
'
,
1
)
for
v
in
values
]
elif
SCHEMA
[
'
shard
'
]
and
key
==
SCHEMA
[
'
shard
'
]:
self
.
_shard
=
values
[
0
]
def
otp_enabled
(
self
):
return
self
.
_otp_enabled
...
...
@@ -129,3 +141,6 @@ class User(model.User):
def
get_password
(
self
):
return
self
.
_password
def
get_shard
(
self
):
return
self
.
_shard
This diff is collapsed.
Click to expand it.
authserv/model.py
+
2
−
1
View file @
27382f91
...
...
@@ -31,4 +31,5 @@ class User(object):
def
get_password
(
self
):
pass
def
get_shard
(
self
):
pass
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment