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
cf572af1
Commit
cf572af1
authored
Jul 07, 2016
by
Peter Pinch
Committed by
GitHub
Jul 07, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #12889 from mitocw/fix/aq/caoch_dashboard_navigation_issues
Fixed CCX coach dashboard access issues
parents
7c3d902f
0d3f96d4
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
64 additions
and
18 deletions
+64
-18
cms/envs/bok_choy.env.json
+2
-1
common/test/acceptance/pages/studio/settings_advanced.py
+3
-1
common/test/acceptance/tests/lms/test_ccx.py
+17
-5
lms/djangoapps/ccx/tests/test_views.py
+31
-7
lms/djangoapps/ccx/tests/utils.py
+1
-1
lms/djangoapps/ccx/views.py
+10
-3
No files found.
cms/envs/bok_choy.env.json
View file @
cf572af1
...
@@ -77,7 +77,8 @@
...
@@ -77,7 +77,8 @@
"ENABLE_CONTENT_LIBRARIES"
:
true
,
"ENABLE_CONTENT_LIBRARIES"
:
true
,
"ENABLE_SPECIAL_EXAMS"
:
true
,
"ENABLE_SPECIAL_EXAMS"
:
true
,
"SHOW_LANGUAGE_SELECTOR"
:
true
,
"SHOW_LANGUAGE_SELECTOR"
:
true
,
"ENABLE_EXTENDED_COURSE_DETAILS"
:
true
"ENABLE_EXTENDED_COURSE_DETAILS"
:
true
,
"CUSTOM_COURSES_EDX"
:
true
},
},
"FEEDBACK_SUBMISSION_EMAIL"
:
""
,
"FEEDBACK_SUBMISSION_EMAIL"
:
""
,
"GITHUB_REPO_ROOT"
:
"** OVERRIDDEN **"
,
"GITHUB_REPO_ROOT"
:
"** OVERRIDDEN **"
,
...
...
common/test/acceptance/pages/studio/settings_advanced.py
View file @
cf572af1
...
@@ -221,5 +221,7 @@ class AdvancedSettingsPage(CoursePage):
...
@@ -221,5 +221,7 @@ class AdvancedSettingsPage(CoursePage):
'enable_subsection_gating'
,
'enable_subsection_gating'
,
'learning_info'
,
'learning_info'
,
'instructor_info'
,
'instructor_info'
,
'create_zendesk_tickets'
'create_zendesk_tickets'
,
'ccx_connector'
,
'enable_ccx'
]
]
common/test/acceptance/tests/lms/test_ccx.py
View file @
cf572af1
...
@@ -21,23 +21,35 @@ class CreateCCXCoachTest(EventsTestMixin, UniqueCourseTest):
...
@@ -21,23 +21,35 @@ class CreateCCXCoachTest(EventsTestMixin, UniqueCourseTest):
def
setUp
(
self
):
def
setUp
(
self
):
super
(
CreateCCXCoachTest
,
self
)
.
setUp
()
super
(
CreateCCXCoachTest
,
self
)
.
setUp
()
self
.
course_info
.
update
({
"settings"
:
{
"enable_ccx"
:
"true"
}})
self
.
course_info
.
update
({
"settings"
:
{
"enable_ccx"
:
"true"
}})
self
.
course_fixture
=
CourseFixture
(
**
self
.
course_info
)
.
install
()
self
.
course_fixture
=
CourseFixture
(
**
self
.
course_info
)
self
.
coach_dashboard_page
=
CoachDashboardPage
(
self
.
browser
,
self
.
course_id
)
self
.
course_fixture
.
add_advanced_settings
({
"enable_ccx"
:
{
"value"
:
"true"
}
})
self
.
course_fixture
.
install
()
def
_auto_auth
(
self
,
username
,
email
):
self
.
auto_auth
(
self
.
USERNAME
,
self
.
EMAIL
)
self
.
coach_dashboard_page
=
self
.
visit_coach_dashboard
()
def
auto_auth
(
self
,
username
,
email
):
"""
"""
Logout and login with given credentials.
Logout and login with given credentials.
"""
"""
AutoAuthPage
(
self
.
browser
,
username
=
username
,
email
=
email
,
AutoAuthPage
(
self
.
browser
,
username
=
username
,
email
=
email
,
course_id
=
self
.
course_id
,
staff
=
True
)
.
visit
()
course_id
=
self
.
course_id
,
staff
=
True
)
.
visit
()
def
visit_coach_dashboard
(
self
):
"""
Visits the instructor dashboard.
"""
coach_dashboard_page
=
CoachDashboardPage
(
self
.
browser
,
self
.
course_id
)
coach_dashboard_page
.
visit
()
return
coach_dashboard_page
def
test_create_ccx
(
self
):
def
test_create_ccx
(
self
):
"""
"""
Assert that ccx created.
Assert that ccx created.
"""
"""
ccx_name
=
"Test ccx"
ccx_name
=
"Test ccx"
self
.
_auto_auth
(
self
.
USERNAME
,
self
.
EMAIL
)
self
.
coach_dashboard_page
.
visit
()
self
.
coach_dashboard_page
.
fill_ccx_name_text_box
(
ccx_name
)
self
.
coach_dashboard_page
.
fill_ccx_name_text_box
(
ccx_name
)
self
.
coach_dashboard_page
.
wait_for_page
()
self
.
coach_dashboard_page
.
wait_for_page
()
...
...
lms/djangoapps/ccx/tests/test_views.py
View file @
cf572af1
...
@@ -187,6 +187,12 @@ class TestCoachDashboard(CcxTestCase, LoginEnrollmentTestCase):
...
@@ -187,6 +187,12 @@ class TestCoachDashboard(CcxTestCase, LoginEnrollmentTestCase):
Tests for Custom Courses views.
Tests for Custom Courses views.
"""
"""
@classmethod
def
setUpClass
(
cls
):
super
(
TestCoachDashboard
,
cls
)
.
setUpClass
()
cls
.
course_disable_ccx
=
CourseFactory
.
create
(
enable_ccx
=
False
)
cls
.
course_with_ccx_connect_set
=
CourseFactory
.
create
(
enable_ccx
=
True
,
ccx_connector
=
"http://ccx.com"
)
def
setUp
(
self
):
def
setUp
(
self
):
"""
"""
Set up tests
Set up tests
...
@@ -239,16 +245,12 @@ class TestCoachDashboard(CcxTestCase, LoginEnrollmentTestCase):
...
@@ -239,16 +245,12 @@ class TestCoachDashboard(CcxTestCase, LoginEnrollmentTestCase):
"""
"""
Assert that coach cannot create ccx when ``ccx_connector`` url is set.
Assert that coach cannot create ccx when ``ccx_connector`` url is set.
"""
"""
course
=
CourseFactory
.
create
()
role
=
CourseCcxCoachRole
(
self
.
course_with_ccx_connect_set
.
id
)
course
.
ccx_connector
=
"http://ccx.com"
course
.
save
()
self
.
store
.
update_item
(
course
,
0
)
role
=
CourseCcxCoachRole
(
course
.
id
)
role
.
add_users
(
self
.
coach
)
role
.
add_users
(
self
.
coach
)
url
=
reverse
(
url
=
reverse
(
'create_ccx'
,
'create_ccx'
,
kwargs
=
{
'course_id'
:
unicode
(
course
.
id
)})
kwargs
=
{
'course_id'
:
unicode
(
self
.
course_with_ccx_connect_set
.
id
)})
response
=
self
.
client
.
get
(
url
)
response
=
self
.
client
.
get
(
url
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
status_code
,
200
)
...
@@ -311,6 +313,28 @@ class TestCoachDashboard(CcxTestCase, LoginEnrollmentTestCase):
...
@@ -311,6 +313,28 @@ class TestCoachDashboard(CcxTestCase, LoginEnrollmentTestCase):
def
test_create_multiple_ccx
(
self
,
ccx_name
):
def
test_create_multiple_ccx
(
self
,
ccx_name
):
self
.
test_create_ccx
(
ccx_name
)
self
.
test_create_ccx
(
ccx_name
)
def
test_dashboard_access_of_disabled_ccx
(
self
):
"""
User should not see coach dashboard if ccx is disbale in studio.
"""
ccx
=
CcxFactory
(
course_id
=
self
.
course_disable_ccx
.
id
,
coach
=
self
.
coach
)
url
=
reverse
(
'ccx_coach_dashboard'
,
kwargs
=
{
'course_id'
:
CCXLocator
.
from_course_locator
(
self
.
course_disable_ccx
.
id
,
ccx
.
id
)})
response
=
self
.
client
.
get
(
url
)
self
.
assertEqual
(
response
.
status_code
,
404
)
def
test_dashboard_access_with_invalid_ccx_id
(
self
):
"""
User should not see coach dashboard if ccx id is invalid.
"""
self
.
make_ccx
()
url
=
reverse
(
'ccx_coach_dashboard'
,
kwargs
=
{
'course_id'
:
CCXLocator
.
from_course_locator
(
self
.
course_disable_ccx
.
id
,
700
)})
response
=
self
.
client
.
get
(
url
)
self
.
assertEqual
(
response
.
status_code
,
404
)
def
test_get_date
(
self
):
def
test_get_date
(
self
):
"""
"""
Assert that get_date returns valid date.
Assert that get_date returns valid date.
...
@@ -789,7 +813,7 @@ class TestCoachDashboardSchedule(CcxTestCase, LoginEnrollmentTestCase, ModuleSto
...
@@ -789,7 +813,7 @@ class TestCoachDashboardSchedule(CcxTestCase, LoginEnrollmentTestCase, ModuleSto
def
setUp
(
self
):
def
setUp
(
self
):
super
(
TestCoachDashboardSchedule
,
self
)
.
setUp
()
super
(
TestCoachDashboardSchedule
,
self
)
.
setUp
()
self
.
course
=
course
=
CourseFactory
.
create
()
self
.
course
=
course
=
CourseFactory
.
create
(
enable_ccx
=
True
)
# Create a course outline
# Create a course outline
self
.
mooc_start
=
start
=
datetime
.
datetime
(
self
.
mooc_start
=
start
=
datetime
.
datetime
(
...
...
lms/djangoapps/ccx/tests/utils.py
View file @
cf572af1
...
@@ -39,7 +39,7 @@ class CcxTestCase(SharedModuleStoreTestCase):
...
@@ -39,7 +39,7 @@ class CcxTestCase(SharedModuleStoreTestCase):
@classmethod
@classmethod
def
setUpClass
(
cls
):
def
setUpClass
(
cls
):
super
(
CcxTestCase
,
cls
)
.
setUpClass
()
super
(
CcxTestCase
,
cls
)
.
setUpClass
()
cls
.
course
=
course
=
CourseFactory
.
create
()
cls
.
course
=
course
=
CourseFactory
.
create
(
enable_ccx
=
True
)
# Create a course outline
# Create a course outline
cls
.
mooc_start
=
start
=
datetime
.
datetime
(
cls
.
mooc_start
=
start
=
datetime
.
datetime
(
...
...
lms/djangoapps/ccx/views.py
View file @
cf572af1
...
@@ -14,6 +14,7 @@ from cStringIO import StringIO
...
@@ -14,6 +14,7 @@ from cStringIO import StringIO
from
django.conf
import
settings
from
django.conf
import
settings
from
django.core.urlresolvers
import
reverse
from
django.core.urlresolvers
import
reverse
from
django.http
import
(
from
django.http
import
(
Http404
,
HttpResponse
,
HttpResponse
,
HttpResponseForbidden
,
HttpResponseForbidden
,
)
)
...
@@ -84,14 +85,20 @@ def coach_dashboard(view):
...
@@ -84,14 +85,20 @@ def coach_dashboard(view):
ccx
=
None
ccx
=
None
if
isinstance
(
course_key
,
CCXLocator
):
if
isinstance
(
course_key
,
CCXLocator
):
ccx_id
=
course_key
.
ccx
ccx_id
=
course_key
.
ccx
ccx
=
CustomCourseForEdX
.
objects
.
get
(
pk
=
ccx_id
)
try
:
course_key
=
ccx
.
course_id
ccx
=
CustomCourseForEdX
.
objects
.
get
(
pk
=
ccx_id
)
except
CustomCourseForEdX
.
DoesNotExist
:
raise
Http404
if
ccx
:
course_key
=
ccx
.
course_id
course
=
get_course_by_id
(
course_key
,
depth
=
None
)
course
=
get_course_by_id
(
course_key
,
depth
=
None
)
is_staff
=
has_access
(
request
.
user
,
'staff'
,
course
)
is_staff
=
has_access
(
request
.
user
,
'staff'
,
course
)
is_instructor
=
has_access
(
request
.
user
,
'instructor'
,
course
)
is_instructor
=
has_access
(
request
.
user
,
'instructor'
,
course
)
if
is_staff
or
is_instructor
:
if
not
course
.
enable_ccx
:
raise
Http404
elif
is_staff
or
is_instructor
:
# if user is staff or instructor then he can view ccx coach dashboard.
# if user is staff or instructor then he can view ccx coach dashboard.
return
view
(
request
,
course
,
ccx
)
return
view
(
request
,
course
,
ccx
)
else
:
else
:
...
...
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