Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
80ab601f
Unverified
Commit
80ab601f
authored
4 years ago
by
Muhammad Ammar
Committed by
GitHub
4 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #25501 from edx/ammar/more-logs-for-dsc
more logs for data sharing consent
parents
dbe96cff
5f04fd35
No related branches found
Branches containing commit
Tags
release-2020-11-02-12.26
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
openedx/features/enterprise_support/api.py
+29
-7
29 additions, 7 deletions
openedx/features/enterprise_support/api.py
with
29 additions
and
7 deletions
openedx/features/enterprise_support/api.py
+
29
−
7
View file @
80ab601f
...
...
@@ -103,14 +103,15 @@ class ConsentApiClient(object):
# Call the endpoint with the given kwargs, and check the value that it provides.
response
=
self
.
consent_endpoint
.
get
(
**
kwargs
)
LOGGER
.
info
(
'
[ENTERPRISE DSC] Consent Requirement Info. APIParams: [%s], APIResponse: [%s], EnrollmentExists: [%s]
'
,
kwargs
,
response
,
enrollment_exists
,
)
# No Enterprise record exists, but we're already enrolled in a course. So, go ahead and proceed.
if
enrollment_exists
and
not
response
.
get
(
'
exists
'
,
False
):
LOGGER
.
info
(
'
[ENTERPRISE DSC] No Consent Required. APIParams: [%s], APIResponse: [%s], EnrollmentExists: [%s]
'
,
kwargs
,
response
,
enrollment_exists
,
)
return
False
# In all other cases, just trust the Consent API.
...
...
@@ -584,6 +585,27 @@ def consent_needed_for_course(request, user, course_id, enrollment_exists=False)
for
learner
in
enterprise_learner_details
)
if
not
consent_needed
:
for
learner
in
enterprise_learner_details
:
if
current_enterprise_uuid
!=
learner
[
'
enterprise_customer
'
][
'
uuid
'
]:
LOGGER
.
info
(
'
[ENTERPRISE DSC] Consent requirement failed due to enterprise mismatch.
'
'
USER: [%s], CurrentEnterprise: [%s], LearnerEnterprise: [%s]
'
,
user
.
username
,
current_enterprise_uuid
,
learner
[
'
enterprise_customer
'
][
'
uuid
'
]
)
learner_enterprise_site
=
Site
.
objects
.
get
(
domain
=
learner
[
'
enterprise_customer
'
][
'
site
'
][
'
domain
'
])
if
learner_enterprise_site
!=
request
.
site
:
LOGGER
.
info
(
'
[ENTERPRISE DSC] Consent requirement failed due to site mismatch.
'
'
USER: [%s], RequestSite: [%s], LearnerEnterpriseSite: [%s]
'
,
user
.
username
,
request
.
site
,
learner_enterprise_site
)
if
consent_needed
:
LOGGER
.
info
(
u
"
Consent from user [{username}] is needed for course [{course_id}]. The user
'
s current enterprise
"
...
...
@@ -594,7 +616,7 @@ def consent_needed_for_course(request, user, course_id, enrollment_exists=False)
)
else
:
LOGGER
.
info
(
u
"
Consent from user [{username}] is not needed for course [{course_id}]. The user
'
s current enterprise
"
u
"
Consent from user [{username}] is not needed for course [{course_id}]. The user
'
s current enterprise
"
u
"
does not require data sharing consent.
"
.
format
(
username
=
user
.
username
,
course_id
=
course_id
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment