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
7c0d9ff1
Commit
7c0d9ff1
authored
Feb 27, 2013
by
John Jarvis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Creating group for organization staff access
parent
1ed27209
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
1 deletions
+23
-1
lms/djangoapps/courseware/access.py
+23
-1
No files found.
lms/djangoapps/courseware/access.py
View file @
7c0d9ff1
...
...
@@ -341,6 +341,26 @@ def _dispatch(table, action, user, obj):
def
_does_course_group_name_exist
(
name
):
return
len
(
Group
.
objects
.
filter
(
name
=
name
))
>
0
def
_course_org_staff_group_name
(
location
,
course_context
=
None
):
"""
Get the name of the staff group for an organization which corresponds
to the organization in the course id.
location: something that can passed to Location
course_context: A course_id that specifies the course run in which
the location occurs.
Required if location doesn't have category 'course'
"""
loc
=
Location
(
location
)
if
loc
.
category
==
'course'
:
course_id
=
loc
.
course_id
else
:
if
course_context
is
None
:
raise
CourseContextRequired
()
course_id
=
course_context
return
'staff_
%
s'
%
course_id
.
split
(
'/'
)[
0
]
def
_course_staff_group_name
(
location
,
course_context
=
None
):
"""
...
...
@@ -499,7 +519,9 @@ def _has_access_to_location(user, location, access_level, course_context):
if
access_level
==
'staff'
:
staff_group
=
_course_staff_group_name
(
location
,
course_context
)
if
staff_group
in
user_groups
:
# org_staff_group is a group for an entire organization
org_staff_group
=
_course_org_staff_group_name
(
location
,
course_context
)
if
staff_group
in
user_groups
or
org_staff_group
in
user_groups
:
debug
(
"Allow: user in group
%
s"
,
staff_group
)
return
True
debug
(
"Deny: user not in group
%
s"
,
staff_group
)
...
...
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