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
247fa6ca
Commit
247fa6ca
authored
Jul 16, 2012
by
Victor Shnayder
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #183 from MITx/victor/cms_more_auth
Add fixes to notes in #182
parents
763808a3
8a63a930
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
9 deletions
+11
-9
cms/djangoapps/contentstore/views.py
+10
-8
rakefile
+1
-1
No files found.
cms/djangoapps/contentstore/views.py
View file @
247fa6ca
...
@@ -68,12 +68,13 @@ def course_index(request, org, course, name):
...
@@ -68,12 +68,13 @@ def course_index(request, org, course, name):
@login_required
@login_required
def
edit_item
(
request
):
def
edit_item
(
request
):
# TODO (vshnayder): Why are we using "id" instead of "location"?
# TODO (vshnayder): change name from id to location in coffee+html as well.
item_id
=
request
.
GET
[
'id'
]
item_location
=
request
.
GET
[
'id'
]
if
not
has_access
(
request
.
user
,
item_id
):
print
item_location
,
request
.
GET
if
not
has_access
(
request
.
user
,
item_location
):
raise
Http404
# TODO (vshnayder): better error
raise
Http404
# TODO (vshnayder): better error
item
=
modulestore
()
.
get_item
(
item_
id
)
item
=
modulestore
()
.
get_item
(
item_
location
)
return
render_to_response
(
'unit.html'
,
{
return
render_to_response
(
'unit.html'
,
{
'contents'
:
item
.
get_html
(),
'contents'
:
item
.
get_html
(),
'js_module'
:
item
.
js_module_name
(),
'js_module'
:
item
.
js_module_name
(),
...
@@ -100,17 +101,18 @@ def user_author_string(user):
...
@@ -100,17 +101,18 @@ def user_author_string(user):
@login_required
@login_required
@expect_json
@expect_json
def
save_item
(
request
):
def
save_item
(
request
):
item_
id
=
request
.
POST
[
'id'
]
item_
location
=
request
.
POST
[
'id'
]
if
not
has_access
(
request
.
user
,
item_
id
):
if
not
has_access
(
request
.
user
,
item_
location
):
raise
Http404
# TODO (vshnayder): better error
raise
Http404
# TODO (vshnayder): better error
data
=
json
.
loads
(
request
.
POST
[
'data'
])
data
=
json
.
loads
(
request
.
POST
[
'data'
])
modulestore
()
.
update_item
(
item_
id
,
data
)
modulestore
()
.
update_item
(
item_
location
,
data
)
# Export the course back to github
# Export the course back to github
# This uses wildcarding to find the course, which requires handling
# This uses wildcarding to find the course, which requires handling
# multiple courses returned, but there should only ever be one
# multiple courses returned, but there should only ever be one
course_location
=
Location
(
item_id
)
.
_replace
(
category
=
'course'
,
name
=
None
)
course_location
=
Location
(
item_location
)
.
_replace
(
category
=
'course'
,
name
=
None
)
courses
=
modulestore
()
.
get_items
(
course_location
,
depth
=
None
)
courses
=
modulestore
()
.
get_items
(
course_location
,
depth
=
None
)
for
course
in
courses
:
for
course
in
courses
:
author_string
=
user_author_string
(
request
.
user
)
author_string
=
user_author_string
(
request
.
user
)
...
...
rakefile
View file @
247fa6ca
...
@@ -88,7 +88,7 @@ end
...
@@ -88,7 +88,7 @@ end
# Per System tasks
# Per System tasks
desc
"Run all django tests on our djangoapps for the
#{
system
}
"
desc
"Run all django tests on our djangoapps for the
#{
system
}
"
task
"test_
#{
system
}
"
=>
[
"
#{
system
}
:collectstatic:test"
,
"fasttest_
#{
system
}
"
]
task
"test_
#{
system
}
"
=>
[
"
#{
system
}
:collectstatic:test"
,
"fasttest_
#{
system
}
"
]
# Have a way to run the tests without running collectstatic -- useful when debugging without
# Have a way to run the tests without running collectstatic -- useful when debugging without
# messing with static files.
# messing with static files.
...
...
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