Arc Forumnew | comments | leaders | submitlogin
Using (get-user req) and app in repl/apps
1 point by thaddeus 5977 days ago | 5 comments
Not sure if anyone is using the web-based repl or prompt from prompt.arc, but I am wondering how I can pass in the current username within the repl or even the app name within the prompt (saved app).

ie. (pr (get-user req))

Just curious if anyone tried this and if anyone was able to make this work.

Thanks. T.



1 point by CatDancer 5977 days ago | link

If you have ten users currently logged in and you're at the repl, which user do you want to get?

-----

1 point by thaddeus 5976 days ago | link

The one signed in whom clicks submit at the repl... I'm thinking more like 2 admins at the repl.... this is a trick question right?

-----

2 points by CatDancer 5976 days ago | link

Not a trick question, I wasn't quite getting what you wanted to do.

Ok, so you could have the defop repl store the current user in a global variable which you could then access from the prompt. Which would work fine as long as you only had one person logging in as an admin at a time.

If you have more than one person logging in as an admin at a time and you want to know who you are from the prompt, it sounds like the challenge is to get the dynamic value of the user name into the scope of the eval'ed expression?

-----

2 points by thaddeus 5976 days ago | link

Yeah I tried going straight to your second idea (ouch!).

I really don't have 2 admins, but was trying to future proof it. I think I will just start with setting the global variable.

Thanks. T.

-----

2 points by CatDancer 5976 days ago | link

Right, well, notice that the repl-history*, that, and thatexpr are also global variables, and so future proofing it for multiple admins will take more work than just the eval issue.

(For getting values into the eval, one way to do it is with an MzScheme feature called parameters; I have a library to let you use those from Arc which I haven't quite finished yet).

-----