harvard-lil / perma

Indelible links
417 stars 71 forks source link

Add ability to export organization user list as CSV #3556

Closed cmsetzer closed 2 months ago

cmsetzer commented 3 months ago

This adds a new view, manage_single_organization_export_user_list, which allows authorized users (admins, registrar users, organization users) to export an organization's user list as a CSV. File and column naming conventions are patterned after Perma's existing "export links to CSV" feature wherever possible. (This view also includes undocumented support for JSON output, which can be helpful for validating/troubleshooting in the browser.)

Try out the new behavior as follows:

  1. Run Perma locally from this branch
  2. Log in as an admin, registrar user, or organization user
  3. Navigate to /manage/organizations and click either of the new download buttons pointing to the export endpoint (/manage/organization-users/2/export?format=csv): image
  4. Open the downloaded CSV to view the list of organization users: image

A test is also included; run it like so:

d pytest -k "test_org_export_user_list"

To discuss with Perma team: Which of the buttons should we keep, and what additional styling is needed?

codecov[bot] commented 3 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 69.02%. Comparing base (4cf36c4) to head (d850f66). Report is 38 commits behind head on develop.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## develop #3556 +/- ## =========================================== + Coverage 68.94% 69.02% +0.08% =========================================== Files 48 48 Lines 6900 6918 +18 =========================================== + Hits 4757 4775 +18 Misses 2143 2143 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.