-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Description
What needs to be done?
Update the media creation logic so that the owner_id field is assigned the ID of the authenticated user (Auth::id()) only if the current authenticated user is of the same type as the class specified in the media.classes.user_model configuration. Modify the auth.providers configuration to use a non-User model to test this conditional behavior.
Expected Outcome
What is the expected result?
When an authenticated user matches the
media.classes.user_modeltype, the media item'sowner_idis set to the authenticated user's ID.When the authenticated user is of a different type,
owner_idis not set.Changing the
auth.providersconfig to a non-User model properly triggers the conditional check.Media creation works correctly without errors in both cases.
Verification Scenarios
How can this be tested?
Configure
auth.providersto use the default User model and create media as that user; verifyowner_idequalsAuth::id().Change
auth.providersto a different user model that differs frommedia.classes.user_model; create media and ensureowner_idis null or unset.Validate that no errors occur during media creation in either configuration.
Ensure no debug information or errors appear in the console.