OliveTin / OliveTin

OliveTin gives safe and simple access to predefined shell commands from a web interface.
https://olivetin.app
GNU Affero General Public License v3.0
2.26k stars 70 forks source link

Pass current authenticated username as an argument/variable. #405

Closed Maokaman1 closed 1 month ago

Maokaman1 commented 2 months ago

Hey @jamesread,

I'm about to deploy your excellent product, and after reviewing the documentation, I couldn't find a way to pass the current authenticated username as an argument to a command/script. This functionality could be useful in scenarios such as notifying others in chat groups or initiating approval processes before executing dangerous scripts.

Additionally, it might be worth considering whether built-in usernames (e.g., cron, calendar, fileindir) should be prefixed to reduce the risk of conflicts with usernames in external authorization systems. I'm not entirely sure about this, but it could be something to think about.

jamesread commented 2 months ago

Hey @Maokaman1 , that's a very sensible request. I've just written code for it and submitted it in #406. I'll publish a release that includes this in just a moment. :-)

All OliveTin fake users are members of the "system" usergroup, which should make it easy to filter permissions, I don't really want to rename them like ot_calendar because a conflict is fairly unlikely.

jamesread commented 1 month ago

Hey @Maokaman1, release 2024.09.11 added support for this; https://github.com/OliveTin/OliveTin/releases/tag/2024.09.11

You can user it as the $OT_USERNAME environmentVariable, or {{ ot_username }} specified in arguments: on the atction.