Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Tahoe Nutmeg upgrade branch with changes from main #1288

Open
wants to merge 199 commits into
base: shadinaif/upgrade-to-nutmeg
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
199 commits
Select commit Hold shift + click to select a range
67dc357
bump tahoe-idp==2.1.0
OmarIthawi Sep 15, 2022
997c2f1
Add TahoeCourseAuthor role with Studio access
OmarIthawi Sep 15, 2022
b22e4e2
fix: empty signature added after every certificate saving (#30912)
dyudyunov Sep 12, 2022
84b4571
Merge pull request #1286 from appsembler/maxi/cherry-pick-studio-cert…
melvinsoft Oct 3, 2022
6d4e53d
Add legacy /user_api/ prefix to MAIN_SITE_REDIRECT_ALLOWLIST.
bryanlandia Oct 4, 2022
4985581
Merge pull request #1289 from appsembler/bryan/bugfix-marketing-redir…
OmarIthawi Oct 4, 2022
9a2c029
Merge pull request #1254 from appsembler/course_author_role
OmarIthawi Oct 6, 2022
7a81c0f
remove_site: fix CMS role IntegrityError + refactoring
OmarIthawi Sep 29, 2022
892d3a1
fix a weird test failure in `create_devstack_site`
OmarIthawi Oct 10, 2022
eb4181b
remove_site: also remove models with LearningContextKeyField
OmarIthawi Sep 29, 2022
7376d0b
don't report conflicts for releases before nutmeg
OmarIthawi Oct 11, 2022
4740e07
Merge pull request #1284 from appsembler/remove_course_creator
OmarIthawi Oct 11, 2022
79943d4
Merge pull request #1293 from appsembler/nutmeg_only
OmarIthawi Oct 11, 2022
249d560
Merge pull request #1285 from appsembler/learning_context
OmarIthawi Oct 11, 2022
773591e
remove beeline logs from site config get_value
OmarIthawi Oct 17, 2022
612270c
Merge pull request #1294 from appsembler/remove_site_config_beeline
OmarIthawi Oct 17, 2022
9852a41
add beeline tracing for site config service usage
OmarIthawi Oct 19, 2022
f0e482e
allow lint specific directory e.g. `tox -e pep8 openedx/`
OmarIthawi Oct 20, 2022
6ba6372
Merge pull request #1296 from appsembler/config_tracing
OmarIthawi Oct 20, 2022
aaeb43c
Merge pull request #1297 from appsembler/tox_pep8_dir
OmarIthawi Oct 20, 2022
8c6c96d
delete multiple sites at once
OmarIthawi Oct 24, 2022
662074a
fix remove_site error with UserTaskStatus
OmarIthawi Oct 24, 2022
b57c31d
Prepare removing users by avoiding on_delete=models.PROTECT error
OmarIthawi Oct 24, 2022
161cc3d
less noisy delete_organization_courses logs
OmarIthawi Oct 24, 2022
9fbcad7
Merge pull request #1298 from appsembler/delete_multiple_sites
OmarIthawi Oct 25, 2022
8347b5f
Make studio logout redirect to LMS
shadinaif Oct 27, 2022
5afa962
Add get_redirect_to_lms_login_url helper
shadinaif Oct 27, 2022
54881da
Merge pull request #1301 from appsembler/shadinaif/add-get_redirect_t…
shadinaif Oct 28, 2022
cbf5aac
Merge pull request #1300 from appsembler/shadinaif/studio-logout-fix
shadinaif Oct 28, 2022
15c5953
Increase page limit from 20 to 100 - RED-3598
shadinaif Oct 31, 2022
d1184c4
Merge pull request #1302 from appsembler/shadinaif/discovery-page-lim…
shadinaif Nov 1, 2022
6e1b1b9
Ensure saving the correct course-key in Enrollment API
shadinaif Nov 2, 2022
87c6abb
Merge pull request #1303 from appsembler/shadinaif/enrollment-api-che…
shadinaif Nov 9, 2022
ca0136e
Avoid touching StudentModule.modified during celery tasks
OmarIthawi Nov 8, 2022
597a7d9
Merge pull request #1304 from appsembler/celery_fix_studentmodule
OmarIthawi Nov 10, 2022
51a741f
delete stale courses (without active organization)
OmarIthawi Jun 29, 2022
bf36c2b
Merge pull request #1180 from appsembler/delete_stale_course
OmarIthawi Nov 25, 2022
ab71e52
Skip AMC tests when TAHOE_SITES_USE_ORGS_MODELS=False
OmarIthawi Dec 6, 2022
611e9d9
fix tests when using tahoe-sites models
OmarIthawi Dec 6, 2022
bd15470
docker: bump cag to 0.6.0 to use tahoe-sites
OmarIthawi Dec 6, 2022
77da710
upgrade create_devstack_site to tahoe 2.0; removes upgrade command
OmarIthawi Dec 6, 2022
92bc194
legacy_amc_helpers.py no longer needs edx-organization fork
OmarIthawi Dec 8, 2022
ee7e9b7
add db-migration tox env (split from lms-1)
OmarIthawi Dec 12, 2022
a54c79c
enable tiers apps in all tests
OmarIthawi Dec 13, 2022
0623ca0
Merge pull request #1308 from appsembler/remove_edx_uuid
OmarIthawi Dec 13, 2022
5129daf
Fix AMC UUID AttributeError exception
OmarIthawi Dec 14, 2022
44a8d0b
Merge pull request #1309 from appsembler/fix_edxuuid_bug
OmarIthawi Dec 14, 2022
063899c
appsembler.eventtracking util method to get user_id from event itself
bryanlandia Dec 19, 2022
ef977ec
TahoeUserMetadataProcessor get User from user_id in event if not foun…
bryanlandia Dec 19, 2022
469fad1
Test TahoeUserMetdataProcessor adds metadata getting user id from eve…
bryanlandia Dec 19, 2022
becb9b4
allow TahoeUserMetadataProcessor to process event for tests
bryanlandia Dec 22, 2022
5862e13
protect against TahoeUserMetadataProcessor running in CMS tests.
bryanlandia Dec 23, 2022
078b52c
Use tahoe-idp==2.2.0 for idp_hint support
shadinaif Jan 2, 2023
1c10ff1
Merge pull request #1312 from appsembler/shadinaif/idp_hint
shadinaif Jan 2, 2023
4b81230
defensive coding fixes for tahoe metadata eventtracking utils
bryanlandia Jan 4, 2023
fec47df
Fix logic for app variant detection... for tahoeusermetadata tests.
bryanlandia Jan 18, 2023
b99a714
Merge pull request #1311 from appsembler/bryan/fix-tahoe-user-metadat…
bryanlandia Jan 18, 2023
fc5c23d
util method to determine if being run in appsembler.eventtracking tests
bryanlandia Jan 18, 2023
a78f4ba
eventtracking TahoeUserMetadata: performance fix for variant checks
Jan 26, 2023
b5b1416
got logic backward checking for test environment. Fix it.
bryanlandia Jan 26, 2023
325c3f1
Merge pull request #1315 from appsembler/bryan/fix-tahoe-user-metadat…
bryanlandia Jan 26, 2023
e3ed8c0
TahoeUserMetadataProcessor check in event.context not just context, f…
bryanlandia Jan 27, 2023
337c8f6
Update TahoeUserMetadataProcessor tests for requestless with user_id …
bryanlandia Jan 30, 2023
a4b92dc
Merge pull request #1316 from appsembler/bryan/tahoe-user-metadata-ev…
bryanlandia Jan 30, 2023
278e3dd
Fix the broken ReadTheDocs link in account deletion modal
bryanlandia Feb 2, 2023
2bcca7a
mark failing unrelated test with xfail
bryanlandia Feb 3, 2023
3458c3e
Merge pull request #1317 from appsembler/fix-account-deletion-certs-d…
bryanlandia Feb 3, 2023
baaaebe
appsembler.eventtracking.utils look in event['event'] for user_id, too
bryanlandia Feb 9, 2023
5f7a81f
get_userid_from_event don't accept empty string values, check for Tru…
bryanlandia Feb 9, 2023
b577592
Merge pull request #1318 from appsembler/black/eventtracking-utils-us…
bryanlandia Feb 9, 2023
9dfc828
Fix bug with TahoeUserMetadataProcessor in Celery or otherwise withou…
bryanlandia Feb 10, 2023
7394a28
Merge pull request #1319 from appsembler/tahoeusermetadata-expect-dat…
bryanlandia Feb 10, 2023
dfa24d2
appsembler.eventtracking get_user_id_from_event log warning and
bryanlandia Feb 24, 2023
de9b756
Merge pull request #1321 from appsembler/bugfix-tahoe-metadata-processor
bryanlandia Feb 24, 2023
63fec04
Fix tahoeusermetadatacache boolean in app.ready()
bryanlandia Feb 27, 2023
2b34043
For now, comment out tahoeusermetadata cache
bryanlandia Feb 27, 2023
041846c
Merge pull request #1323 from appsembler/bugfix-tahoe-metadata-processor
bryanlandia Feb 27, 2023
d9221ea
remove Omar, add Bryan as owner. Add Sheridan, Maxi as default revie…
bryanlandia Feb 27, 2023
c7cdf0a
Merge pull request #1324 from appsembler/chore-update-appsembler-code…
bryanlandia Feb 27, 2023
ffb437e
Fix transcript S3 upload for migrate_transcripts
bryanlandia Mar 1, 2023
e83e613
Merge pull request #1325 from appsembler/bugfix/appsembler-migrate-tr…
bryanlandia Mar 1, 2023
8d8ac0f
fix handling of AttributeError in TahoeUserMetadataProcessor when pas…
bryanlandia Mar 2, 2023
c839e61
TahoeUserMetadataProcessor don't trust the user in the request
bryanlandia Mar 2, 2023
a4a0b86
get_user_id_from_event get deepest defined user_id
bryanlandia Mar 2, 2023
b23b47a
TahoeUserMetadataProcess tests remove what should be exercised in tes…
bryanlandia Mar 3, 2023
3431291
apps.eventtracking.test_utils add test for get_user_id_from_event
bryanlandia Mar 3, 2023
c82f271
refactor: let the get_user_tahoe_metadata method check cache or db fo…
bryanlandia Mar 3, 2023
9ecadc5
Merge pull request #1328 from appsembler/bugfix/event-tahoe-metadata-…
bryanlandia Mar 3, 2023
2394011
Use a Waffle Flag under appsembler namespace to test removal of TPA p…
bryanlandia Mar 3, 2023
f0c7a11
Fix how I was using Waffle Flag for create_user tpa step selective di…
bryanlandia Mar 3, 2023
c94b450
Fix is_flag_active call to check create_user TPA step
bryanlandia Mar 4, 2023
96036d8
remove Anders, Maxi, Omar, Shadi... add Amir, Sheridan
bryanlandia Mar 5, 2023
7c8f90c
reset factory sequence to fix random failures in tahoeusermetadata pr…
bryanlandia Mar 5, 2023
fa490e3
Merge pull request #1330 from appsembler/chore/update-reviewers-20230305
bryanlandia Mar 6, 2023
dd53c17
Merge pull request #1331 from appsembler/bugfix/tahoeusermetadata-tes…
bryanlandia Mar 6, 2023
f203850
Merge pull request #1329 from appsembler/bugfix/remove-redundant-tpa-…
bryanlandia Mar 6, 2023
fbd6d0f
Send full event to utils.get_user_id_from_event
bryanlandia Mar 16, 2023
d84f905
less noisy logs for events with invalid event types
bryanlandia Mar 16, 2023
2ecad81
Merge pull request #1332 from appsembler/bugfix/RED-3716-instr-enroll…
bryanlandia Mar 16, 2023
b494bc3
If Tiers app not enabled return all orgs as active
bryanlandia Mar 17, 2023
b01bfa9
Check TPA pipeline for tahoe idp metadata if before added to UserProfile
bryanlandia Mar 17, 2023
2f483c2
Merge pull request #1335 from appsembler/bugfix/RED-3716-instr-enroll…
bryanlandia Mar 17, 2023
483a91d
Ensure samesite=none logged_in cookies are deleted
bryanlandia Apr 3, 2023
3ddb744
match func args order from HTTPResponse.set_cookie
bryanlandia Apr 4, 2023
e07eade
Set explicit 1970 string for delete_cookie expire'
bryanlandia Apr 5, 2023
ae40efc
Merge pull request #1336 from appsembler/bugfix/ENG-53-delete-logged-…
bryanlandia Apr 5, 2023
7961372
Fix unenroll_by_email for multitenant email settings
bryanlandia Apr 7, 2023
42ced11
Merge pull request #1334 from appsembler/bugfix/no-tiers-check-for-or…
bryanlandia Apr 12, 2023
8095704
fix: sanitize redirect_url parameter for logout
amirtds Apr 12, 2023
23b4b49
chore: add test for the logout redirect_url sanitization
amirtds Apr 12, 2023
1bc0640
Merge pull request #1339 from appsembler/fix/logout-sanitize-redirecturl
bryanlandia Apr 12, 2023
10eea10
Fix mte unenrollment_by_email test
bryanlandia Apr 13, 2023
68f1030
Merge pull request #1338 from appsembler/bugfix/ENG-57-bulk-unenroll-…
bryanlandia Apr 13, 2023
1837bb5
chore: add valid_url_pattern for logout
amirtds Apr 14, 2023
e0b4ba1
chore: cover relative redirect urls for logout
amirtds Apr 14, 2023
b59ad3a
Merge pull request #1340 from appsembler/fix/logout-sanitize-redirecturl
bryanlandia Apr 18, 2023
b45960c
Bump tahoe-idp to 2.3.0
bryanlandia Apr 19, 2023
04230fe
Merge pull request #1342 from appsembler/bugfix/bump-tahoe-idp-to-2.3.0
bryanlandia Apr 19, 2023
3b40578
Remove reference to Harvard, Wharton, etc. in account deletion
bryanlandia May 15, 2023
cec0133
Remove account deletion prompts we don't want to support:
bryanlandia May 15, 2023
f542d91
account settings set default text for country and language dropdowns
bryanlandia May 15, 2023
6540257
account settings set default text for gender, yob, preferred language…
bryanlandia May 15, 2023
0a66b5c
Merge pull request #1344 from appsembler/bugfix/a11y-fixes-settings-p…
bryanlandia May 15, 2023
20bac3a
use tahoe-idp 2.4.2
bryanlandia Jun 26, 2023
118c132
Mock out tahoe-idp package receiver code in tests using ENABLE_TAHOE_IDP
bryanlandia Jun 27, 2023
1f6b2c9
Use tahoe-idp 2.4.3 (test fixes)
bryanlandia Jun 28, 2023
e5779cc
Merge pull request #1349 from appsembler/bugfix/use-tahoe-idp-2.4.3
bryanlandia Jun 28, 2023
18c2c99
Use tahoe-idp 2.4.4
bryanlandia Jun 29, 2023
39e9720
Merge pull request #1351 from appsembler/bugfix/use-tahoe-idp-2.4.4
bryanlandia Jun 29, 2023
9b072a4
Use tahoe-idp 2.5.0
bryanlandia Jun 30, 2023
4dcd91f
Merge pull request #1352 from appsembler/chore/use-tahoe-idp-2.5.0
bryanlandia Jun 30, 2023
3a612fc
Update to tahoe_idp 2.5.1 bugfix release for Django superusers
bryanlandia Jul 3, 2023
bdf22f6
Merge pull request #1353 from appsembler/bugfix/use-tahoe-idp-2.5.1
bryanlandia Jul 4, 2023
e2e2f4e
Fix domain for video block LMS Root used for YT metadata
bryanlandia Jul 6, 2023
f45e0e0
Merge pull request #1356 from appsembler/bugfix/video-block-yt-metada…
bryanlandia Jul 6, 2023
b82e8c8
filter prereq course list by org for Global Staff users
bryanlandia Jul 13, 2023
65c5355
Increase YouTube TEST_TIMEOUT to 2.5s
bryanlandia Jul 14, 2023
386de8e
Merge pull request #1359 from appsembler/chore/ENG-97-increase-yt--ap…
bryanlandia Jul 14, 2023
b6fcd12
Merge pull request #1358 from appsembler/bugfix/ENG-183-schedule-deta…
bryanlandia Jul 14, 2023
4d0c936
Catch and retry video module YT IFrame API ready errs
bryanlandia Jul 20, 2023
b1b3621
additional console error msg for window.onYouTubeIframeAPIReady err
bryanlandia Jul 20, 2023
ea61433
Merge pull request #1361 from appsembler/bugfix/ENG-97-catch-and-retr…
bryanlandia Jul 20, 2023
8d0793e
Use tahoe-idp 2.6.0
bryanlandia Aug 23, 2023
96ff911
Merge pull request #1363 from appsembler/feat/tahoe-idp-2.6.0
bryanlandia Aug 24, 2023
ed5f472
Update Segment url intercepts for fetch-based Segment js API
bryanlandia Aug 29, 2023
089d68f
Merge pull request #1365 from appsembler/bugfix/fix-segment-replicati…
bryanlandia Aug 29, 2023
c3da2d9
Update messageId format for faked analytics.js event call
bryanlandia Aug 29, 2023
b87dee6
Merge pull request #1367 from appsembler/bugfix/update-segment-events…
bryanlandia Aug 29, 2023
edadd6d
Use edx-sga 0.22.0 via appsembler.txt reqs
bryanlandia Aug 29, 2023
7a8ccab
Merge pull request #1368 from appsembler/bugfix/requirements-use-patc…
bryanlandia Aug 29, 2023
8a4dfa4
wrap most of the onYouTubeIframeAPIReady function in try/catch
bryanlandia Sep 13, 2023
d5e0929
Allow up to 5 retries on onYouTubeIframeAPIReady func calls
bryanlandia Sep 13, 2023
6bb24a6
Add a 500ms delay before retrying onYouTubeIframeAPIReady
bryanlandia Sep 13, 2023
6e7a3ef
Merge pull request #1370 from appsembler/bugfix/ENG-97-catch-and-retr…
bryanlandia Sep 14, 2023
46a894d
Refactor try/catch on window.onYouTubeIframeAPIReady.resolve
bryanlandia Sep 14, 2023
10f8d48
Revert to edx-sga v0.11.0 Appsembler fork
bryanlandia Sep 15, 2023
d1f19b3
Upgrade edx-sga to v0.12.0
bryanlandia Sep 15, 2023
694ab74
Merge pull request #1374 from appsembler/bugfix/revert-edadd6d-edx-sg…
bryanlandia Sep 15, 2023
f71fe91
Merge branch 'main' into feat/edx-sga-to-v.0.12.0
bryanlandia Sep 15, 2023
6eaa2e3
Merge pull request #1375 from appsembler/feat/edx-sga-to-v.0.12.0
bryanlandia Sep 15, 2023
460a6fa
Merge pull request #1371 from appsembler/bugfix/ENG-97-catch-and-retr…
bryanlandia Sep 18, 2023
a42d93f
Attempt at small rework of setupOnYouTubeIframeAPIReady and Deferred …
bryanlandia Sep 19, 2023
88eb438
Remove newer error handling code and try simple fix
bryanlandia Sep 19, 2023
97a3e4d
Merge pull request #1379 from appsembler/bugfix/ENG-97-rework-onytifr…
bryanlandia Sep 20, 2023
e98d4ab
Fix: Handle Request objects in Segment fetch override
amirtds Nov 14, 2023
17ec2c0
chore: log the type of resource passed to replaceFetchResourceForSegm…
amirtds Nov 14, 2023
e5071ec
chore: log warning instead of error for replaceFetchResourceForSegmen…
amirtds Nov 14, 2023
eab140a
chore: handle URL objects for replaceFetchResourceForSegmentSite
amirtds Nov 14, 2023
ff169a3
Merge pull request #1382 from appsembler/fix/segment-fetch-interception
amirtds Nov 14, 2023
1891f4b
fix: Arabic translation placeholders in progress page
amirtds Nov 17, 2023
28452ab
Merge pull request #1385 from appsembler/fix/arabic-translation-place…
amirtds Nov 21, 2023
e3ef74d
use temp Overhangio fork of py2neo
bryanlandia Dec 12, 2023
8cc1918
use py2neo-history package on PyPI to get older release
bryanlandia Dec 14, 2023
d066909
Merge pull request #1387 from appsembler/bugfix/py2neo-eol
bryanlandia Dec 14, 2023
a1d67c8
Sync Dockerfile.tutor with latest server-vars.yml for Tahoe prod
bryanlandia Jan 2, 2024
8ee7fb4
Merge pull request #1388 from appsembler/chore/dockerfile-sync-configs
bryanlandia Jan 2, 2024
3022eb7
feat: Add Mandrill Subaccount support
amirtds Jan 27, 2024
2de42bd
Merge pull request #1396 from appsembler/feat/add-mandrill-subaccount…
amirtds Jan 29, 2024
b131eb0
Add sanitize function for redirect parameter next
Jul 2, 2024
96c39fa
Change upstream_repo variable to actual value
Jul 15, 2024
da69fb9
Add trusted host workaround for tests workflow
Jul 16, 2024
0e8250f
Merge pull request #1405 from appsembler/fix/fix-workflow-configurations
VladyslavTy Jul 16, 2024
d60f315
Merge branch 'main' into vladyslav/add-sanitize-next-parameter-helper
Jul 16, 2024
452e1b9
Merge pull request #1401 from appsembler/vladyslav/add-sanitize-next-…
VladyslavTy Jul 16, 2024
bc998c9
Improve the sanitize_next_parameter method with handling new cases
Jul 19, 2024
7b5c7c1
Fix sync_prod_with_main workflow
Jul 22, 2024
cd7be06
Merge pull request #1407 from appsembler/vladyslav/improve-sanitize-u…
VladyslavTy Jul 22, 2024
878af3c
Add handler of iframe rendering
Aug 13, 2024
9c2f374
Fix typo in footer classname
Aug 14, 2024
6290527
Merge pull request #1409 from appsembler/vladyslav/hide-html-elements…
VladyslavTy Aug 14, 2024
a7c6b5f
Refactor event to hide elements
Aug 16, 2024
71f0978
Add hide_elements parameter that determine if we need to hide the htm…
Aug 16, 2024
3914714
Merge pull request #1411 from appsembler/vladyslav/hide-html-elements…
VladyslavTy Aug 19, 2024
a68fc7a
Set cookie value ror hideElements before redirect
Aug 21, 2024
1a89bd3
Merge pull request #1412 from appsembler/vladyslav/hide-html-elements…
VladyslavTy Aug 22, 2024
4efbe09
Add hide_elements to allowed post auth parameters
Aug 23, 2024
a45bf9b
Merge pull request #1414 from appsembler/vladyslav/hide-html-elements…
VladyslavTy Aug 23, 2024
27d9bd4
Add function add_hide_elements_cookie_to_redirect to set hideElements…
Aug 27, 2024
1e3bded
Merge pull request #1416 from appsembler/vladyslav/hide-html-elements…
VladyslavTy Aug 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cms/static/js/certificates/models/certificate.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ define([
initialize: function(attributes, options) {
// Set up the initial state of the attributes set for this model instance
this.canBeEmpty = options && options.canBeEmpty;
if (options.add) {
if (options.add && !attributes.signatories) {
// Ensure at least one child Signatory model is defined for any new Certificate model
attributes.signatories = new SignatoryModel({certificate: this});
}
Expand Down
23 changes: 0 additions & 23 deletions openedx/core/djangoapps/appsembler/auth/course_roles.py

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def plugin_settings(settings):
# from the redirect mechanics.
settings.MAIN_SITE_REDIRECT_ALLOWLIST = [
'/api/',
'/user_api/', # still used by EdxRestAPIClient in integrations
'/admin',
'oauth', # TODO: Add slashes during Nutmeg upgrade since this requires a lot of QA
'status', # TODO: Add slashes during Nutmeg upgrade since this requires a lot of QA
Expand Down
56 changes: 56 additions & 0 deletions openedx/core/djangoapps/appsembler/tahoe_idp/course_roles.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
"""
Tahoe Authentication helpers for managing course related roles.
"""

from common.djangoapps.student.roles import (
CourseCreatorRole,
OrgRole,
OrgStaffRole,
register_access_role,
)


def update_organization_staff_roles(
user,
organization_short_name,
set_as_course_author=False,
set_as_organization_staff=False,
):
"""
Update the organization-wide OrgStaffRole/CourseCreatorRole for using Studio and instructor dashboards.
"""
assert user, 'Parameter `user` is required.'
assert organization_short_name, 'Parameter `organization_short_name` is required.'

organization_role = OrgStaffRole(organization_short_name)
course_author_role = TahoeCourseAuthorRole(organization_short_name)
creator_role = CourseCreatorRole()

if set_as_organization_staff or set_as_course_author:
# Both org-wide staff and limited course author can create courses.
creator_role.add_users(user)
else:
creator_role.remove_users(user)

if set_as_organization_staff:
organization_role.add_users(user)
else:
organization_role.remove_users(user)

if set_as_course_author:
course_author_role.add_users(user)
else:
course_author_role.remove_users(user)


@register_access_role
class TahoeCourseAuthorRole(OrgRole):
"""
A limited course access role to allow Studio access without having a course.

A user with this role needs to be explicitly invited to a course.
"""
ROLE = 'tahoe_course_author'

def __init__(self, *args, **kwargs):
super().__init__(self.ROLE, *args, **kwargs)
23 changes: 14 additions & 9 deletions openedx/core/djangoapps/appsembler/tahoe_idp/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,6 @@
import third_party_auth
from third_party_auth.pipeline import running as pipeline_running


from .constants import (
TAHOE_IDP_BACKEND_NAME,
TAHOE_IDP_PROVIDER_NAME,
)

from student.roles import (
CourseAccessRole,
CourseCreatorRole,
Expand All @@ -33,6 +27,14 @@
from tahoe_idp import api as tahoe_idp_api


from .constants import (
TAHOE_IDP_BACKEND_NAME,
TAHOE_IDP_PROVIDER_NAME,
)

from .course_roles import TahoeCourseAuthorRole


def is_tahoe_idp_enabled():
"""
Tahoe: Check if tahoe-idp package is enabled for the current site (or cluster-wide).
Expand Down Expand Up @@ -148,7 +150,7 @@ def is_studio_allowed_for_user(user, organization=None):
OR the user is staff user
OR the user is an admin on the organization
OR the user has deprecated_has_course_specific_role()
OR the user has (OrgStaffRole) or (OrgInstructorRole) role
OR the user has (OrgStaffRole) or (OrgInstructorRole) or (TahoeCourseAuthorRole) role

:param user: the user in question
:param organization: the user's organization. If the user is not super admin or staff, this value will be used
Expand All @@ -168,9 +170,12 @@ def is_studio_allowed_for_user(user, organization=None):
return True

short_name = organization.short_name
has_org_wide_role = OrgStaffRole(short_name).has_user(user) or OrgInstructorRole(short_name).has_user(user)

return has_org_wide_role
for org_wide_role in [OrgStaffRole, OrgInstructorRole, TahoeCourseAuthorRole]:
if org_wide_role(short_name).has_user(user):
return True

return False


def is_studio_login_form_overridden():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from student.tests.factories import UserFactory

from .. import course_roles
from openedx.core.djangoapps.appsembler.tahoe_idp import course_roles


@pytest.mark.django_db
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import tahoe_sites.api

from common.djangoapps.student.roles import CourseCreatorRole, OrgStaffRole
from ..course_roles import TahoeCourseAuthorRole
from ..tpa_pipeline import tahoe_idp_user_updates

from openedx.core.djangoapps.site_configuration.tests.factories import SiteFactory
Expand Down Expand Up @@ -37,40 +38,58 @@ def test_tahoe_idp_step_in_settings():
assert idp_step_index == force_sync_step_index + 1, 'Tahoe IdP step should be right after `user_details_force_sync`'


@pytest.mark.parametrize('user_details,should_be_admin,should_be_staff,message', [
(
{
@pytest.mark.parametrize('test_case', [
{
'user_details': {
'tahoe_idp_is_organization_admin': False,
'tahoe_idp_is_organization_staff': False,
'tahoe_idp_is_course_author': False,
'tahoe_idp_metadata': {'field': 'some value'},
},
False,
False,
'Check for learner',
),
(
{
'should_be_admin': False,
'should_be_staff': False,
'should_be_author': False,
'message': 'Check for learner',
},
{
'user_details': {
'tahoe_idp_is_organization_admin': False,
'tahoe_idp_is_organization_staff': True,
'tahoe_idp_is_course_author': False,
'tahoe_idp_metadata': {'field': 'some value'},
},
False,
True,
'Check for Studio',
),
(
{
'should_be_admin': False,
'should_be_staff': True,
'should_be_author': False,
'message': 'Check for Studio',
},
{
'user_details': {
'tahoe_idp_is_organization_admin': True,
'tahoe_idp_is_organization_staff': True,
'tahoe_idp_is_course_author': False,
'tahoe_idp_metadata': {'field': 'some value'},
},
True,
True,
'Check for Admins',
),
'should_be_admin': True,
'should_be_staff': True,
'should_be_author': False,
'message': 'Check for Admins',
},
{
'user_details': {
'tahoe_idp_is_organization_admin': False,
'tahoe_idp_is_organization_staff': False,
'tahoe_idp_is_course_author': True,
'tahoe_idp_metadata': {'field': 'some value'},
},
'should_be_admin': False,
'should_be_staff': False,
'should_be_author': True,
'message': 'Check for Course Authors',
},
])
@pytest.mark.django_db
def test_tahoe_idp_roles_step_roles(user_details, should_be_admin, should_be_staff, message):
def test_tahoe_idp_roles_step_roles(test_case):
"""
Tests for happy scenarios of the `tahoe_idp_user_updates` step.
"""
Expand All @@ -88,15 +107,18 @@ def test_tahoe_idp_roles_step_roles(user_details, should_be_admin, should_be_sta
tahoe_idp_user_updates(
auth_entry=None,
strategy=strategy,
details=user_details,
details=test_case['user_details'],
user=user,
)

org_role = OrgStaffRole(organization.short_name)
tahoe_author_role = TahoeCourseAuthorRole(organization.short_name)
creator_role = CourseCreatorRole()
assert org_role.has_user(user) == should_be_staff, message
assert creator_role.has_user(user) == should_be_staff, message
assert tahoe_sites.api.is_active_admin_on_organization(user, organization) == should_be_admin, message
message = test_case['message']
should_be_course_creator = test_case['should_be_staff'] or test_case['should_be_author']
assert org_role.has_user(user) == test_case['should_be_staff'], message
assert creator_role.has_user(user) == should_be_course_creator, message
assert tahoe_author_role.has_user(user) == test_case['should_be_author'], message
assert tahoe_sites.api.is_active_admin_on_organization(user, organization) == test_case['should_be_admin'], message
assert user.profile.get_meta() == {'tahoe_idp_metadata': {'field': 'some value'}}
mock_update_tahoe_user_id.assert_called_once_with(user)

Expand Down
5 changes: 3 additions & 2 deletions openedx/core/djangoapps/appsembler/tahoe_idp/tpa_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@
import beeline
import tahoe_sites.api

from openedx.core.djangoapps.appsembler.auth import course_roles

from tahoe_idp import api as tahoe_idp_api

from . import course_roles
from .helpers import store_idp_metadata_in_user_profile

from .constants import TAHOE_IDP_BACKEND_NAME

log = logging.getLogger(__name__)
Expand All @@ -38,6 +37,7 @@ def tahoe_idp_user_updates(auth_entry, strategy, details, user=None, *args, **kw
if user and backend_name == TAHOE_IDP_BACKEND_NAME:
set_as_admin = details['tahoe_idp_is_organization_admin']
set_as_organization_staff = details['tahoe_idp_is_organization_staff']
set_as_course_author = details['tahoe_idp_is_course_author']

organization = tahoe_sites.api.get_current_organization(strategy.request)

Expand All @@ -53,6 +53,7 @@ def tahoe_idp_user_updates(auth_entry, strategy, details, user=None, *args, **kw
course_roles.update_organization_staff_roles(
user=user,
organization_short_name=organization_short_name,
set_as_course_author=set_as_course_author,
set_as_organization_staff=set_as_organization_staff,
)

Expand Down
2 changes: 1 addition & 1 deletion requirements/edx/appsembler.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ https://github.com/appsembler/edx-proctoring/archive/v2.4.0-appsembler1.tar.gz
django-tiers==0.2.7
fusionauth-client==1.36.0
google-cloud-storage==1.32.0
tahoe-idp==2.0.0
tahoe-idp==2.1.0
tahoe-sites==1.3.2
tahoe-lti==0.3.0
site-configuration-client==0.2.3
Expand Down