topcoder-platform / work-manager

This is the frontend application for creating and managing challenges.
13 stars 48 forks source link

Add Delete action to Resources tab for copilots, managers, admins #1548

Closed jmgasper closed 1 year ago

jmgasper commented 1 year ago

Expected behavior

On the Resources tab for a challenge, we will add a new column to all tables that has a delete button (this can just be the trash can icon).

When the user clicks the button, they will get a popup that says:

Are you sure you want to remove {handle} from this challenge?

Yes will remove the member No will close the popup

Deleting a resource

A resource can be deleted by DELETE to https://api.topcoder-dev.com/v5/resources

Sample body:

{
  "challengeId":"b9b5a9fb-9d74-4880-aeea-1e3fe4975739",
  "roleId":"cfe12b3f-2a24-4639-9d8b-ec86726f76bd",
  "memberHandle":"TCConnCopilot"
}

Security

The delete button and functionality should only be allowed for:

  1. Any copilot role on the challenge
  2. Any manager role on the challenge
  3. Global admins
ajefts commented 1 year ago

@jmgasper Just checking that this will do the appropriate validation to make sure that the user should be allowed to be deleted? For example, if they already have submitted then we shouldn't delete them? If they have submitted/saved a review, has a payment associated to them, is the creator of the challenge, etc?

jmgasper commented 1 year ago

@ajefts - I'll make sure we document this for QA, thanks. I'll double check that we have secondary validation in the resources API as well.

jmgasper commented 1 year ago

@ajefts - The resources API does no validation of any business logic when deleting a resource from a challenge, just FYI, so we'll enforce it in WM to be the same as OR.

ajefts commented 1 year ago

Thanks. We should probably get the API updated as well though so that other apps/integrations won't need to recreate the business logic and/or end up creating orphaned/corrupted data?

jmgasper commented 1 year ago

Yeah, agreed. I'll add that to the list. Not sure on timing with my limited budget.