script-server icon indicating copy to clipboard operation
script-server copied to clipboard

Question- How do i get the username, each time the user trigger or click execute?

Open zfpang opened this issue 2 years ago • 8 comments

How do i get the username, each time the user trigger or click execute?

zfpang avatar Aug 23 '23 08:08 zfpang

Hi @zfpang, I guess this is the way to go: https://github.com/bugy/script-server/wiki/Script-config#--default Most probably you would want to combine it with a https://github.com/bugy/script-server/wiki/Script-config#--constant

bugy avatar Aug 23 '23 08:08 bugy

Scenario: User A execute Script B, and normally the action is recorded to a log file. User B execute Script B.

Is there any possible to get the User A without searching with the log file?

zfpang avatar Aug 23 '23 09:08 zfpang

From where do you want to get the user? another script? Some other application? Or anything else

bugy avatar Aug 23 '23 09:08 bugy

From this screen, image when user clicked execute, then the username who clicked will send out a notification to telegram bot .

zfpang avatar Aug 24 '23 03:08 zfpang

${auth.username} should be available to your scripts to access, as the currently logged in UI user

On Wed, Aug 23, 2023, 11:20 PM zfpang @.***> wrote:

From this screen, [image: image] https://user-images.githubusercontent.com/142978229/262850899-890a92cb-27f0-4e2f-a241-917c19d83af8.png when user clicked execute, then the username who clicked will send out a notification to telegram bot .

— Reply to this email directly, view it on GitHub https://github.com/bugy/script-server/issues/690#issuecomment-1690932453, or unsubscribe https://github.com/notifications/unsubscribe-auth/A3HBI3WTNONDGBWK6JA7QBDXW3CALANCNFSM6AAAAAA33CTA5I . You are receiving this because you are subscribed to this thread.Message ID: @.***>

MNeill73 avatar Aug 24 '23 03:08 MNeill73

@zfpang and how are you calling the telegram bot?

bugy avatar Aug 24 '23 05:08 bugy

i using function as below. image

zfpang avatar Aug 24 '23 07:08 zfpang

So, you are doing it from the script itself. In this case this solution is the right way for you: https://github.com/bugy/script-server/issues/690#issuecomment-1689560103

You would need to pass username to the script, using this parameter configuration

bugy avatar Aug 24 '23 07:08 bugy