Skip to content

feat: per-user secured Algolia API keys [BB-8083] - #11

Merged
Agrendalath merged 1 commit into
opencraft-release/palm.1from
0x29a/bb8083/per-user-algolia-key
Nov 21, 2023
Merged

feat: per-user secured Algolia API keys [BB-8083]#11
Agrendalath merged 1 commit into
opencraft-release/palm.1from
0x29a/bb8083/per-user-algolia-key

Conversation

@0x29a

@0x29a 0x29a commented Nov 10, 2023

Copy link
Copy Markdown

Description

Adds a new endpoint that generates a secured Algolia API key capable of retrieving only data that is associated with enterprises linked to a requesting user. This is useful when you want to isolate enterprise learners, so they can't modify underlying Algolia requests to fetch the whole index content.

Testing steps

See open-craft/frontend-app-learner-portal-enterprise#1

Upstream PR

openedx#1962

Comment thread enterprise/api/v1/views.py
@0x29a
0x29a force-pushed the 0x29a/bb8083/per-user-algolia-key branch 2 times, most recently from b0a1b23 to 4d582c2 Compare November 14, 2023 16:02
@0x29a 0x29a changed the title feat: per-user secured Algolia API keys feat: per-user secured Algolia API keys [BB-8083] Nov 14, 2023

@CefBoud CefBoud 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.

LGTM ✅

  • I tested this
  • I read through the code
  • Includes tests

@Agrendalath Agrendalath left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

👍

  • I tested this: in open-craft/frontend-app-learner-portal-enterprise#1
  • I read through the code
  • I checked for accessibility issues: n/a
  • Includes documentation: n/a
  • I made sure any change in configuration variables is reflected in the corresponding client's configuration-secure repository: n/a

Comment thread enterprise/api/v1/views.py Outdated
Comment thread enterprise/api/v1/views.py Outdated
Comment thread enterprise/api/v1/views.py
Comment thread enterprise/api/v1/views.py Outdated
Comment thread enterprise/api/v1/views.py Outdated
Comment on lines +532 to +533
Returns an Algolia API key that is secured to only allow searching for
objects associated with enterprise customers that the user is linked to.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Would it make sense to mention that we use this in the frontend-app-learner-portal-enterprise?

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.

Done 👍


username = 'test_learner_portal_user'
self.create_user(username=username, is_staff=False)
self.client.login(username=username, password=TEST_PASSWORD)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nit: could you please add an assert for the AnonymousUser (i.e., before we log in)?

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.

Done 👍

Comment thread enterprise/api/v1/views.py Outdated
@0x29a
0x29a force-pushed the 0x29a/bb8083/per-user-algolia-key branch from b74eb6f to 87c69f5 Compare November 17, 2023 13:10
Co-authored-by: Piotr Surowiec <piotr@surowiec.it>
@0x29a
0x29a force-pushed the 0x29a/bb8083/per-user-algolia-key branch from 87c69f5 to 3c9c3dc Compare November 17, 2023 13:14
@Agrendalath
Agrendalath merged commit f538e88 into opencraft-release/palm.1 Nov 21, 2023
@Agrendalath
Agrendalath deleted the 0x29a/bb8083/per-user-algolia-key branch November 21, 2023 23:09
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