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
Valentin Samir
django-cas-server
Commits
ed5e3d52
Commit
ed5e3d52
authored
Aug 06, 2016
by
Valentin Samir
Browse files
Unfold many to many attributes in auth.DjangoAuthUser
parent
29522aad
Changes
1
Hide whitespace changes
Inline
Side-by-side
cas_server/auth.py
View file @
ed5e3d52
...
...
@@ -379,6 +379,23 @@ class DjangoAuthUser(AuthUser): # pragma: no cover
field_names
=
self
.
user
.
_meta
.
get_all_field_names
()
for
name
in
field_names
:
attr
[
name
]
=
getattr
(
self
.
user
,
name
)
# unfold user_permissions many to many relation
if
'user_permissions'
in
attr
:
attr
[
'user_permissions'
]
=
[
(
u
"%s.%s"
%
(
perm
.
content_type
.
model_class
().
__module__
,
perm
.
content_type
.
model_class
().
__name__
),
perm
.
codename
)
for
perm
in
attr
[
'user_permissions'
].
filter
()
]
# unfold group many to many relation
if
'groups'
in
attr
:
attr
[
'groups'
]
=
[
group
.
name
for
group
in
attr
[
'groups'
].
filter
()]
return
attr
else
:
return
{}
...
...
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