Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
course-discovery
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
course-discovery
Commits
b3652029
Commit
b3652029
authored
Feb 23, 2017
by
Waheed Ahmed
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed Partner Coordinator to Project Coordinator.
ECOM-7236
parent
f38572c6
Show whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
184 additions
and
73 deletions
+184
-73
course_discovery/apps/publisher/api/tests/test_views.py
+4
-4
course_discovery/apps/publisher/choices.py
+2
-1
course_discovery/apps/publisher/constants.py
+4
-1
course_discovery/apps/publisher/emails.py
+15
-15
course_discovery/apps/publisher/migrations/0038_auto_20170223_0723.py
+75
-0
course_discovery/apps/publisher/migrations/0039_rename_partner_coordinator_group.py
+32
-0
course_discovery/apps/publisher/models.py
+2
-2
course_discovery/apps/publisher/tests/test_emails.py
+5
-5
course_discovery/apps/publisher/tests/test_model.py
+9
-9
course_discovery/apps/publisher/tests/test_utils.py
+8
-8
course_discovery/apps/publisher/tests/test_views.py
+8
-8
course_discovery/apps/publisher/utils.py
+4
-4
course_discovery/apps/publisher/views.py
+5
-5
course_discovery/apps/publisher_comments/tests/test_emails.py
+4
-4
course_discovery/templates/publisher/courses.html
+2
-2
course_discovery/templates/publisher/email/course_created.html
+2
-2
course_discovery/templates/publisher/email/course_created.txt
+1
-1
course_discovery/templates/publisher/email/studio_instance_created.html
+1
-1
course_discovery/templates/publisher/email/studio_instance_created.txt
+1
-1
No files found.
course_discovery/apps/publisher/api/tests/test_views.py
View file @
b3652029
...
@@ -130,7 +130,7 @@ class CourseRoleAssignmentViewTests(TestCase):
...
@@ -130,7 +130,7 @@ class CourseRoleAssignmentViewTests(TestCase):
@ddt.data
(
@ddt.data
(
PublisherUserRole
.
PartnerManager
,
PublisherUserRole
.
PartnerManager
,
PublisherUserRole
.
P
artner
Coordinator
,
PublisherUserRole
.
P
roject
Coordinator
,
PublisherUserRole
.
MarketingReviewer
,
PublisherUserRole
.
MarketingReviewer
,
PublisherUserRole
.
Publisher
PublisherUserRole
.
Publisher
)
)
...
@@ -221,7 +221,7 @@ class UpdateCourseKeyViewTests(TestCase):
...
@@ -221,7 +221,7 @@ class UpdateCourseKeyViewTests(TestCase):
)
)
factories
.
CourseUserRoleFactory
(
factories
.
CourseUserRoleFactory
(
role
=
PublisherUserRole
.
P
artner
Coordinator
,
role
=
PublisherUserRole
.
P
roject
Coordinator
,
course
=
self
.
course_run
.
course
,
course
=
self
.
course_run
.
course
,
user
=
self
.
user
user
=
self
.
user
)
)
...
@@ -651,7 +651,7 @@ class ChangeCourseRunStateViewTests(TestCase):
...
@@ -651,7 +651,7 @@ class ChangeCourseRunStateViewTests(TestCase):
self
.
run_state
.
save
()
self
.
run_state
.
save
()
self
.
_assign_role
(
course
,
PublisherUserRole
.
CourseTeam
,
self
.
user
)
self
.
_assign_role
(
course
,
PublisherUserRole
.
CourseTeam
,
self
.
user
)
self
.
_assign_role
(
course
,
PublisherUserRole
.
P
artner
Coordinator
,
UserFactory
())
self
.
_assign_role
(
course
,
PublisherUserRole
.
P
roject
Coordinator
,
UserFactory
())
self
.
_assign_role
(
course
,
PublisherUserRole
.
Publisher
,
UserFactory
())
self
.
_assign_role
(
course
,
PublisherUserRole
.
Publisher
,
UserFactory
())
...
@@ -671,4 +671,4 @@ class ChangeCourseRunStateViewTests(TestCase):
...
@@ -671,4 +671,4 @@ class ChangeCourseRunStateViewTests(TestCase):
self
.
assertEqual
(
self
.
run_state
.
owner_role
,
PublisherUserRole
.
Publisher
)
self
.
assertEqual
(
self
.
run_state
.
owner_role
,
PublisherUserRole
.
Publisher
)
self
.
assertEqual
(
len
(
mail
.
outbox
),
1
)
self
.
assertEqual
(
len
(
mail
.
outbox
),
1
)
self
.
assertEqual
([
course
.
publisher
.
email
,
course
.
p
artner
_coordinator
.
email
],
mail
.
outbox
[
0
]
.
bcc
)
self
.
assertEqual
([
course
.
publisher
.
email
,
course
.
p
roject
_coordinator
.
email
],
mail
.
outbox
[
0
]
.
bcc
)
course_discovery/apps/publisher/choices.py
View file @
b3652029
...
@@ -4,7 +4,8 @@ from djchoices import ChoiceItem, DjangoChoices
...
@@ -4,7 +4,8 @@ from djchoices import ChoiceItem, DjangoChoices
class
PublisherUserRole
(
DjangoChoices
):
class
PublisherUserRole
(
DjangoChoices
):
PartnerManager
=
ChoiceItem
(
'partner_manager'
,
_
(
'Partner Manager'
))
PartnerManager
=
ChoiceItem
(
'partner_manager'
,
_
(
'Partner Manager'
))
PartnerCoordinator
=
ChoiceItem
(
'partner_coordinator'
,
_
(
'Partner Coordinator'
))
# TODO: ECOM-7289 - Change choice value to `project_coordinator` and create a data migration.
ProjectCoordinator
=
ChoiceItem
(
'partner_coordinator'
,
_
(
'Project Coordinator'
))
MarketingReviewer
=
ChoiceItem
(
'marketing_reviewer'
,
_
(
'Marketing Reviewer'
))
MarketingReviewer
=
ChoiceItem
(
'marketing_reviewer'
,
_
(
'Marketing Reviewer'
))
Publisher
=
ChoiceItem
(
'publisher'
,
_
(
'Publisher'
))
Publisher
=
ChoiceItem
(
'publisher'
,
_
(
'Publisher'
))
CourseTeam
=
ChoiceItem
(
'course_team'
,
_
(
'Course Team'
))
CourseTeam
=
ChoiceItem
(
'course_team'
,
_
(
'Course Team'
))
...
...
course_discovery/apps/publisher/constants.py
View file @
b3652029
...
@@ -2,6 +2,9 @@
...
@@ -2,6 +2,9 @@
ADMIN_GROUP_NAME
=
'Publisher Admins'
ADMIN_GROUP_NAME
=
'Publisher Admins'
INTERNAL_USER_GROUP_NAME
=
'Internal Users'
INTERNAL_USER_GROUP_NAME
=
'Internal Users'
PARTNER_MANAGER_GROUP_NAME
=
'Partner Managers'
PARTNER_MANAGER_GROUP_NAME
=
'Partner Managers'
P
ARTNER_COORDINATOR_GROUP_NAME
=
'Partner
Coordinators'
P
ROJECT_COORDINATOR_GROUP_NAME
=
'Project
Coordinators'
REVIEWER_GROUP_NAME
=
'Marketing Reviewers'
REVIEWER_GROUP_NAME
=
'Marketing Reviewers'
PUBLISHER_GROUP_NAME
=
'Publishers'
PUBLISHER_GROUP_NAME
=
'Publishers'
# Being used in old migration `0019_create_user_groups`.
PARTNER_COORDINATOR_GROUP_NAME
=
'Partner Coordinators'
course_discovery/apps/publisher/emails.py
View file @
b3652029
...
@@ -69,7 +69,7 @@ def send_email_for_studio_instance_created(course_run, updated_text=_('created')
...
@@ -69,7 +69,7 @@ def send_email_for_studio_instance_created(course_run, updated_text=_('created')
course_user_roles
=
course_run
.
course
.
course_user_roles
.
all
()
course_user_roles
=
course_run
.
course
.
course_user_roles
.
all
()
course_team
=
course_user_roles
.
filter
(
role
=
PublisherUserRole
.
CourseTeam
)
.
first
()
course_team
=
course_user_roles
.
filter
(
role
=
PublisherUserRole
.
CourseTeam
)
.
first
()
p
artner_coordinator
=
course_user_roles
.
filter
(
role
=
PublisherUserRole
.
Partner
Coordinator
)
.
first
()
p
roject_coordinator
=
course_user_roles
.
filter
(
role
=
PublisherUserRole
.
Project
Coordinator
)
.
first
()
context
=
{
context
=
{
'updated_text'
:
updated_text
,
'updated_text'
:
updated_text
,
...
@@ -80,8 +80,8 @@ def send_email_for_studio_instance_created(course_run, updated_text=_('created')
...
@@ -80,8 +80,8 @@ def send_email_for_studio_instance_created(course_run, updated_text=_('created')
'course_name'
:
course_run
.
course
.
title
,
'course_name'
:
course_run
.
course
.
title
,
'from_address'
:
from_address
,
'from_address'
:
from_address
,
'course_team_name'
:
course_team
.
user
.
full_name
if
course_team
else
''
,
'course_team_name'
:
course_team
.
user
.
full_name
if
course_team
else
''
,
'p
artner_coordinator_name'
:
partner_coordinator
.
user
.
full_name
if
partner
_coordinator
else
''
,
'p
roject_coordinator_name'
:
project_coordinator
.
user
.
full_name
if
project
_coordinator
else
''
,
'contact_us_email'
:
p
artner_coordinator
.
user
.
email
if
partner
_coordinator
else
''
'contact_us_email'
:
p
roject_coordinator
.
user
.
email
if
project
_coordinator
else
''
}
}
txt_template_path
=
'publisher/email/studio_instance_created.txt'
txt_template_path
=
'publisher/email/studio_instance_created.txt'
...
@@ -116,19 +116,19 @@ def send_email_for_course_creation(course, course_run):
...
@@ -116,19 +116,19 @@ def send_email_for_course_creation(course, course_run):
course_user_roles
=
course_run
.
course
.
course_user_roles
.
all
()
course_user_roles
=
course_run
.
course
.
course_user_roles
.
all
()
course_team
=
course_user_roles
.
filter
(
role
=
PublisherUserRole
.
CourseTeam
)
.
first
()
course_team
=
course_user_roles
.
filter
(
role
=
PublisherUserRole
.
CourseTeam
)
.
first
()
p
artner_coordinator
=
course_user_roles
.
filter
(
role
=
PublisherUserRole
.
Partner
Coordinator
)
.
first
()
p
roject_coordinator
=
course_user_roles
.
filter
(
role
=
PublisherUserRole
.
Project
Coordinator
)
.
first
()
context
=
{
context
=
{
'course_title'
:
course_run
.
course
.
title
,
'course_title'
:
course_run
.
course
.
title
,
'date'
:
course_run
.
created
.
strftime
(
"
%
B
%
d,
%
Y"
),
'date'
:
course_run
.
created
.
strftime
(
"
%
B
%
d,
%
Y"
),
'time'
:
course_run
.
created
.
strftime
(
"
%
H:
%
M:
%
S"
),
'time'
:
course_run
.
created
.
strftime
(
"
%
H:
%
M:
%
S"
),
'course_team_name'
:
course_team
.
user
.
full_name
if
course_team
else
''
,
'course_team_name'
:
course_team
.
user
.
full_name
if
course_team
else
''
,
'p
artner_coordinator_name'
:
partner_coordinator
.
user
.
full_name
if
partner
_coordinator
else
''
,
'p
roject_coordinator_name'
:
project_coordinator
.
user
.
full_name
if
project
_coordinator
else
''
,
'dashboard_url'
:
'https://{host}{path}'
.
format
(
'dashboard_url'
:
'https://{host}{path}'
.
format
(
host
=
Site
.
objects
.
get_current
()
.
domain
.
strip
(
'/'
),
path
=
reverse
(
'publisher:publisher_dashboard'
)
host
=
Site
.
objects
.
get_current
()
.
domain
.
strip
(
'/'
),
path
=
reverse
(
'publisher:publisher_dashboard'
)
),
),
'from_address'
:
from_address
,
'from_address'
:
from_address
,
'contact_us_email'
:
p
artner_coordinator
.
user
.
email
if
partner
_coordinator
else
''
'contact_us_email'
:
p
roject_coordinator
.
user
.
email
if
project
_coordinator
else
''
}
}
template
=
get_template
(
txt_template
)
template
=
get_template
(
txt_template
)
...
@@ -203,14 +203,14 @@ def send_course_workflow_email(course, user, subject, txt_template, html_templat
...
@@ -203,14 +203,14 @@ def send_course_workflow_email(course, user, subject, txt_template, html_templat
recipient_user
=
course
.
course_team_admin
recipient_user
=
course
.
course_team_admin
if
is_email_notification_enabled
(
recipient_user
):
if
is_email_notification_enabled
(
recipient_user
):
p
artner_coordinator
=
course
.
partner
_coordinator
p
roject_coordinator
=
course
.
project
_coordinator
to_addresses
=
[
recipient_user
.
email
]
to_addresses
=
[
recipient_user
.
email
]
from_address
=
settings
.
PUBLISHER_FROM_EMAIL
from_address
=
settings
.
PUBLISHER_FROM_EMAIL
context
=
{
context
=
{
'recipient_name'
:
recipient_user
.
full_name
or
recipient_user
.
username
if
recipient_user
else
''
,
'recipient_name'
:
recipient_user
.
full_name
or
recipient_user
.
username
if
recipient_user
else
''
,
'sender_name'
:
user
.
full_name
or
user
.
username
,
'sender_name'
:
user
.
full_name
or
user
.
username
,
'course_name'
:
course_name
if
course_name
else
course
.
title
,
'course_name'
:
course_name
if
course_name
else
course
.
title
,
'contact_us_email'
:
p
artner_coordinator
.
email
if
partner
_coordinator
else
''
,
'contact_us_email'
:
p
roject_coordinator
.
email
if
project
_coordinator
else
''
,
'page_url'
:
'https://{host}{path}'
.
format
(
'page_url'
:
'https://{host}{path}'
.
format
(
host
=
Site
.
objects
.
get_current
()
.
domain
.
strip
(
'/'
),
path
=
page_path
host
=
Site
.
objects
.
get_current
()
.
domain
.
strip
(
'/'
),
path
=
page_path
)
)
...
@@ -295,7 +295,7 @@ def send_email_to_publisher(course_run, user):
...
@@ -295,7 +295,7 @@ def send_email_to_publisher(course_run, user):
try
:
try
:
if
is_email_notification_enabled
(
recipient_user
):
if
is_email_notification_enabled
(
recipient_user
):
p
artner_coordinator
=
course_run
.
course
.
partner
_coordinator
p
roject_coordinator
=
course_run
.
course
.
project
_coordinator
to_addresses
=
[
recipient_user
.
email
]
to_addresses
=
[
recipient_user
.
email
]
from_address
=
settings
.
PUBLISHER_FROM_EMAIL
from_address
=
settings
.
PUBLISHER_FROM_EMAIL
page_path
=
reverse
(
'publisher:publisher_course_run_detail'
,
kwargs
=
{
'pk'
:
course_run
.
id
})
page_path
=
reverse
(
'publisher:publisher_course_run_detail'
,
kwargs
=
{
'pk'
:
course_run
.
id
})
...
@@ -303,7 +303,7 @@ def send_email_to_publisher(course_run, user):
...
@@ -303,7 +303,7 @@ def send_email_to_publisher(course_run, user):
'recipient_name'
:
recipient_user
.
full_name
or
recipient_user
.
username
if
recipient_user
else
''
,
'recipient_name'
:
recipient_user
.
full_name
or
recipient_user
.
username
if
recipient_user
else
''
,
'sender_name'
:
user
.
full_name
or
user
.
username
,
'sender_name'
:
user
.
full_name
or
user
.
username
,
'course_name'
:
run_name
,
'course_name'
:
run_name
,
'contact_us_email'
:
p
artner_coordinator
.
email
if
partner
_coordinator
else
''
,
'contact_us_email'
:
p
roject_coordinator
.
email
if
project
_coordinator
else
''
,
'page_url'
:
'https://{host}{path}'
.
format
(
'page_url'
:
'https://{host}{path}'
.
format
(
host
=
Site
.
objects
.
get_current
()
.
domain
.
strip
(
'/'
),
path
=
page_path
host
=
Site
.
objects
.
get_current
()
.
domain
.
strip
(
'/'
),
path
=
page_path
)
)
...
@@ -323,7 +323,7 @@ def send_email_to_publisher(course_run, user):
...
@@ -323,7 +323,7 @@ def send_email_to_publisher(course_run, user):
def
send_email_preview_accepted
(
course_run
):
def
send_email_preview_accepted
(
course_run
):
""" Send email for preview approved to publisher and p
artner
coordinator.
""" Send email for preview approved to publisher and p
roject
coordinator.
Arguments:
Arguments:
course_run (Object): CourseRun object
course_run (Object): CourseRun object
...
@@ -340,15 +340,15 @@ def send_email_preview_accepted(course_run):
...
@@ -340,15 +340,15 @@ def send_email_preview_accepted(course_run):
try
:
try
:
if
is_email_notification_enabled
(
publisher_user
):
if
is_email_notification_enabled
(
publisher_user
):
p
artner_coordinator
=
course_run
.
course
.
partner
_coordinator
p
roject_coordinator
=
course_run
.
course
.
project
_coordinator
to_addresses
=
[
publisher_user
.
email
]
to_addresses
=
[
publisher_user
.
email
]
if
is_email_notification_enabled
(
p
artner
_coordinator
):
if
is_email_notification_enabled
(
p
roject
_coordinator
):
to_addresses
.
append
(
p
artner
_coordinator
.
email
)
to_addresses
.
append
(
p
roject
_coordinator
.
email
)
from_address
=
settings
.
PUBLISHER_FROM_EMAIL
from_address
=
settings
.
PUBLISHER_FROM_EMAIL
page_path
=
reverse
(
'publisher:publisher_course_run_detail'
,
kwargs
=
{
'pk'
:
course_run
.
id
})
page_path
=
reverse
(
'publisher:publisher_course_run_detail'
,
kwargs
=
{
'pk'
:
course_run
.
id
})
context
=
{
context
=
{
'course_name'
:
run_name
,
'course_name'
:
run_name
,
'contact_us_email'
:
p
artner_coordinator
.
email
if
partner
_coordinator
else
''
,
'contact_us_email'
:
p
roject_coordinator
.
email
if
project
_coordinator
else
''
,
'page_url'
:
'https://{host}{path}'
.
format
(
'page_url'
:
'https://{host}{path}'
.
format
(
host
=
Site
.
objects
.
get_current
()
.
domain
.
strip
(
'/'
),
path
=
page_path
host
=
Site
.
objects
.
get_current
()
.
domain
.
strip
(
'/'
),
path
=
page_path
)
)
...
...
course_discovery/apps/publisher/migrations/0038_auto_20170223_0723.py
0 → 100644
View file @
b3652029
# -*- coding: utf-8 -*-
# Generated by Django 1.9.12 on 2017-02-23 07:23
from
__future__
import
unicode_literals
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'publisher'
,
'0037_auto_20170221_1150'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'courserunstate'
,
name
=
'approved_by_role'
,
field
=
models
.
CharField
(
blank
=
True
,
choices
=
[(
'partner_manager'
,
'Partner Manager'
),
(
'partner_coordinator'
,
'Project Coordinator'
),
(
'marketing_reviewer'
,
'Marketing Reviewer'
),
(
'publisher'
,
'Publisher'
),
(
'course_team'
,
'Course Team'
)],
max_length
=
63
,
null
=
True
),
),
migrations
.
AlterField
(
model_name
=
'courserunstate'
,
name
=
'owner_role'
,
field
=
models
.
CharField
(
choices
=
[(
'partner_manager'
,
'Partner Manager'
),
(
'partner_coordinator'
,
'Project Coordinator'
),
(
'marketing_reviewer'
,
'Marketing Reviewer'
),
(
'publisher'
,
'Publisher'
),
(
'course_team'
,
'Course Team'
)],
max_length
=
63
),
),
migrations
.
AlterField
(
model_name
=
'coursestate'
,
name
=
'approved_by_role'
,
field
=
models
.
CharField
(
blank
=
True
,
choices
=
[(
'partner_manager'
,
'Partner Manager'
),
(
'partner_coordinator'
,
'Project Coordinator'
),
(
'marketing_reviewer'
,
'Marketing Reviewer'
),
(
'publisher'
,
'Publisher'
),
(
'course_team'
,
'Course Team'
)],
max_length
=
63
,
null
=
True
),
),
migrations
.
AlterField
(
model_name
=
'coursestate'
,
name
=
'owner_role'
,
field
=
models
.
CharField
(
choices
=
[(
'partner_manager'
,
'Partner Manager'
),
(
'partner_coordinator'
,
'Project Coordinator'
),
(
'marketing_reviewer'
,
'Marketing Reviewer'
),
(
'publisher'
,
'Publisher'
),
(
'course_team'
,
'Course Team'
)],
max_length
=
63
),
),
migrations
.
AlterField
(
model_name
=
'courseuserrole'
,
name
=
'role'
,
field
=
models
.
CharField
(
choices
=
[(
'partner_manager'
,
'Partner Manager'
),
(
'partner_coordinator'
,
'Project Coordinator'
),
(
'marketing_reviewer'
,
'Marketing Reviewer'
),
(
'publisher'
,
'Publisher'
),
(
'course_team'
,
'Course Team'
)],
max_length
=
63
,
verbose_name
=
'Course Role'
),
),
migrations
.
AlterField
(
model_name
=
'historicalcourserunstate'
,
name
=
'approved_by_role'
,
field
=
models
.
CharField
(
blank
=
True
,
choices
=
[(
'partner_manager'
,
'Partner Manager'
),
(
'partner_coordinator'
,
'Project Coordinator'
),
(
'marketing_reviewer'
,
'Marketing Reviewer'
),
(
'publisher'
,
'Publisher'
),
(
'course_team'
,
'Course Team'
)],
max_length
=
63
,
null
=
True
),
),
migrations
.
AlterField
(
model_name
=
'historicalcourserunstate'
,
name
=
'owner_role'
,
field
=
models
.
CharField
(
choices
=
[(
'partner_manager'
,
'Partner Manager'
),
(
'partner_coordinator'
,
'Project Coordinator'
),
(
'marketing_reviewer'
,
'Marketing Reviewer'
),
(
'publisher'
,
'Publisher'
),
(
'course_team'
,
'Course Team'
)],
max_length
=
63
),
),
migrations
.
AlterField
(
model_name
=
'historicalcoursestate'
,
name
=
'approved_by_role'
,
field
=
models
.
CharField
(
blank
=
True
,
choices
=
[(
'partner_manager'
,
'Partner Manager'
),
(
'partner_coordinator'
,
'Project Coordinator'
),
(
'marketing_reviewer'
,
'Marketing Reviewer'
),
(
'publisher'
,
'Publisher'
),
(
'course_team'
,
'Course Team'
)],
max_length
=
63
,
null
=
True
),
),
migrations
.
AlterField
(
model_name
=
'historicalcoursestate'
,
name
=
'owner_role'
,
field
=
models
.
CharField
(
choices
=
[(
'partner_manager'
,
'Partner Manager'
),
(
'partner_coordinator'
,
'Project Coordinator'
),
(
'marketing_reviewer'
,
'Marketing Reviewer'
),
(
'publisher'
,
'Publisher'
),
(
'course_team'
,
'Course Team'
)],
max_length
=
63
),
),
migrations
.
AlterField
(
model_name
=
'historicalcourseuserrole'
,
name
=
'role'
,
field
=
models
.
CharField
(
choices
=
[(
'partner_manager'
,
'Partner Manager'
),
(
'partner_coordinator'
,
'Project Coordinator'
),
(
'marketing_reviewer'
,
'Marketing Reviewer'
),
(
'publisher'
,
'Publisher'
),
(
'course_team'
,
'Course Team'
)],
max_length
=
63
,
verbose_name
=
'Course Role'
),
),
migrations
.
AlterField
(
model_name
=
'historicalorganizationuserrole'
,
name
=
'role'
,
field
=
models
.
CharField
(
choices
=
[(
'partner_manager'
,
'Partner Manager'
),
(
'partner_coordinator'
,
'Project Coordinator'
),
(
'marketing_reviewer'
,
'Marketing Reviewer'
),
(
'publisher'
,
'Publisher'
),
(
'course_team'
,
'Course Team'
)],
max_length
=
63
,
verbose_name
=
'Organization Role'
),
),
migrations
.
AlterField
(
model_name
=
'organizationuserrole'
,
name
=
'role'
,
field
=
models
.
CharField
(
choices
=
[(
'partner_manager'
,
'Partner Manager'
),
(
'partner_coordinator'
,
'Project Coordinator'
),
(
'marketing_reviewer'
,
'Marketing Reviewer'
),
(
'publisher'
,
'Publisher'
),
(
'course_team'
,
'Course Team'
)],
max_length
=
63
,
verbose_name
=
'Organization Role'
),
),
]
course_discovery/apps/publisher/migrations/0039_rename_partner_coordinator_group.py
0 → 100644
View file @
b3652029
# -*- coding: utf-8 -*-
from
__future__
import
unicode_literals
from
django.db
import
migrations
from
course_discovery.apps.publisher.constants
import
PARTNER_COORDINATOR_GROUP_NAME
,
PROJECT_COORDINATOR_GROUP_NAME
def
rename_group_to_project_coordinator
(
apps
,
schema_editor
):
Group
=
apps
.
get_model
(
'auth'
,
'Group'
)
pc_group
=
Group
.
objects
.
get
(
name
=
PARTNER_COORDINATOR_GROUP_NAME
)
pc_group
.
name
=
PROJECT_COORDINATOR_GROUP_NAME
pc_group
.
save
()
def
rename_group_to_partner_coordinator
(
apps
,
schema_editor
):
Group
=
apps
.
get_model
(
'auth'
,
'Group'
)
pc_group
=
Group
.
objects
.
get
(
name
=
PROJECT_COORDINATOR_GROUP_NAME
)
pc_group
.
name
=
PARTNER_COORDINATOR_GROUP_NAME
pc_group
.
save
()
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'publisher'
,
'0038_auto_20170223_0723'
),
]
operations
=
[
migrations
.
RunPython
(
rename_group_to_project_coordinator
,
rename_group_to_partner_coordinator
)
]
course_discovery/apps/publisher/models.py
View file @
b3652029
...
@@ -171,9 +171,9 @@ class Course(TimeStampedModel, ChangedByMixin):
...
@@ -171,9 +171,9 @@ class Course(TimeStampedModel, ChangedByMixin):
return
None
return
None
@property
@property
def
p
artner
_coordinator
(
self
):
def
p
roject
_coordinator
(
self
):
try
:
try
:
return
self
.
course_user_roles
.
get
(
role
=
PublisherUserRole
.
P
artner
Coordinator
)
.
user
return
self
.
course_user_roles
.
get
(
role
=
PublisherUserRole
.
P
roject
Coordinator
)
.
user
except
CourseUserRole
.
DoesNotExist
:
except
CourseUserRole
.
DoesNotExist
:
return
None
return
None
...
...
course_discovery/apps/publisher/tests/test_emails.py
View file @
b3652029
...
@@ -45,7 +45,7 @@ class StateChangeEmailTests(TestCase):
...
@@ -45,7 +45,7 @@ class StateChangeEmailTests(TestCase):
# add user in course-user-role table
# add user in course-user-role table
factories
.
CourseUserRoleFactory
(
factories
.
CourseUserRoleFactory
(
course
=
cls
.
course
,
role
=
PublisherUserRole
.
P
artner
Coordinator
,
user
=
cls
.
user
course
=
cls
.
course
,
role
=
PublisherUserRole
.
P
roject
Coordinator
,
user
=
cls
.
user
)
)
factories
.
CourseUserRoleFactory
(
factories
.
CourseUserRoleFactory
(
course
=
cls
.
course
,
role
=
PublisherUserRole
.
MarketingReviewer
,
user
=
cls
.
user_2
course
=
cls
.
course
,
role
=
PublisherUserRole
.
MarketingReviewer
,
user
=
cls
.
user_2
...
@@ -144,7 +144,7 @@ class StudioInstanceCreatedEmailTests(TestCase):
...
@@ -144,7 +144,7 @@ class StudioInstanceCreatedEmailTests(TestCase):
# add user in course-user-role table
# add user in course-user-role table
factories
.
CourseUserRoleFactory
(
factories
.
CourseUserRoleFactory
(
course
=
self
.
course_run
.
course
,
role
=
PublisherUserRole
.
P
artner
Coordinator
,
user
=
self
.
user
course
=
self
.
course_run
.
course
,
role
=
PublisherUserRole
.
P
roject
Coordinator
,
user
=
self
.
user
)
)
self
.
course_team
=
UserFactory
()
self
.
course_team
=
UserFactory
()
...
@@ -212,7 +212,7 @@ class CourseCreatedEmailTests(TestCase):
...
@@ -212,7 +212,7 @@ class CourseCreatedEmailTests(TestCase):
# add user in course-user-role table
# add user in course-user-role table
factories
.
CourseUserRoleFactory
(
factories
.
CourseUserRoleFactory
(
course
=
self
.
course_run
.
course
,
role
=
PublisherUserRole
.
P
artner
Coordinator
,
user
=
self
.
user
course
=
self
.
course_run
.
course
,
role
=
PublisherUserRole
.
P
roject
Coordinator
,
user
=
self
.
user
)
)
self
.
course_team
=
UserFactory
()
self
.
course_team
=
UserFactory
()
...
@@ -493,7 +493,7 @@ class CourseRunPreviewEmailTests(TestCase):
...
@@ -493,7 +493,7 @@ class CourseRunPreviewEmailTests(TestCase):
course
=
self
.
course
,
role
=
PublisherUserRole
.
Publisher
,
user
=
UserFactory
()
course
=
self
.
course
,
role
=
PublisherUserRole
.
Publisher
,
user
=
UserFactory
()
)
)
factories
.
CourseUserRoleFactory
(
factories
.
CourseUserRoleFactory
(
course
=
self
.
course
,
role
=
PublisherUserRole
.
P
artner
Coordinator
,
user
=
UserFactory
()
course
=
self
.
course
,
role
=
PublisherUserRole
.
P
roject
Coordinator
,
user
=
UserFactory
()
)
)
toggle_switch
(
'enable_publisher_email_notifications'
,
True
)
toggle_switch
(
'enable_publisher_email_notifications'
,
True
)
...
@@ -511,7 +511,7 @@ class CourseRunPreviewEmailTests(TestCase):
...
@@ -511,7 +511,7 @@ class CourseRunPreviewEmailTests(TestCase):
run_name
=
run_name
run_name
=
run_name
)
)
self
.
assertEqual
(
len
(
mail
.
outbox
),
1
)
self
.
assertEqual
(
len
(
mail
.
outbox
),
1
)
self
.
assertEqual
([
self
.
course
.
publisher
.
email
,
self
.
course
.
p
artner
_coordinator
.
email
],
mail
.
outbox
[
0
]
.
bcc
)
self
.
assertEqual
([
self
.
course
.
publisher
.
email
,
self
.
course
.
p
roject
_coordinator
.
email
],
mail
.
outbox
[
0
]
.
bcc
)
self
.
assertEqual
(
str
(
mail
.
outbox
[
0
]
.
subject
),
subject
)
self
.
assertEqual
(
str
(
mail
.
outbox
[
0
]
.
subject
),
subject
)
body
=
mail
.
outbox
[
0
]
.
body
.
strip
()
body
=
mail
.
outbox
[
0
]
.
body
.
strip
()
page_path
=
reverse
(
'publisher:publisher_course_run_detail'
,
kwargs
=
{
'pk'
:
self
.
run_state
.
course_run
.
id
})
page_path
=
reverse
(
'publisher:publisher_course_run_detail'
,
kwargs
=
{
'pk'
:
self
.
run_state
.
course_run
.
id
})
...
...
course_discovery/apps/publisher/tests/test_model.py
View file @
b3652029
...
@@ -168,7 +168,7 @@ class CourseTests(TestCase):
...
@@ -168,7 +168,7 @@ class CourseTests(TestCase):
# add user in course-user-role table
# add user in course-user-role table
factories
.
CourseUserRoleFactory
(
factories
.
CourseUserRoleFactory
(
course
=
self
.
course
,
role
=
PublisherUserRole
.
P
artner
Coordinator
,
user
=
self
.
user1
course
=
self
.
course
,
role
=
PublisherUserRole
.
P
roject
Coordinator
,
user
=
self
.
user1
)
)
factories
.
CourseUserRoleFactory
(
factories
.
CourseUserRoleFactory
(
...
@@ -240,15 +240,15 @@ class CourseTests(TestCase):
...
@@ -240,15 +240,15 @@ class CourseTests(TestCase):
self
.
assertIn
(
'abc'
,
self
.
course
.
keywords_data
)
self
.
assertIn
(
'abc'
,
self
.
course
.
keywords_data
)
self
.
assertIn
(
'def'
,
self
.
course
.
keywords_data
)
self
.
assertIn
(
'def'
,
self
.
course
.
keywords_data
)
def
test_p
artner
_coordinator
(
self
):
def
test_p
roject
_coordinator
(
self
):
""" Verify that the p
artner
_coordinator property returns user if exist. """
""" Verify that the p
roject
_coordinator property returns user if exist. """
self
.
assertIsNone
(
self
.
course2
.
p
artner
_coordinator
)
self
.
assertIsNone
(
self
.
course2
.
p
roject
_coordinator
)
factories
.
CourseUserRoleFactory
(
factories
.
CourseUserRoleFactory
(
course
=
self
.
course2
,
user
=
self
.
user1
,
role
=
PublisherUserRole
.
P
artner
Coordinator
course
=
self
.
course2
,
user
=
self
.
user1
,
role
=
PublisherUserRole
.
P
roject
Coordinator
)
)
self
.
assertEqual
(
self
.
user1
,
self
.
course2
.
p
artner
_coordinator
)
self
.
assertEqual
(
self
.
user1
,
self
.
course2
.
p
roject
_coordinator
)
def
test_assign_roles
(
self
):
def
test_assign_roles
(
self
):
"""
"""
...
@@ -259,7 +259,7 @@ class CourseTests(TestCase):
...
@@ -259,7 +259,7 @@ class CourseTests(TestCase):
# create default roles for organization
# create default roles for organization
factories
.
OrganizationUserRoleFactory
(
factories
.
OrganizationUserRoleFactory
(
role
=
PublisherUserRole
.
P
artner
Coordinator
,
organization
=
self
.
org_extension_2
.
organization
role
=
PublisherUserRole
.
P
roject
Coordinator
,
organization
=
self
.
org_extension_2
.
organization
)
)
factories
.
OrganizationUserRoleFactory
(
factories
.
OrganizationUserRoleFactory
(
role
=
PublisherUserRole
.
MarketingReviewer
,
organization
=
self
.
org_extension_2
.
organization
role
=
PublisherUserRole
.
MarketingReviewer
,
organization
=
self
.
org_extension_2
.
organization
...
@@ -387,7 +387,7 @@ class OrganizationUserRoleTests(TestCase):
...
@@ -387,7 +387,7 @@ class OrganizationUserRoleTests(TestCase):
def
setUp
(
self
):
def
setUp
(
self
):
super
(
OrganizationUserRoleTests
,
self
)
.
setUp
()
super
(
OrganizationUserRoleTests
,
self
)
.
setUp
()
self
.
org_user_role
=
factories
.
OrganizationUserRoleFactory
(
role
=
PublisherUserRole
.
P
artner
Coordinator
)
self
.
org_user_role
=
factories
.
OrganizationUserRoleFactory
(
role
=
PublisherUserRole
.
P
roject
Coordinator
)
def
test_str
(
self
):
def
test_str
(
self
):
"""Verify that a OrganizationUserRole is properly converted to a str."""
"""Verify that a OrganizationUserRole is properly converted to a str."""
...
@@ -414,7 +414,7 @@ class CourseUserRoleTests(TestCase):
...
@@ -414,7 +414,7 @@ class CourseUserRoleTests(TestCase):
def
setUp
(
self
):
def
setUp
(
self
):
super
(
CourseUserRoleTests
,
self
)
.
setUp
()
super
(
CourseUserRoleTests
,
self
)
.
setUp
()
self
.
course_user_role
=
factories
.
CourseUserRoleFactory
(
role
=
PublisherUserRole
.
P
artner
Coordinator
)
self
.
course_user_role
=
factories
.
CourseUserRoleFactory
(
role
=
PublisherUserRole
.
P
roject
Coordinator
)
self
.
course
=
factories
.
CourseFactory
()
self
.
course
=
factories
.
CourseFactory
()
self
.
user
=
UserFactory
()
self
.
user
=
UserFactory
()
self
.
marketing_reviewer_role
=
PublisherUserRole
.
MarketingReviewer
self
.
marketing_reviewer_role
=
PublisherUserRole
.
MarketingReviewer
...
...
course_discovery/apps/publisher/tests/test_utils.py
View file @
b3652029
...
@@ -8,7 +8,7 @@ from mock import Mock
...
@@ -8,7 +8,7 @@ from mock import Mock
from
course_discovery.apps.core.tests.factories
import
UserFactory
from
course_discovery.apps.core.tests.factories
import
UserFactory
from
course_discovery.apps.publisher.constants
import
(
from
course_discovery.apps.publisher.constants
import
(
ADMIN_GROUP_NAME
,
INTERNAL_USER_GROUP_NAME
,
P
ARTNER
_COORDINATOR_GROUP_NAME
,
REVIEWER_GROUP_NAME
ADMIN_GROUP_NAME
,
INTERNAL_USER_GROUP_NAME
,
P
ROJECT
_COORDINATOR_GROUP_NAME
,
REVIEWER_GROUP_NAME
)
)
from
course_discovery.apps.publisher.mixins
import
(
from
course_discovery.apps.publisher.mixins
import
(
check_course_organization_permission
,
check_roles_access
,
publisher_user_required
check_course_organization_permission
,
check_roles_access
,
publisher_user_required
...
@@ -16,7 +16,7 @@ from course_discovery.apps.publisher.mixins import (
...
@@ -16,7 +16,7 @@ from course_discovery.apps.publisher.mixins import (
from
course_discovery.apps.publisher.models
import
OrganizationExtension
from
course_discovery.apps.publisher.models
import
OrganizationExtension
from
course_discovery.apps.publisher.tests
import
factories
from
course_discovery.apps.publisher.tests
import
factories
from
course_discovery.apps.publisher.utils
import
(
from
course_discovery.apps.publisher.utils
import
(
get_internal_users
,
is_email_notification_enabled
,
is_internal_user
,
is_p
artner
_coordinator_user
,
get_internal_users
,
is_email_notification_enabled
,
is_internal_user
,
is_p
roject
_coordinator_user
,
is_publisher_admin
,
is_publisher_user
,
make_bread_crumbs
is_publisher_admin
,
is_publisher_user
,
make_bread_crumbs
)
)
...
@@ -87,15 +87,15 @@ class PublisherUtilsTests(TestCase):
...
@@ -87,15 +87,15 @@ class PublisherUtilsTests(TestCase):
self
.
user
.
groups
.
add
(
internal_user_group
)
self
.
user
.
groups
.
add
(
internal_user_group
)
self
.
assertEqual
(
get_internal_users
(),
[
self
.
user
])
self
.
assertEqual
(
get_internal_users
(),
[
self
.
user
])
def
test_is_p
artner
_coordinator_user
(
self
):
def
test_is_p
roject
_coordinator_user
(
self
):
""" Verify the function returns a boolean indicating if the user
""" Verify the function returns a boolean indicating if the user
is a member of the p
artner
coordinator group.
is a member of the p
roject
coordinator group.
"""
"""
self
.
assertFalse
(
is_p
artner
_coordinator_user
(
self
.
user
))
self
.
assertFalse
(
is_p
roject
_coordinator_user
(
self
.
user
))
p
artner_coordinator_group
=
Group
.
objects
.
get
(
name
=
PARTNER
_COORDINATOR_GROUP_NAME
)
p
roject_coordinator_group
=
Group
.
objects
.
get
(
name
=
PROJECT
_COORDINATOR_GROUP_NAME
)
self
.
user
.
groups
.
add
(
p
artner
_coordinator_group
)
self
.
user
.
groups
.
add
(
p
roject
_coordinator_group
)
self
.
assertTrue
(
is_p
artner
_coordinator_user
(
self
.
user
))
self
.
assertTrue
(
is_p
roject
_coordinator_user
(
self
.
user
))
def
test_check_roles_access_with_admin
(
self
):
def
test_check_roles_access_with_admin
(
self
):
""" Verify the function returns a boolean indicating if the user
""" Verify the function returns a boolean indicating if the user
...
...
course_discovery/apps/publisher/tests/test_views.py
View file @
b3652029
...
@@ -24,7 +24,7 @@ from course_discovery.apps.course_metadata.tests.factories import OrganizationFa
...
@@ -24,7 +24,7 @@ from course_discovery.apps.course_metadata.tests.factories import OrganizationFa
from
course_discovery.apps.ietf_language_tags.models
import
LanguageTag
from
course_discovery.apps.ietf_language_tags.models
import
LanguageTag
from
course_discovery.apps.publisher.choices
import
CourseRunStateChoices
,
CourseStateChoices
,
PublisherUserRole
from
course_discovery.apps.publisher.choices
import
CourseRunStateChoices
,
CourseStateChoices
,
PublisherUserRole
from
course_discovery.apps.publisher.constants
import
(
ADMIN_GROUP_NAME
,
INTERNAL_USER_GROUP_NAME
,
from
course_discovery.apps.publisher.constants
import
(
ADMIN_GROUP_NAME
,
INTERNAL_USER_GROUP_NAME
,
P
ARTNER
_COORDINATOR_GROUP_NAME
,
REVIEWER_GROUP_NAME
)
P
ROJECT
_COORDINATOR_GROUP_NAME
,
REVIEWER_GROUP_NAME
)
from
course_discovery.apps.publisher.models
import
Course
,
CourseRun
,
CourseState
,
OrganizationExtension
,
Seat
from
course_discovery.apps.publisher.models
import
Course
,
CourseRun
,
CourseState
,
OrganizationExtension
,
Seat
from
course_discovery.apps.publisher.tests
import
factories
from
course_discovery.apps.publisher.tests
import
factories
from
course_discovery.apps.publisher.tests.utils
import
create_non_staff_user_and_login
from
course_discovery.apps.publisher.tests.utils
import
create_non_staff_user_and_login
...
@@ -64,7 +64,7 @@ class CreateCourseViewTests(TestCase):
...
@@ -64,7 +64,7 @@ class CreateCourseViewTests(TestCase):
# creating default organizations roles
# creating default organizations roles
factories
.
OrganizationUserRoleFactory
(
factories
.
OrganizationUserRoleFactory
(
role
=
PublisherUserRole
.
P
artner
Coordinator
,
organization
=
self
.
organization_extension
.
organization
role
=
PublisherUserRole
.
P
roject
Coordinator
,
organization
=
self
.
organization_extension
.
organization
)
)
factories
.
OrganizationUserRoleFactory
(
factories
.
OrganizationUserRoleFactory
(
role
=
PublisherUserRole
.
MarketingReviewer
,
organization
=
self
.
organization_extension
.
organization
role
=
PublisherUserRole
.
MarketingReviewer
,
organization
=
self
.
organization_extension
.
organization
...
@@ -1208,21 +1208,21 @@ class DashboardTests(TestCase):
...
@@ -1208,21 +1208,21 @@ class DashboardTests(TestCase):
super
(
DashboardTests
,
self
)
.
setUp
()
super
(
DashboardTests
,
self
)
.
setUp
()
self
.
group_internal
=
Group
.
objects
.
get
(
name
=
INTERNAL_USER_GROUP_NAME
)
self
.
group_internal
=
Group
.
objects
.
get
(
name
=
INTERNAL_USER_GROUP_NAME
)
self
.
group_p
artner_coordinator
=
Group
.
objects
.
get
(
name
=
PARTNER
_COORDINATOR_GROUP_NAME
)
self
.
group_p
roject_coordinator
=
Group
.
objects
.
get
(
name
=
PROJECT
_COORDINATOR_GROUP_NAME
)
self
.
group_reviewer
=
Group
.
objects
.
get
(
name
=
REVIEWER_GROUP_NAME
)
self
.
group_reviewer
=
Group
.
objects
.
get
(
name
=
REVIEWER_GROUP_NAME
)
self
.
user1
=
UserFactory
()
self
.
user1
=
UserFactory
()
self
.
user2
=
UserFactory
()
self
.
user2
=
UserFactory
()
self
.
user1
.
groups
.
add
(
self
.
group_internal
)
self
.
user1
.
groups
.
add
(
self
.
group_internal
)
self
.
user1
.
groups
.
add
(
self
.
group_p
artner
_coordinator
)
self
.
user1
.
groups
.
add
(
self
.
group_p
roject
_coordinator
)
self
.
user1
.
groups
.
add
(
self
.
group_reviewer
)
self
.
user1
.
groups
.
add
(
self
.
group_reviewer
)
self
.
user2
.
groups
.
add
(
self
.
group_internal
)
self
.
user2
.
groups
.
add
(
self
.
group_internal
)
self
.
client
.
login
(
username
=
self
.
user1
.
username
,
password
=
USER_PASSWORD
)
self
.
client
.
login
(
username
=
self
.
user1
.
username
,
password
=
USER_PASSWORD
)
self
.
page_url
=
reverse
(
'publisher:publisher_dashboard'
)
self
.
page_url
=
reverse
(
'publisher:publisher_dashboard'
)
pc
=
PublisherUserRole
.
P
artner
Coordinator
pc
=
PublisherUserRole
.
P
roject
Coordinator
# user1 courses data set ( 2 studio-request, 1 published, 1 in preview ready, 1 in progress )
# user1 courses data set ( 2 studio-request, 1 published, 1 in preview ready, 1 in progress )
self
.
course_run_1
=
self
.
_create_course_assign_role
(
CourseRunStateChoices
.
Draft
,
self
.
user1
,
pc
)
self
.
course_run_1
=
self
.
_create_course_assign_role
(
CourseRunStateChoices
.
Draft
,
self
.
user1
,
pc
)
...
@@ -1320,7 +1320,7 @@ class DashboardTests(TestCase):
...
@@ -1320,7 +1320,7 @@ class DashboardTests(TestCase):
def
test_studio_request_course_runs_without_pc_group
(
self
):
def
test_studio_request_course_runs_without_pc_group
(
self
):
""" Verify that PC user can see only those courses on which he is assigned as PC role. """
""" Verify that PC user can see only those courses on which he is assigned as PC role. """
self
.
user1
.
groups
.
remove
(
self
.
group_p
artner
_coordinator
)
self
.
user1
.
groups
.
remove
(
self
.
group_p
roject
_coordinator
)
response
=
self
.
assert_dashboard_response
(
studio_count
=
0
,
published_count
=
1
,
progress_count
=
2
,
preview_count
=
1
)
response
=
self
.
assert_dashboard_response
(
studio_count
=
0
,
published_count
=
1
,
progress_count
=
2
,
preview_count
=
1
)
self
.
_assert_tabs_with_roles
(
response
)
self
.
_assert_tabs_with_roles
(
response
)
...
@@ -1363,7 +1363,7 @@ class DashboardTests(TestCase):
...
@@ -1363,7 +1363,7 @@ class DashboardTests(TestCase):
# assign user course role
# assign user course role
factories
.
CourseUserRoleFactory
(
factories
.
CourseUserRoleFactory
(
course
=
self
.
course_run_3
.
course
,
user
=
internal_user
,
role
=
PublisherUserRole
.
P
artner
Coordinator
course
=
self
.
course_run_3
.
course
,
user
=
internal_user
,
role
=
PublisherUserRole
.
P
roject
Coordinator
)
)
# Verify that user can see 1 published course run
# Verify that user can see 1 published course run
...
@@ -2032,7 +2032,7 @@ class CourseRunEditViewTests(TestCase):
...
@@ -2032,7 +2032,7 @@ class CourseRunEditViewTests(TestCase):
# creating default organizations roles
# creating default organizations roles
factories
.
OrganizationUserRoleFactory
(
factories
.
OrganizationUserRoleFactory
(
role
=
PublisherUserRole
.
P
artner
Coordinator
,
organization
=
self
.
organization_extension
.
organization
role
=
PublisherUserRole
.
P
roject
Coordinator
,
organization
=
self
.
organization_extension
.
organization
)
)
factories
.
OrganizationUserRoleFactory
(
factories
.
OrganizationUserRoleFactory
(
role
=
PublisherUserRole
.
MarketingReviewer
,
organization
=
self
.
organization_extension
.
organization
role
=
PublisherUserRole
.
MarketingReviewer
,
organization
=
self
.
organization_extension
.
organization
...
...
course_discovery/apps/publisher/utils.py
View file @
b3652029
""" Publisher Utils."""
""" Publisher Utils."""
from
course_discovery.apps.core.models
import
User
from
course_discovery.apps.core.models
import
User
from
course_discovery.apps.publisher.constants
import
(
from
course_discovery.apps.publisher.constants
import
(
ADMIN_GROUP_NAME
,
INTERNAL_USER_GROUP_NAME
,
P
ARTNER
_COORDINATOR_GROUP_NAME
ADMIN_GROUP_NAME
,
INTERNAL_USER_GROUP_NAME
,
P
ROJECT
_COORDINATOR_GROUP_NAME
)
)
...
@@ -54,8 +54,8 @@ def get_internal_users():
...
@@ -54,8 +54,8 @@ def get_internal_users():
return
list
(
User
.
objects
.
filter
(
groups__name
=
INTERNAL_USER_GROUP_NAME
))
return
list
(
User
.
objects
.
filter
(
groups__name
=
INTERNAL_USER_GROUP_NAME
))
def
is_p
artner
_coordinator_user
(
user
):
def
is_p
roject
_coordinator_user
(
user
):
""" Returns True if the user is an p
artner
coordinator user.
""" Returns True if the user is an p
roject
coordinator user.
Arguments:
Arguments:
user (:obj:`User`): User whose permissions should be checked.
user (:obj:`User`): User whose permissions should be checked.
...
@@ -63,7 +63,7 @@ def is_partner_coordinator_user(user):
...
@@ -63,7 +63,7 @@ def is_partner_coordinator_user(user):
Returns:
Returns:
bool: True, if user is an PC user; otherwise, False.
bool: True, if user is an PC user; otherwise, False.
"""
"""
return
user
.
groups
.
filter
(
name
=
P
ARTNER
_COORDINATOR_GROUP_NAME
)
.
exists
()
return
user
.
groups
.
filter
(
name
=
P
ROJECT
_COORDINATOR_GROUP_NAME
)
.
exists
()
def
is_publisher_user
(
user
):
def
is_publisher_user
(
user
):
...
...
course_discovery/apps/publisher/views.py
View file @
b3652029
...
@@ -24,7 +24,7 @@ from course_discovery.apps.publisher.choices import CourseRunStateChoices, Cours
...
@@ -24,7 +24,7 @@ from course_discovery.apps.publisher.choices import CourseRunStateChoices, Cours
from
course_discovery.apps.publisher.forms
import
CustomCourseForm
,
CustomCourseRunForm
,
CustomSeatForm
,
SeatForm
from
course_discovery.apps.publisher.forms
import
CustomCourseForm
,
CustomCourseRunForm
,
CustomSeatForm
,
SeatForm
from
course_discovery.apps.publisher.models
import
(
Course
,
CourseRun
,
CourseRunState
,
CourseState
,
CourseUserRole
,
from
course_discovery.apps.publisher.models
import
(
Course
,
CourseRun
,
CourseRunState
,
CourseState
,
CourseUserRole
,
OrganizationExtension
,
Seat
,
UserAttributes
)
OrganizationExtension
,
Seat
,
UserAttributes
)
from
course_discovery.apps.publisher.utils
import
(
get_internal_users
,
is_internal_user
,
is_p
artner
_coordinator_user
,
from
course_discovery.apps.publisher.utils
import
(
get_internal_users
,
is_internal_user
,
is_p
roject
_coordinator_user
,
is_publisher_admin
,
make_bread_crumbs
)
is_publisher_admin
,
make_bread_crumbs
)
from
course_discovery.apps.publisher.wrappers
import
CourseRunWrapper
from
course_discovery.apps.publisher.wrappers
import
CourseRunWrapper
...
@@ -35,7 +35,7 @@ SEATS_HIDDEN_FIELDS = ['price', 'currency', 'upgrade_deadline', 'credit_provider
...
@@ -35,7 +35,7 @@ SEATS_HIDDEN_FIELDS = ['price', 'currency', 'upgrade_deadline', 'credit_provider
ROLE_WIDGET_HEADINGS
=
{
ROLE_WIDGET_HEADINGS
=
{
PublisherUserRole
.
PartnerManager
:
_
(
'PARTNER MANAGER'
),
PublisherUserRole
.
PartnerManager
:
_
(
'PARTNER MANAGER'
),
PublisherUserRole
.
P
artnerCoordinator
:
_
(
'PARTNER
COORDINATOR'
),
PublisherUserRole
.
P
rojectCoordinator
:
_
(
'PROJECT
COORDINATOR'
),
PublisherUserRole
.
MarketingReviewer
:
_
(
'MARKETING'
),
PublisherUserRole
.
MarketingReviewer
:
_
(
'MARKETING'
),
PublisherUserRole
.
Publisher
:
_
(
'PUBLISHER'
),
PublisherUserRole
.
Publisher
:
_
(
'PUBLISHER'
),
PublisherUserRole
.
CourseTeam
:
_
(
'COURSE TEAM'
)
PublisherUserRole
.
CourseTeam
:
_
(
'COURSE TEAM'
)
...
@@ -82,12 +82,12 @@ class Dashboard(mixins.LoginRequiredMixin, ListView):
...
@@ -82,12 +82,12 @@ class Dashboard(mixins.LoginRequiredMixin, ListView):
unpublished_course_runs
=
course_runs
.
exclude
(
course_run_state__name
=
CourseRunStateChoices
.
Published
)
unpublished_course_runs
=
course_runs
.
exclude
(
course_run_state__name
=
CourseRunStateChoices
.
Published
)
# Studio requests needs to check depending upon the user role with course
# Studio requests needs to check depending upon the user role with course
# Also user should be part of p
artner
coordinator group.
# Also user should be part of p
roject
coordinator group.
if
is_publisher_admin
(
self
.
request
.
user
):
if
is_publisher_admin
(
self
.
request
.
user
):
studio_request_courses
=
unpublished_course_runs
.
filter
(
lms_course_id__isnull
=
True
)
studio_request_courses
=
unpublished_course_runs
.
filter
(
lms_course_id__isnull
=
True
)
elif
is_p
artner
_coordinator_user
(
self
.
request
.
user
):
elif
is_p
roject
_coordinator_user
(
self
.
request
.
user
):
studio_request_courses
=
unpublished_course_runs
.
filter
(
lms_course_id__isnull
=
True
)
.
filter
(
studio_request_courses
=
unpublished_course_runs
.
filter
(
lms_course_id__isnull
=
True
)
.
filter
(
course__course_user_roles__role
=
PublisherUserRole
.
P
artner
Coordinator
course__course_user_roles__role
=
PublisherUserRole
.
P
roject
Coordinator
)
)
else
:
else
:
studio_request_courses
=
[]
studio_request_courses
=
[]
...
...
course_discovery/apps/publisher_comments/tests/test_emails.py
View file @
b3652029
...
@@ -41,15 +41,15 @@ class CommentsEmailTests(TestCase):
...
@@ -41,15 +41,15 @@ class CommentsEmailTests(TestCase):
# add user in course-user-role table
# add user in course-user-role table
factories
.
CourseUserRoleFactory
(
factories
.
CourseUserRoleFactory
(
course
=
self
.
course
,
role
=
PublisherUserRole
.
P
artner
Coordinator
,
user
=
self
.
user
course
=
self
.
course
,
role
=
PublisherUserRole
.
P
roject
Coordinator
,
user
=
self
.
user
)
)
factories
.
CourseUserRoleFactory
(
factories
.
CourseUserRoleFactory
(
course
=
self
.
course
,
role
=
PublisherUserRole
.
P
artner
Coordinator
,
user
=
self
.
user_2
course
=
self
.
course
,
role
=
PublisherUserRole
.
P
roject
Coordinator
,
user
=
self
.
user_2
)
)
factories
.
CourseUserRoleFactory
(
factories
.
CourseUserRoleFactory
(
course
=
self
.
course
,
role
=
PublisherUserRole
.
P
artner
Coordinator
,
user
=
self
.
user_3
course
=
self
.
course
,
role
=
PublisherUserRole
.
P
roject
Coordinator
,
user
=
self
.
user_3
)
)
UserAttributeFactory
(
user
=
self
.
user
,
enable_email_notification
=
True
)
UserAttributeFactory
(
user
=
self
.
user
,
enable_email_notification
=
True
)
...
@@ -148,7 +148,7 @@ class CommentsEmailTests(TestCase):
...
@@ -148,7 +148,7 @@ class CommentsEmailTests(TestCase):
course
=
self
.
course
,
role
=
PublisherUserRole
.
MarketingReviewer
,
user
=
user_4
course
=
self
.
course
,
role
=
PublisherUserRole
.
MarketingReviewer
,
user
=
user_4
)
)
factories
.
CourseUserRoleFactory
(
factories
.
CourseUserRoleFactory
(
course
=
self
.
course
,
role
=
PublisherUserRole
.
P
artner
Coordinator
,
user
=
user_5
course
=
self
.
course
,
role
=
PublisherUserRole
.
P
roject
Coordinator
,
user
=
user_5
)
)
self
.
create_comment
(
content_object
=
self
.
course_run
)
self
.
create_comment
(
content_object
=
self
.
course_run
)
self
.
assertEqual
(
len
(
mail
.
outbox
),
1
)
self
.
assertEqual
(
len
(
mail
.
outbox
),
1
)
...
...
course_discovery/templates/publisher/courses.html
View file @
b3652029
...
@@ -21,7 +21,7 @@
...
@@ -21,7 +21,7 @@
{% trans "Institution" %}
{% trans "Institution" %}
</th>
</th>
<th
role=
"button"
>
<th
role=
"button"
>
{% trans "P
artner
Coordinator" %}
{% trans "P
roject
Coordinator" %}
</th>
</th>
<th
role=
"button"
>
<th
role=
"button"
>
{% trans "Runs" %}
{% trans "Runs" %}
...
@@ -45,7 +45,7 @@
...
@@ -45,7 +45,7 @@
{% if course.organizations.first %}{{ course.organizations.first.name }}{% endif %}
{% if course.organizations.first %}{{ course.organizations.first.name }}{% endif %}
</td>
</td>
<td>
<td>
{{ course.p
artner
_coordinator.full_name }}
{{ course.p
roject
_coordinator.full_name }}
</td>
</td>
<td>
<td>
{{ course.publisher_course_runs.count }}
{{ course.publisher_course_runs.count }}
...
...
course_discovery/templates/publisher/email/course_created.html
View file @
b3652029
...
@@ -3,9 +3,9 @@
...
@@ -3,9 +3,9 @@
{% block body %}
{% block body %}
<!-- Message Body -->
<!-- Message Body -->
<p>
<p>
{# Translators: p
artner
_coordinator_name is a member name. #}
{# Translators: p
roject
_coordinator_name is a member name. #}
{% blocktrans trimmed %}
{% blocktrans trimmed %}
Dear {{ p
artner
_coordinator_name }},
Dear {{ p
roject
_coordinator_name }},
{% endblocktrans %}
{% endblocktrans %}
<p>
<p>
<p>
<p>
...
...
course_discovery/templates/publisher/email/course_created.txt
View file @
b3652029
{% load i18n %}
{% load i18n %}
{% trans "Dear" %} {{ p
artner
_coordinator_name }},
{% trans "Dear" %} {{ p
roject
_coordinator_name }},
{% blocktrans trimmed %}
{% blocktrans trimmed %}
{{ course_team_name }} created the {{ course_title }} : {{ dashboard_url }} course in Publisher on {{ date }} at {{ time }}.
{{ course_team_name }} created the {{ course_title }} : {{ dashboard_url }} course in Publisher on {{ date }} at {{ time }}.
...
...
course_discovery/templates/publisher/email/studio_instance_created.html
View file @
b3652029
...
@@ -42,7 +42,7 @@
...
@@ -42,7 +42,7 @@
{% comment %}Translators: It's closing of mail.{% endcomment %}
{% comment %}Translators: It's closing of mail.{% endcomment %}
{% trans "Thanks," %}
<br>
{% trans "Thanks," %}
<br>
{{ p
artner
_coordinator_name }}
{{ p
roject
_coordinator_name }}
{% blocktrans trimmed %}
{% blocktrans trimmed %}
...
...
course_discovery/templates/publisher/email/studio_instance_created.txt
View file @
b3652029
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
{% endblocktrans %}
{% endblocktrans %}
{% trans "Thanks," %}
{% trans "Thanks," %}
{{ p
artner
_coordinator_name }}
{{ p
roject
_coordinator_name }}
{% blocktrans trimmed %}
{% blocktrans trimmed %}
Note: This email address is unable to receive replies. For questions or comments, contact {{ contact_us_email }}.
Note: This email address is unable to receive replies. For questions or comments, contact {{ contact_us_email }}.
...
...
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