Skip to content

Offboard an AMC organization from edX - #423

Merged
iamjazzar merged 2 commits into
appsembler/tahoe/developfrom
jazzar/offboard-orgs
Mar 24, 2020
Merged

Offboard an AMC organization from edX#423
iamjazzar merged 2 commits into
appsembler/tahoe/developfrom
jazzar/offboard-orgs

Conversation

@iamjazzar

@iamjazzar iamjazzar commented Jul 9, 2019

Copy link
Copy Markdown

Background

We started this PR earlier in 2019 to help us remove a specific site from Tahoe. This step is necessary when we need to offboard a customer. However, we didn't have such a case until nw when one of our clients started working on their disaster and recovery plan.
What we are trying to achieve here, is building a tool that removes all high-level data of a specific organization. This data include high level hooks and relations (No courses, material, or logs):

  • Microsite Object.
  • Organization Object.
  • Tier Object

This PR

Here we offboard an organization through a new API from edX platform by removing its data from the system. I also fixed the broken delete_site function that's now being used to offboard organizations.

I was thinking of keeping all deleted organizations in the database, instead of removing them we can add a new field like is_active or similar, but that at the end of the day depends on the business logic, the customers we have, and how deep we are planning to go.

Steps to Reproduce

To be able to use the API, you need to

  • SSH into your LMS shell; on devstack you can use make lms-shell.
  • Run the management command python manage.py lms <domain>. If you are running this on a local machine your domain should be .localhost:18000`

Note: you can now create a website using python manage.py lms create_devstack_site <slug>

Related PRs

@iamjazzar iamjazzar changed the title Working delete site function [Don't merge yet] Working delete site function Jul 9, 2019
@iamjazzar
iamjazzar force-pushed the jazzar/offboard-orgs branch from 40ad031 to 319aafe Compare July 12, 2019 00:44
@iamjazzar iamjazzar changed the title [Don't merge yet] Working delete site function Working delete site function Jul 12, 2019
@iamjazzar iamjazzar changed the title Working delete site function Offboard an AMC organization from edX Jul 12, 2019

@OmarIthawi OmarIthawi left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

One big question: What happens to the courses and user entries? I think they will stay stray in the system.

Let's please check that first before merging this pull request. Having a test or two would be awesome!

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Is the domain unique at the database level?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Yes. The primary key for Django's Site model is the domain.

@johnbaldwin

Copy link
Copy Markdown

@AhmedAljazzar Who would be performing the call? A customer or us? cc @OmarIthawi

@OmarIthawi

Copy link
Copy Markdown

@johnbaldwin

@AhmedAljazzar Who would be performing the call? A customer or us? cc @OmarIthawi

A Tahoe infrastructure admin like me or @AhmedAljazzar

@OmarIthawi OmarIthawi changed the title Offboard an AMC organization from edX (WIP) Offboard an AMC organization from edX Feb 9, 2020
@iamjazzar
iamjazzar force-pushed the jazzar/offboard-orgs branch from 319aafe to 58d7b94 Compare March 19, 2020 10:53
@iamjazzar

Copy link
Copy Markdown
Author

@AhmedAljazzar Who would be performing the call? A customer or us? cc @OmarIthawi

@johnbaldwin every one who have SSH access to our infrastructure.

@iamjazzar iamjazzar changed the title (WIP) Offboard an AMC organization from edX Offboard an AMC organization from edX Mar 20, 2020
@iamjazzar

Copy link
Copy Markdown
Author

@OmarIthawi This is ready for another pass.

@iamjazzar

Copy link
Copy Markdown
Author

@OmarIthawi This is also ready for another pass.

@OmarIthawi
OmarIthawi self-requested a review March 20, 2020 09:46
@OmarIthawi

OmarIthawi commented Mar 23, 2020

Copy link
Copy Markdown

Same here, thank you again! I'll review it soon.

@OmarIthawi OmarIthawi left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thanks @AhmedAljazzar. Looks good to me!

Comment on lines 26 to 33

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
organization = self._check_orrganization(organization_domain)
delete_site(organization)
self.stdout.write(self.style.SUCCESS('Successfully removed site "%s"' % organization_domain))
def _check_orrganization(self, domain):
"""
Locates the organization to be deleted and return its instance.
organization = self.get_site(organization_domain)
delete_site(organization)
self.stdout.write(self.style.SUCCESS('Successfully removed site "%s"' % organization_domain))
def get_site(self, domain):
"""
Locates the site to be deleted and return its instance.

Update docs

Fix tests

Updating tests

Remove the white space

Check for theme count

Renaming
@iamjazzar
iamjazzar force-pushed the jazzar/offboard-orgs branch from 5cda9c1 to 68fb350 Compare March 24, 2020 21:31
@iamjazzar

Copy link
Copy Markdown
Author

Applied the function renaming request, and squashed the commits. Waiting for tests to pass to merge.

@iamjazzar
iamjazzar merged commit 9fc3ebc into appsembler/tahoe/develop Mar 24, 2020
@OmarIthawi
OmarIthawi deleted the jazzar/offboard-orgs branch March 25, 2020 06:27
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