Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Helios Server
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
Show more breadcrumbs
TO
Helios Server
Commits
f330cdd5
Commit
f330cdd5
authored
9 years ago
by
Lukáš Nový
Browse files
Options
Downloads
Patches
Plain Diff
Implement voters fetching by category in pirateid auth_system
parent
0f744df5
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
helios_auth/auth_systems/pirateid.py
+19
-13
19 additions, 13 deletions
helios_auth/auth_systems/pirateid.py
with
19 additions
and
13 deletions
helios_auth/auth_systems/pirateid.py
+
19
−
13
View file @
f330cdd5
"""
"""
Yahoo
Authentication
PirateID
Authentication
"""
"""
...
@@ -24,8 +24,6 @@ LOGIN_MESSAGE = "Log in with my PirateID"
...
@@ -24,8 +24,6 @@ LOGIN_MESSAGE = "Log in with my PirateID"
OPENID_ENDPOINT
=
'
https://openid.pirati.cz
'
OPENID_ENDPOINT
=
'
https://openid.pirati.cz
'
AX_REQUIRED_FIELDS
=
{
AX_REQUIRED_FIELDS
=
{
'
firstname
'
:
'
http://axschema.org/namePerson/first
'
,
'
lastname
'
:
'
http://axschema.org/namePerson/last
'
,
'
fullname
'
:
'
http://axschema.org/namePerson
'
,
'
fullname
'
:
'
http://axschema.org/namePerson
'
,
'
email
'
:
'
http://axschema.org/contact/email
'
,
'
email
'
:
'
http://axschema.org/contact/email
'
,
'
nickname
'
:
'
http://axschema.org/namePerson/friendly
'
'
nickname
'
:
'
http://axschema.org/namePerson/friendly
'
...
@@ -44,7 +42,7 @@ def get_user_info_after_auth(request):
...
@@ -44,7 +42,7 @@ def get_user_info_after_auth(request):
def
do_logout
(
user
):
def
do_logout
(
user
):
"""
"""
logout of
Yahoo
logout of
PirateID
"""
"""
return
None
return
None
...
@@ -56,7 +54,7 @@ def update_status(token, message):
...
@@ -56,7 +54,7 @@ def update_status(token, message):
def
send_message
(
user_id
,
user_name
,
user_info
,
subject
,
body
):
def
send_message
(
user_id
,
user_name
,
user_info
,
subject
,
body
):
"""
"""
send email to
yahoo
user, user_id is
email for yahoo and other openID logins
.
send email to
pirate
user, user_id is
combined with the domain to get the email
.
"""
"""
send_mail
(
subject
,
body
,
settings
.
SERVER_EMAIL
,
[
"
%s <%s@pirati.cz>
"
%
(
user_name
,
user_id
)],
fail_silently
=
False
)
send_mail
(
subject
,
body
,
settings
.
SERVER_EMAIL
,
[
"
%s <%s@pirati.cz>
"
%
(
user_name
,
user_id
)],
fail_silently
=
False
)
...
@@ -65,8 +63,7 @@ def generate_constraint(category_id, user):
...
@@ -65,8 +63,7 @@ def generate_constraint(category_id, user):
def
eligibility_category_id
(
constraint
):
def
eligibility_category_id
(
constraint
):
return
constraint
return
constraint
import
pprint
pp
=
pprint
.
PrettyPrinter
(
indent
=
4
)
def
check_constraint
(
constraint
,
user
):
def
check_constraint
(
constraint
,
user
):
"""
"""
for eligibility
for eligibility
...
@@ -81,17 +78,26 @@ def check_constraint(constraint, user):
...
@@ -81,17 +78,26 @@ def check_constraint(constraint, user):
def
can_list_categories
():
def
can_list_categories
():
"""
"""
we will use phpbb groups
yep, we can
"""
"""
return
True
return
True
def
list_categories
(
user
):
def
list_categories
(
user
):
"""
"""
returns [{id,name},...]
list groups from the graph api
"""
"""
categories
=
[]
groups
=
json
.
load
(
urllib2
.
urlopen
(
"
https://graph.pirati.cz/groups
"
))
groups
=
json
.
load
(
urllib2
.
urlopen
(
"
https://graph.pirati.cz/groups
"
))
for
group
in
groups
:
categories
.
append
({
'
id
'
:
group
[
u
'
id
'
],
'
name
'
:
group
[
u
'
username
'
]})
return
categories
return
[{
'
id
'
:
group
[
u
'
id
'
],
'
name
'
:
group
[
u
'
username
'
]}
for
group
in
groups
]
def
can_list_category_members
():
return
True
def
list_category_members
(
category_id
):
members
=
json
.
load
(
urllib2
.
urlopen
(
"
https://graph.pirati.cz/
"
+
category_id
+
"
/members
"
))
users
=
[]
for
member
in
members
:
user
=
json
.
load
(
urllib2
.
urlopen
(
"
https://graph.pirati.cz/
"
+
member
[
u
'
id
'
]))
users
.
append
({
'
type
'
:
'
pirateid
'
,
'
id
'
:
user
[
u
'
username
'
],
'
name
'
:
user
[
u
'
fullname
'
],
'
info
'
:
{
'
email
'
:
user
[
u
'
email
'
]},
'
token
'
:
{}})
return
users
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