Skip to content

Conversation

@sjasti-sonata-svg
Copy link

Merge checklist:

  • Any new requirements are in the right place (do not manually modify the requirements/*.txt files)
    • base.in if needed in production but edx-platform doesn't install it
    • test-master.in if edx-platform pins it, with a matching version
    • make upgrade && make requirements have been run to regenerate requirements
  • make static has been run to update webpack bundling if any static content was updated
  • ./manage.py makemigrations has been run
    • Checkout the Database Migration Confluence page for helpful tips on creating migrations.
    • Note: This must be run if you modified any models.
      • It may or may not make a migration depending on exactly what you modified, but it should still be run.
    • This should be run from either a venv with all the lms/edx-enterprise requirements installed or if you checked out edx-enterprise into the src directory used by lms, you can run this command through an lms shell.
      • It would be ./manage.py lms makemigrations in the shell.
  • Version bumped
  • Changelog record added
  • Translations updated (see docs/internationalization.rst but also this isn't blocking for merge atm)

Post merge:

  • Tag pushed and a new version released
    • Note: Assets will be added automatically. You just need to provide a tag (should match your version number) and title and description.
  • After versioned build finishes in GitHub Actions, verify version has been pushed to PyPI
    • Each step in the release build has a condition flag that checks if the rest of the steps are done and if so will deploy to PyPi.
      (so basically once your build finishes, after maybe a minute you should see the new version in PyPi automatically (on refresh))
  • PR created in edx-platform to upgrade dependencies (including edx-enterprise)
    • Trigger the 'Upgrade one Python dependency' action against master in edx-platform with new version number to generate version bump PR
    • This must be done after the version is visible in PyPi as make upgrade in edx-platform will look for the latest version in PyPi.
    • Note: the edx-enterprise constraint in edx-platform must also be bumped to the latest version in PyPi.

@sjasti-sonata-svg
Copy link
Author

This is the ticket :
ENT-11235
Description:
We need to support new metadata for admins, including tracking when an admin was invited and when they joined. Review the existing admin table and ensure new fields do not break existing APIs.

Copy link
Contributor

@kiram15 kiram15 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused as to why we are changing fields in the EnterpriseCustomerUser table. When you are going to pull all the admins for the new admin DataTable, we should not be going through a list of the EnterpriseCustomerUsers, but rather another table of all the admins. As I said in the comment, I think the best approach would be adding the invited_date and joined_date fields to EnterpriseCustomerAdmin table, and then plan to pull in the (relevant, non-onboarding tour) information for the DataTable y'all will be creating.

I also think that whenever we're adding new fields, its good to include in the PR how they will be getting populated. Here is how EnterpriseCustomerAdmins are currently created (in a post_save django signal where an "enterprise_admin" system-wide role is assigned to the user). I'm assuming the plan is to have the invited_date be when the PendingEnterpriseCustomerAdminUser record is created, and then a joined_date be populated if/when the EnterpriseCustomerAdmin record is created, but in order for me to review these fields, I need to know more information about these dates.

@kiram15 kiram15 self-requested a review December 24, 2025 00:42
@kiram15 kiram15 dismissed their stale review December 24, 2025 00:42

Don't want to block this PR before I go on vacation

model_name="enterprisecustomeradmin",
name="invited_date",
field=models.DateTimeField(
blank=True, help_text="Timestamp when the admin was invited.", null=True
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: have these all on different lines for readability

blank=True,
help_text="Timestamp when the admin was invited."
)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: remove line on 5019


def is_enterprise_customer_user(self, obj):
return hasattr(obj, 'user_id') and obj.user_id > 0
return bool(obj.user_id)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we changing this? And I don't see it getting used anywhere?

).count()
instance.display_name = f'SSO-config-{instance.identity_provider}-{num_records_for_customer + 1}'

@receiver(post_save, sender=EnterpriseCustomerAdmin)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also have a test to make sure this signal is working correctly and validating the invited and joined dates, here is the test_signals file where it would be.

Comment on lines +460 to +464
# Attempt to backfill invitation metadata
pending_invite = PendingEnterpriseCustomerAdminUser.objects.filter(
enterprise_customer=instance.enterprise_customer_user.enterprise_customer,
user_email=instance.enterprise_customer_user.user_email,
).order_by("-invited_date").first()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

echoing Alex's question as I have the same concern. Do PendingEnterpriseCustomerAdminUser records get deleted? If so, will this PendingEnterpriseCustomerAdminUser instance exist at execution time of this hook?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, they are deleted but not before this signal in normal flows.

@pwnage101
Copy link
Contributor

Before merging, please squash your commits to only one commit and use a more descriptive title, such as "feat: add date fields to track enterprise user invitation lifecycle". Please also change the title of this PR to match that more descriptive title.

@sjasti-sonata-svg sjasti-sonata-svg force-pushed the feat/admin-invite-metadata-ENT-11235 branch from 3e7863b to 38bf777 Compare January 7, 2026 06:30
…and add invitation lifecycle fields

- Fixed the invited_date signal handling for EnterpriseCustomerAdmin
- Updated related models and signals
- Added date fields to track enterprise user invitation lifecycle
@sjasti-sonata-svg sjasti-sonata-svg force-pushed the feat/admin-invite-metadata-ENT-11235 branch from 0cda236 to dc95ac2 Compare January 7, 2026 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants