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
1c2b6e80
Commit
1c2b6e80
authored
Aug 15, 2012
by
David Ormsbee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove stuff that I should have deleted during the rebase
parent
f535f44e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
53 deletions
+0
-53
lms/djangoapps/courseware/courses.py
+0
-53
No files found.
lms/djangoapps/courseware/courses.py
View file @
1c2b6e80
...
...
@@ -142,59 +142,6 @@ def get_course_info_section(course, section_key):
raise
KeyError
(
"Invalid about key "
+
str
(
section_key
))
def
course_staff_group_name
(
course
):
'''
course should be either a CourseDescriptor instance, or a string (the
.course entry of a Location)
'''
if
isinstance
(
course
,
str
)
or
isinstance
(
course
,
unicode
):
coursename
=
course
else
:
# should be a CourseDescriptor, so grab its location.course:
coursename
=
course
.
location
.
course
return
'staff_
%
s'
%
coursename
def
has_staff_access_to_course
(
user
,
course
):
'''
Returns True if the given user has staff access to the course.
This means that user is in the staff_* group, or is an overall admin.
TODO (vshnayder): this needs to be changed to allow per-course_id permissions, not per-course
(e.g. staff in 2012 is different from 2013, but maybe some people always have access)
course is the course field of the location being accessed.
'''
if
user
is
None
or
(
not
user
.
is_authenticated
())
or
course
is
None
:
return
False
if
user
.
is_staff
:
return
True
# note this is the Auth group, not UserTestGroup
user_groups
=
[
x
[
1
]
for
x
in
user
.
groups
.
values_list
()]
staff_group
=
course_staff_group_name
(
course
)
if
staff_group
in
user_groups
:
return
True
return
False
def
has_staff_access_to_course_id
(
user
,
course_id
):
"""Helper method that takes a course_id instead of a course name"""
loc
=
CourseDescriptor
.
id_to_location
(
course_id
)
return
has_staff_access_to_course
(
user
,
loc
.
course
)
def
has_staff_access_to_location
(
user
,
location
):
"""Helper method that checks whether the user has staff access to
the course of the location.
location: something that can be passed to Location
"""
return
has_staff_access_to_course
(
user
,
Location
(
location
)
.
course
)
def
has_access_to_course
(
user
,
course
):
'''course is the .course element of a location'''
if
course
.
metadata
.
get
(
'ispublic'
):
return
True
return
has_staff_access_to_course
(
user
,
course
)
def
get_courses_by_university
(
user
,
domain
=
None
):
'''
...
...
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