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
a2524c51
Commit
a2524c51
authored
Jun 24, 2013
by
Don Mitchell
Committed by
Calen Pennington
Jul 01, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Force locations to be Location objects earlier
parent
ddfbe598
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
6 deletions
+7
-6
cms/djangoapps/contentstore/views/access.py
+4
-3
cms/djangoapps/contentstore/views/assets.py
+1
-1
cms/djangoapps/contentstore/views/course.py
+1
-1
cms/djangoapps/models/settings/course_details.py
+1
-1
No files found.
cms/djangoapps/contentstore/views/access.py
View file @
a2524c51
...
@@ -2,12 +2,13 @@ from auth.authz import STAFF_ROLE_NAME, INSTRUCTOR_ROLE_NAME
...
@@ -2,12 +2,13 @@ from auth.authz import STAFF_ROLE_NAME, INSTRUCTOR_ROLE_NAME
from
auth.authz
import
is_user_in_course_group_role
from
auth.authz
import
is_user_in_course_group_role
from
django.core.exceptions
import
PermissionDenied
from
django.core.exceptions
import
PermissionDenied
from
..utils
import
get_course_location_for_item
from
..utils
import
get_course_location_for_item
from
xmodule.modulestore
import
Location
def
get_location_and_verify_access
(
request
,
org
,
course
,
name
):
def
get_location_and_verify_access
(
request
,
org
,
course
,
name
):
"""
"""
Create the location
tuple
verify that the user has permissions
Create the location
,
verify that the user has permissions
to view the location. Returns the location
.
to view the location. Returns the location
as a Location
"""
"""
location
=
[
'i4x'
,
org
,
course
,
'course'
,
name
]
location
=
[
'i4x'
,
org
,
course
,
'course'
,
name
]
...
@@ -15,7 +16,7 @@ def get_location_and_verify_access(request, org, course, name):
...
@@ -15,7 +16,7 @@ def get_location_and_verify_access(request, org, course, name):
if
not
has_access
(
request
.
user
,
location
):
if
not
has_access
(
request
.
user
,
location
):
raise
PermissionDenied
()
raise
PermissionDenied
()
return
location
return
Location
(
location
)
def
has_access
(
user
,
location
,
role
=
STAFF_ROLE_NAME
):
def
has_access
(
user
,
location
,
role
=
STAFF_ROLE_NAME
):
...
...
cms/djangoapps/contentstore/views/assets.py
View file @
a2524c51
...
@@ -258,7 +258,7 @@ def import_course(request, org, course, name):
...
@@ -258,7 +258,7 @@ def import_course(request, org, course, name):
_module_store
,
course_items
=
import_from_xml
(
modulestore
(
'direct'
),
settings
.
GITHUB_REPO_ROOT
,
_module_store
,
course_items
=
import_from_xml
(
modulestore
(
'direct'
),
settings
.
GITHUB_REPO_ROOT
,
[
course_subdir
],
load_error_modules
=
False
,
[
course_subdir
],
load_error_modules
=
False
,
static_content_store
=
contentstore
(),
static_content_store
=
contentstore
(),
target_location_namespace
=
Location
(
location
)
,
target_location_namespace
=
location
,
draft_store
=
modulestore
())
draft_store
=
modulestore
())
# we can blow this away when we're done importing.
# we can blow this away when we're done importing.
...
...
cms/djangoapps/contentstore/views/course.py
View file @
a2524c51
...
@@ -153,7 +153,7 @@ def course_info(request, org, course, name, provided_id=None):
...
@@ -153,7 +153,7 @@ def course_info(request, org, course, name, provided_id=None):
course_module
=
modulestore
()
.
get_item
(
location
)
course_module
=
modulestore
()
.
get_item
(
location
)
# get current updates
# get current updates
location
=
[
'i4x'
,
org
,
course
,
'course_info'
,
"updates"
]
location
=
Location
([
'i4x'
,
org
,
course
,
'course_info'
,
"updates"
])
return
render_to_response
(
'course_info.html'
,
{
return
render_to_response
(
'course_info.html'
,
{
'active_tab'
:
'courseinfo-tab'
,
'active_tab'
:
'courseinfo-tab'
,
...
...
cms/djangoapps/models/settings/course_details.py
View file @
a2524c51
...
@@ -74,7 +74,7 @@ class CourseDetails(object):
...
@@ -74,7 +74,7 @@ class CourseDetails(object):
Decode the json into CourseDetails and save any changed attrs to the db
Decode the json into CourseDetails and save any changed attrs to the db
"""
"""
# TODO make it an error for this to be undefined & for it to not be retrievable from modulestore
# TODO make it an error for this to be undefined & for it to not be retrievable from modulestore
course_location
=
jsondict
[
'course_location'
]
course_location
=
Location
(
jsondict
[
'course_location'
])
# Will probably want to cache the inflight courses because every blur generates an update
# Will probably want to cache the inflight courses because every blur generates an update
descriptor
=
get_modulestore
(
course_location
)
.
get_item
(
course_location
)
descriptor
=
get_modulestore
(
course_location
)
.
get_item
(
course_location
)
...
...
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