[Feature]: Expose username {{user}} for templates #538

Closed
opened 2026-02-04 21:15:14 +03:00 by OVERLORD · 4 comments
Owner

Originally created by @llitz on GitHub (Dec 31, 2022).

Feature detail

It would be good to make {{user}} available in the template configuration to enable the separation of photos better when having multiple users.

This would allow some configurations like:

{{user}}/{{y}}/{{MM}}/{{filename}}

While I have not looked at the code, implementing this should be easier than trying more complex solutions.
The more complex solution could have a configurable parameter attached to the user profile (defined by the admin, possibly pulled in from an SSO parameter). If this is empty, it could fall back to the username.

Platform

Web

Originally created by @llitz on GitHub (Dec 31, 2022). ### Feature detail It would be good to make {{user}} available in the template configuration to enable the separation of photos better when having multiple users. This would allow some configurations like: {{user}}/{{y}}/{{MM}}/{{filename}} While I have not looked at the code, implementing this should be easier than trying more complex solutions. The more complex solution could have a configurable parameter attached to the user profile (defined by the admin, possibly pulled in from an SSO parameter). If this is empty, it could fall back to the username. ### Platform Web
Author
Owner

@jrasm91 commented on GitHub (Dec 31, 2022):

User ID is already used and is automatically prepended to the storage template, so it's actually not possible to mix photos between users. They will always be in separate directories.

@jrasm91 commented on GitHub (Dec 31, 2022): User ID is already used and is automatically prepended to the storage template, so it's actually not possible to mix photos between users. They will always be in separate directories.
Author
Owner

@llitz commented on GitHub (Dec 31, 2022):

But that is hard coded and not exposed, right? (perhaps I should have worded that better)

The more advanced implementation I mentioned could allow for some differences between username and storage direction, but I imagine some care would be taken here so 2 users don't end up with the same storage (probably not desirable?).

I am not sure how storage verification is being done do avoid duplicates, but could the {{user}} part be in the middle of the string? Must it be the initial directory or can it be in the middle or even be part of the filename? I am assuming it must be the first item of the dynamic name or else other things could break.

Other things like {{user}} can only show once and if removed it will be automatically added to the left of the string in a format of {{user}} would make sense too.

@llitz commented on GitHub (Dec 31, 2022): But that is hard coded and not exposed, right? (perhaps I should have worded that better) The more advanced implementation I mentioned could allow for some differences between username and storage direction, but I imagine some care would be taken here so 2 users don't end up with the same storage (probably not desirable?). I am not sure how storage verification is being done do avoid duplicates, but could the {{user}} part be in the middle of the string? Must it be the initial directory or can it be in the middle or even be part of the filename? I am assuming it must be the first item of the dynamic name or else other things could break. Other things like {{user}} can only show once and if removed it will be automatically added to the left of the string in a format of {{user}} would make sense too.
Author
Owner

@jrasm91 commented on GitHub (Dec 31, 2022):

I see. So this request is to make it possible to include (move) user somewhere else in the template and/or omit it entirely?

@jrasm91 commented on GitHub (Dec 31, 2022): I see. So this request is to make it possible to include (move) user somewhere else in the template and/or omit it entirely?
Author
Owner

@llitz commented on GitHub (Dec 31, 2022):

That would be the final goal but only the easiest use cases should be implemented for now.

Doing it all may require multiple different issues tracking it, exposing {{user}} would probably be the first step.

@llitz commented on GitHub (Dec 31, 2022): That would be the final goal but only the easiest use cases should be implemented for now. Doing it all may require multiple different issues tracking it, exposing {{user}} would probably be the first step.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: immich-app/immich#538