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
7c6b9eba
Commit
7c6b9eba
authored
Aug 15, 2012
by
Victor Shnayder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Note that 'load' access does not check for enrollment
parent
9425bbba
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
4 deletions
+12
-4
lms/djangoapps/courseware/access.py
+12
-4
No files found.
lms/djangoapps/courseware/access.py
View file @
7c6b9eba
...
...
@@ -68,6 +68,7 @@ def has_access(user, obj, action):
raise
TypeError
(
"Unknown object type in has_access(): '{}'"
.
format
(
type
(
obj
)))
# ================ Implementation helpers ================================
def
_has_access_course_desc
(
user
,
course
,
action
):
...
...
@@ -83,8 +84,11 @@ def _has_access_course_desc(user, course, action):
'staff' -- staff access to course.
"""
def
can_load
():
"Can this user load this course?"
# delegate to generic descriptor check
"Can this user load this course?
NOTE: this is not checking whether user is actually enrolled in the course.
"
# delegate to generic descriptor check to check start dates
return
_has_access_descriptor
(
user
,
course
,
action
)
def
can_enroll
():
...
...
@@ -169,6 +173,12 @@ def _has_access_descriptor(user, descriptor, action):
has_access(), it will not do the right thing.
"""
def
can_load
():
"""
NOTE: This does not check that the student is enrolled in the course
that contains this module. We may or may not want to allow non-enrolled
students to see modules. If not, views should check the course, so we
don't have to hit the enrollments table on every module load.
"""
# If start dates are off, can always load
if
settings
.
MITX_FEATURES
[
'DISABLE_START_DATES'
]:
debug
(
"Allow: DISABLE_START_DATES"
)
...
...
@@ -196,8 +206,6 @@ def _has_access_descriptor(user, descriptor, action):
return
_dispatch
(
checkers
,
action
,
user
,
descriptor
)
def
_has_access_xmodule
(
user
,
xmodule
,
action
):
"""
Check if user has access to this xmodule.
...
...
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