Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
django-openid-auth
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
django-openid-auth
Commits
51e011bf
Commit
51e011bf
authored
Jan 05, 2010
by
Thomas Bechtold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add possibility to map automatic all django-groups to launchpad teams
parent
511a27aa
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
0 deletions
+19
-0
django_openid_auth/auth.py
+9
-0
django_openid_auth/views.py
+10
-0
No files found.
django_openid_auth/auth.py
View file @
51e011bf
...
@@ -158,7 +158,16 @@ class OpenIDBackend:
...
@@ -158,7 +158,16 @@ class OpenIDBackend:
user
.
save
()
user
.
save
()
def
update_groups_from_teams
(
self
,
user
,
teams_response
):
def
update_groups_from_teams
(
self
,
user
,
teams_response
):
teams_mapping_auto
=
getattr
(
settings
,
'OPENID_LAUNCHPAD_TEAMS_MAPPING_AUTO'
,
False
)
teams_mapping_auto_blacklist
=
getattr
(
settings
,
'OPENID_LAUNCHPAD_TEAMS_MAPPING_AUTO_BLACKLIST'
,
[])
teams_mapping
=
getattr
(
settings
,
'OPENID_LAUNCHPAD_TEAMS_MAPPING'
,
{})
teams_mapping
=
getattr
(
settings
,
'OPENID_LAUNCHPAD_TEAMS_MAPPING'
,
{})
if
teams_mapping_auto
:
#ignore teams_mapping. use all django-groups
teams_mapping
=
dict
()
all_groups
=
Group
.
objects
.
exclude
(
name__in
=
teams_mapping_auto_blacklist
)
for
group
in
all_groups
:
teams_mapping
[
group
.
name
]
=
group
.
name
if
len
(
teams_mapping
)
==
0
:
if
len
(
teams_mapping
)
==
0
:
return
return
...
...
django_openid_auth/views.py
View file @
51e011bf
...
@@ -33,6 +33,7 @@ import urllib
...
@@ -33,6 +33,7 @@ import urllib
from
django.conf
import
settings
from
django.conf
import
settings
from
django.contrib.auth
import
(
from
django.contrib.auth
import
(
REDIRECT_FIELD_NAME
,
authenticate
,
login
as
auth_login
)
REDIRECT_FIELD_NAME
,
authenticate
,
login
as
auth_login
)
from
django.contrib.auth.models
import
Group
from
django.core.urlresolvers
import
reverse
from
django.core.urlresolvers
import
reverse
from
django.http
import
HttpResponse
,
HttpResponseRedirect
from
django.http
import
HttpResponse
,
HttpResponseRedirect
from
django.shortcuts
import
render_to_response
from
django.shortcuts
import
render_to_response
...
@@ -148,7 +149,16 @@ def login_begin(request, template_name='openid/login.html',
...
@@ -148,7 +149,16 @@ def login_begin(request, template_name='openid/login.html',
sreg
.
SRegRequest
(
optional
=
[
'email'
,
'fullname'
,
'nickname'
]))
sreg
.
SRegRequest
(
optional
=
[
'email'
,
'fullname'
,
'nickname'
]))
# Request team info
# Request team info
teams_mapping_auto
=
getattr
(
settings
,
'OPENID_LAUNCHPAD_TEAMS_MAPPING_AUTO'
,
False
)
teams_mapping_auto_blacklist
=
getattr
(
settings
,
'OPENID_LAUNCHPAD_TEAMS_MAPPING_AUTO_BLACKLIST'
,
[])
launchpad_teams
=
getattr
(
settings
,
'OPENID_LAUNCHPAD_TEAMS_MAPPING'
,
{})
launchpad_teams
=
getattr
(
settings
,
'OPENID_LAUNCHPAD_TEAMS_MAPPING'
,
{})
if
teams_mapping_auto
:
#ignore launchpad teams. use all django-groups
launchpad_teams
=
dict
()
all_groups
=
Group
.
objects
.
exclude
(
name__in
=
teams_mapping_auto_blacklist
)
for
group
in
all_groups
:
launchpad_teams
[
group
.
name
]
=
group
.
name
if
launchpad_teams
:
if
launchpad_teams
:
openid_request
.
addExtension
(
teams
.
TeamsRequest
(
launchpad_teams
.
keys
()))
openid_request
.
addExtension
(
teams
.
TeamsRequest
(
launchpad_teams
.
keys
()))
...
...
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