Skip to content

Ab/hide solution content #2249

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

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft

Ab/hide solution content #2249

wants to merge 7 commits into from

Conversation

abeglova
Copy link
Contributor

@abeglova abeglova commented May 14, 2025

What are the relevant tickets?

closes https://github.com/mitodl/hq/issues/6459

Description (What does it do?)

This pr updates the content file apis to

  1. Only show the content field in the /api/v1/contentfiles api to users who are staff admins or have content file viewer permissions. Anonymous and normal users can still access the api but do not see the content field
  2. Update the /api/v1/content_file_search api to not display the content, summary or flashcard. Those fields are still in the index and used for search
  3. Update /api/v0/vector_content_files_search to require admin or content file viewer permissions

How can this be tested?

  1. Make sure you are not logged in
    go to http://open.odl.local:8065/api/v1/contentfiles/ you should not see the "content" field in the results
    go to http://open.odl.local:8065/api/v1/contentfiles/ you should not see the "content" field in the results

go to http://api.open.odl.local:8065/api/v1/content_file_search/ you should not see "content" in the results

go to http://api.open.odl.local:8065/api/v0/vector_content_files_search/ your should get a NotAuthenticated page

  1. Log in as a normal user
    go to http://open.odl.local:8065/api/v1/contentfiles/ you should not see the "content" field in the results
    go to http://open.odl.local:8065/api/v1/contentfiles/ you should not see the "content" field in the results

go to http://api.open.odl.local:8065/api/v1/content_file_search/ you should not see "content" in the results

go to http://api.open.odl.local:8065/api/v0/vector_content_files_search/ your should get a PermissionDenied page

  1. Log in as an admin
    go to http://open.odl.local:8065/api/v1/contentfiles/ you should see the "content" field in the results
    go to http://open.odl.local:8065/api/v1/contentfiles/ you should see the "content" field in the results

go to http://api.open.odl.local:8065/api/v1/content_file_search/ you should not see "content" in the results

go to http://api.open.odl.local:8065/api/v0/vector_content_files_search/ it should look normal

  1. Go to http://api.open.odl.local:8065/admin/users/user/ pick a non-admin user "http://api.open.odl.local:8065/admin/users/user/ and add "content_file_viewer" to the user groups.
    Log in as that user

go to http://open.odl.local:8065/api/v1/contentfiles/ you should see the "content" field in the results
go to http://open.odl.local:8065/api/v1/contentfiles/ you should see the "content" field in the results

go to http://api.open.odl.local:8065/api/v1/content_file_search/ you should not see "content" in the results

go to http://api.open.odl.local:8065/api/v0/vector_content_files_search/ it should look normal

  1. Follow the testing steps in Ab/test api changes for hiding content files learn-ai#192 to make sure integration with chatbots works

Copy link

github-actions bot commented May 14, 2025

OpenAPI Changes

Show/hide No detectable change.

Unexpected changes? Ensure your branch is up-to-date with main (consider rebasing).

@abeglova abeglova force-pushed the ab/hide-solution-content branch from b518117 to 5f65630 Compare May 14, 2025 13:47
@mbertrand mbertrand self-assigned this May 14, 2025
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.

2 participants