Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
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
edx
edx-platform
Commits
b9cfd7b6
Commit
b9cfd7b6
authored
Oct 06, 2014
by
Carlos Andrés Rocha
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5486 from rocha/list-all-visible-courses
Use all courses during OAut2/OpenID Connect
parents
5c82d6ea
9cd26e55
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
3 deletions
+13
-3
lms/djangoapps/oauth2_handler/handlers.py
+13
-2
lms/djangoapps/oauth2_handler/tests.py
+0
-1
No files found.
lms/djangoapps/oauth2_handler/handlers.py
View file @
b9cfd7b6
...
...
@@ -2,12 +2,13 @@
from
django.conf
import
settings
import
branding
from
courseware.access
import
has_access
from
student.models
import
anonymous_id_for_user
from
student.models
import
UserProfile
from
user_api.models
import
UserPreference
from
lang_pref
import
LANGUAGE_KEY
from
xmodule.modulestore.django
import
modulestore
from
xmodule.course_module
import
CourseDescriptor
class
OpenIDHandler
(
object
):
...
...
@@ -151,7 +152,7 @@ class CourseAccessHandler(object):
user
=
data
[
'user'
]
values
=
set
(
data
.
get
(
'values'
,
[]))
courses
=
branding
.
get_visible
_courses
()
courses
=
_get_all
_courses
()
courses
=
(
c
for
c
in
courses
if
has_access
(
user
,
access_type
,
c
))
course_ids
=
(
unicode
(
c
.
id
)
for
c
in
courses
)
...
...
@@ -186,3 +187,13 @@ class IDTokenHandler(OpenIDHandler, ProfileHandler, CourseAccessHandler):
class
UserInfoHandler
(
OpenIDHandler
,
ProfileHandler
,
CourseAccessHandler
):
""" Configure the UserInfo handler for the LMS. """
pass
def
_get_all_courses
():
"""
Utitilty function to list all available courses.
"""
ms_courses
=
modulestore
()
.
get_courses
()
courses
=
[
c
for
c
in
ms_courses
if
isinstance
(
c
,
CourseDescriptor
)]
return
courses
lms/djangoapps/oauth2_handler/tests.py
View file @
b9cfd7b6
# pylint: disable=missing-docstring
from
django.conf
import
settings
from
django.test.utils
import
override_settings
from
django.test
import
TestCase
...
...
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