Skip to content

Add working contract preferences to user when setting for the first time from API#5894

Open
viggou wants to merge 5 commits into
kimai:mainfrom
viggou:update-user-api-contracts
Open

Add working contract preferences to user when setting for the first time from API#5894
viggou wants to merge 5 commits into
kimai:mainfrom
viggou:update-user-api-contracts

Conversation

@viggou
Copy link
Copy Markdown

@viggou viggou commented Apr 10, 2026

Description

This pull request allows the public API to add preferences to users if they haven't been set before in the web ui. Fixes this issue #5751

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • I verified that my code applies to the guidelines (composer code-check)
  • I updated the documentation (see here)
  • I agree that this code is used in Kimai (see license)

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 10, 2026

CLA assistant check
All committers have signed the CLA.

@viggou viggou force-pushed the update-user-api-contracts branch from 8ae9d26 to a9ad67e Compare April 10, 2026 10:40
@kevinpapst
Copy link
Copy Markdown
Member

Thanks for trying to solve the issue.
I'd like to see a more generic approach. Maybe via Event, not sure yet.

@viggou viggou closed this Apr 13, 2026
@viggou viggou force-pushed the update-user-api-contracts branch from a9ad67e to 1670308 Compare April 13, 2026 09:10
@viggou viggou reopened this Apr 13, 2026
@viggou
Copy link
Copy Markdown
Author

viggou commented Apr 13, 2026

I've created a new EventSubscriber which adds the work contract preferences. I'm not sure if you want them in UserPreferenceSubscriber instead? What do you think?

@kevinpapst
Copy link
Copy Markdown
Member

Make it even more generic: something like a RegisterDefaultUserPreferences which only receives a User.
Then add a listener that adds the WorkContract related values to the given User.

@viggou
Copy link
Copy Markdown
Author

viggou commented Apr 13, 2026

Alright, I added a RegisterUserPreferencesEvent, which only takes user and I've kept the WorkContractPreferenceSubscriber as the listener. The new event is dispatched by UserPreferenceSubscriber.

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