Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4
- uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4
with:
node-version: "^20"
cache: yarn
Expand Down Expand Up @@ -207,7 +207,7 @@ jobs:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4

- uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4
- uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4
with:
node-version: "^20"
cache: yarn
Expand All @@ -230,7 +230,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4
- uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4
with:
node-version: "^20"
cache: yarn
Expand Down Expand Up @@ -269,7 +269,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4
- uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4
with:
node-version: "^20"
cache: yarn
Expand Down Expand Up @@ -305,7 +305,7 @@ jobs:
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4

- uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4
- uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4
with:
node-version: "^20"
cache: yarn
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4

- uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4
- uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4
with:
node-version: "^20"
cache: yarn
Expand Down
14 changes: 14 additions & 0 deletions authentication/backends/ol_open_id_connect.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,17 @@ class OlOpenIdConnectAuth(OpenIdConnectAuth):
"""

name = "ol-oidc"

def get_user_details(self, response):
"""Get the user details from the API response"""
details = super().get_user_details(response)

return {
**details,
"profile": {
"name": response.get("name", ""),
"email_optin": bool(int(response["email_optin"]))
if "email_optin" in response
else None,
},
}
2 changes: 1 addition & 1 deletion authentication/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class AuthenticationHooks:
"""Pluggy hooks specs for authentication"""

@hookspec
def user_created(self, user):
def user_created(self, user, user_data):
"""Trigger actions after a user is created"""


Expand Down
7 changes: 5 additions & 2 deletions authentication/pipeline/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from social_core.exceptions import AuthException

from authentication.hooks import get_plugin_manager
from profiles import api as profile_api


def forbid_hijack(
Expand All @@ -23,14 +24,16 @@ def forbid_hijack(
return {}


def user_created_actions(**kwargs):
def user_created_actions(*, user, details, **kwargs):
"""
Trigger plugins when a user is created
"""
if kwargs.get("is_new"):
pm = get_plugin_manager()
hook = pm.hook
hook.user_created(user=kwargs["user"])
hook.user_created(user=user, user_data=details)
else:
profile_api.ensure_profile(user=user, profile_data=details.get("profile", {}))


def user_onboarding(*, backend, **kwargs):
Expand Down
1 change: 1 addition & 0 deletions authentication/pipeline/user_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def test_user_created_actions(mocker, is_new):
kwargs = {
"user": user,
"is_new": is_new,
"details": {},
}

user_actions.user_created_actions(**kwargs)
Expand Down
44 changes: 22 additions & 22 deletions frontends/ol-ckeditor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,28 @@
"react": "18.3.1"
},
"dependencies": {
"@ckeditor/ckeditor5-adapter-ckfinder": "^42.0.0",
"@ckeditor/ckeditor5-autoformat": "^42.0.0",
"@ckeditor/ckeditor5-basic-styles": "^42.0.0",
"@ckeditor/ckeditor5-block-quote": "^42.0.0",
"@ckeditor/ckeditor5-cloud-services": "^42.0.0",
"@ckeditor/ckeditor5-core": "^42.0.0",
"@ckeditor/ckeditor5-dev-translations": "^43.0.0",
"@ckeditor/ckeditor5-dev-utils": "^43.0.0",
"@ckeditor/ckeditor5-easy-image": "^42.0.0",
"@ckeditor/ckeditor5-editor-classic": "^42.0.0",
"@ckeditor/ckeditor5-essentials": "^42.0.0",
"@ckeditor/ckeditor5-heading": "^42.0.0",
"@ckeditor/ckeditor5-image": "^42.0.0",
"@ckeditor/ckeditor5-link": "^42.0.0",
"@ckeditor/ckeditor5-list": "^42.0.0",
"@ckeditor/ckeditor5-markdown-gfm": "^42.0.0",
"@ckeditor/ckeditor5-media-embed": "^42.0.0",
"@ckeditor/ckeditor5-paragraph": "^42.0.0",
"@ckeditor/ckeditor5-react": "^9.0.0",
"@ckeditor/ckeditor5-theme-lark": "^42.0.0",
"@ckeditor/ckeditor5-ui": "^42.0.0",
"@ckeditor/ckeditor5-utils": "^42.0.0",
"@ckeditor/ckeditor5-adapter-ckfinder": "^43.0.0",
"@ckeditor/ckeditor5-autoformat": "^43.0.0",
"@ckeditor/ckeditor5-basic-styles": "^43.0.0",
"@ckeditor/ckeditor5-block-quote": "^43.0.0",
"@ckeditor/ckeditor5-cloud-services": "^43.0.0",
"@ckeditor/ckeditor5-core": "^43.0.0",
"@ckeditor/ckeditor5-dev-translations": "^40.0.0",
"@ckeditor/ckeditor5-dev-utils": "^40.0.0",
"@ckeditor/ckeditor5-easy-image": "^43.0.0",
"@ckeditor/ckeditor5-editor-classic": "^43.0.0",
"@ckeditor/ckeditor5-essentials": "^43.0.0",
"@ckeditor/ckeditor5-heading": "^43.0.0",
"@ckeditor/ckeditor5-image": "^43.0.0",
"@ckeditor/ckeditor5-link": "^43.0.0",
"@ckeditor/ckeditor5-list": "^43.0.0",
"@ckeditor/ckeditor5-markdown-gfm": "^43.0.0",
"@ckeditor/ckeditor5-media-embed": "^43.0.0",
"@ckeditor/ckeditor5-paragraph": "^43.0.0",
"@ckeditor/ckeditor5-react": "^7.0.0",
"@ckeditor/ckeditor5-theme-lark": "^43.0.0",
"@ckeditor/ckeditor5-ui": "^43.0.0",
"@ckeditor/ckeditor5-utils": "^43.0.0",
"axios": "^1.6.3",
"classnames": "^2.3.2",
"ol-components": "0.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ const CheckboxChoiceField: React.FC<CheckboxChoiceFieldProps> = ({
const isChecked = (choice: CheckboxProps) =>
choice.value ? (values?.includes(choice.value) ?? false) : false
const _Container = vertical ? VerticalContainer : Container

return (
<FormControl
component="fieldset"
Expand Down
3 changes: 2 additions & 1 deletion learning_resources/plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ class FavoritesListPlugin:
hookimpl = apps.get_app_config("authentication").hookimpl

@hookimpl
def user_created(self, user):
def user_created(self, user, user_data): # noqa: ARG002
"""
Perform functions on a newly created user

Args:
user(User): The user to create the list for
user_data(dict): the user data
"""
UserList.objects.get_or_create(
author=user, title=FAVORITES_TITLE, defaults={"description": "My Favorites"}
Expand Down
2 changes: 1 addition & 1 deletion learning_resources/plugins_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ def test_favorites_plugin_user_created(existing_list):
UserListFactory.create(
author=user, title=FAVORITES_TITLE, description="My Favorites"
)
FavoritesListPlugin().user_created(user)
FavoritesListPlugin().user_created(user, user_data={})
user.refresh_from_db()
assert user.user_lists.count() == 1
8 changes: 6 additions & 2 deletions main/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,9 @@
"documentationUri": "",
},
],
"USER_ADAPTER": "profiles.adapters.SCIMProfile",
"USER_MODEL_GETTER": "profiles.adapters.get_user_model_for_scim",
"USER_ADAPTER": "profiles.scim.adapters.LearnSCIMUser",
"USER_MODEL_GETTER": "profiles.scim.adapters.get_user_model_for_scim",
"USER_FILTER_PARSER": "profiles.scim.filters.LearnUserFilterQuery",
}


Expand Down Expand Up @@ -297,6 +298,9 @@
),
urlparse(APP_BASE_URL).netloc,
]
SOCIAL_AUTH_PROTECTED_USER_FIELDS = [
"profile", # this avoids an error because profile is a related model
]

SOCIAL_AUTH_PIPELINE = (
# Checks if an admin user attempts to login/register while hijacking another user.
Expand Down
Loading
Loading