Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
uffd
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Luca (strifel)
uffd
Commits
fa63b4ac
Commit
fa63b4ac
authored
4 years ago
by
Julian
Browse files
Options
Downloads
Patches
Plain Diff
Fixed relationship set and objectClass attribute handling for session.add
parent
9a0699fb
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
ldap_mapper/core.py
+2
-0
2 additions, 0 deletions
ldap_mapper/core.py
ldap_mapper/relationship.py
+1
-1
1 addition, 1 deletion
ldap_mapper/relationship.py
uffd/user/views_user.py
+1
-1
1 addition, 1 deletion
uffd/user/views_user.py
with
4 additions
and
2 deletions
ldap_mapper/core.py
+
2
−
0
View file @
fa63b4ac
...
@@ -60,12 +60,14 @@ class AddOperation:
...
@@ -60,12 +60,14 @@ class AddOperation:
def
apply_object
(
self
,
obj_state
):
def
apply_object
(
self
,
obj_state
):
obj_state
.
dn
=
self
.
dn
obj_state
.
dn
=
self
.
dn
obj_state
.
attributes
=
{
name
:
values
.
copy
()
for
name
,
values
in
self
.
attributes
.
items
()}
obj_state
.
attributes
=
{
name
:
values
.
copy
()
for
name
,
values
in
self
.
attributes
.
items
()}
obj_state
.
attributes
[
'
objectClass
'
]
=
obj_state
.
attributes
.
get
(
'
objectClass
'
,
[])
+
list
(
self
.
object_classes
)
def
apply_session
(
self
,
session_state
):
def
apply_session
(
self
,
session_state
):
assert
self
.
dn
not
in
session_state
.
objects
assert
self
.
dn
not
in
session_state
.
objects
session_state
.
objects
[
self
.
dn
]
=
self
.
obj
session_state
.
objects
[
self
.
dn
]
=
self
.
obj
for
name
,
values
in
self
.
attributes
.
items
():
for
name
,
values
in
self
.
attributes
.
items
():
session_state
.
ref
(
self
.
obj
,
name
,
values
)
session_state
.
ref
(
self
.
obj
,
name
,
values
)
session_state
.
ref
(
self
.
obj
,
'
objectClass
'
,
self
.
object_classes
)
def
apply_ldap
(
self
,
conn
):
def
apply_ldap
(
self
,
conn
):
success
=
conn
.
add
(
self
.
dn
,
self
.
object_classes
,
self
.
attributes
)
success
=
conn
.
add
(
self
.
dn
,
self
.
object_classes
,
self
.
attributes
)
...
...
This diff is collapsed.
Click to expand it.
ldap_mapper/relationship.py
+
1
−
1
View file @
fa63b4ac
...
@@ -28,7 +28,7 @@ class RelationshipSet(MutableSet):
...
@@ -28,7 +28,7 @@ class RelationshipSet(MutableSet):
def
__iter__
(
self
):
def
__iter__
(
self
):
def
get
(
dn
):
def
get
(
dn
):
return
make_modelobj
(
self
.
__ldap_object
.
session
.
get
(
dn
,
self
.
__model
.
ldap_filter_params
),
self
.
__destmodel
)
return
make_modelobj
(
self
.
__ldap_object
.
session
.
get
(
dn
,
self
.
__
dest
model
.
ldap_filter_params
),
self
.
__destmodel
)
dns
=
set
(
self
.
__ldap_object
.
getattr
(
self
.
__name
))
dns
=
set
(
self
.
__ldap_object
.
getattr
(
self
.
__name
))
return
iter
(
filter
(
lambda
obj
:
obj
is
not
None
,
map
(
get
,
dns
)))
return
iter
(
filter
(
lambda
obj
:
obj
is
not
None
,
map
(
get
,
dns
)))
...
...
This diff is collapsed.
Click to expand it.
uffd/user/views_user.py
+
1
−
1
View file @
fa63b4ac
...
@@ -105,11 +105,11 @@ def csvimport():
...
@@ -105,11 +105,11 @@ def csvimport():
if
not
newuser
.
set_mail
(
row
[
1
]):
if
not
newuser
.
set_mail
(
row
[
1
]):
flash
(
"
invalid mail address, skipped : {}
"
.
format
(
row
))
flash
(
"
invalid mail address, skipped : {}
"
.
format
(
row
))
continue
continue
ldap
.
session
.
add
(
newuser
)
for
role
in
roles
:
for
role
in
roles
:
if
(
str
(
role
.
id
)
in
row
[
2
].
split
(
'
;
'
))
or
role
.
name
in
current_app
.
config
[
"
ROLES_BASEROLES
"
]:
if
(
str
(
role
.
id
)
in
row
[
2
].
split
(
'
;
'
))
or
role
.
name
in
current_app
.
config
[
"
ROLES_BASEROLES
"
]:
role
.
members
.
add
(
newuser
)
role
.
members
.
add
(
newuser
)
newuser
.
update_groups
()
newuser
.
update_groups
()
ldap
.
session
.
add
(
newuser
)
try
:
try
:
ldap
.
session
.
commit
()
ldap
.
session
.
commit
()
db
.
session
.
commit
()
db
.
session
.
commit
()
...
...
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