Skip to content

Add owner for media only for User auth #74

@DenTray

Description

@DenTray

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_model type, the media item's owner_id is set to the authenticated user's ID.

  • When the authenticated user is of a different type, owner_id is not set.

  • Changing the auth.providers config 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.providers to use the default User model and create media as that user; verify owner_id equals Auth::id().

  • Change auth.providers to a different user model that differs from media.classes.user_model; create media and ensure owner_id is null or unset.

  • Validate that no errors occur during media creation in either configuration.

  • Ensure no debug information or errors appear in the console.


Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions