wissel.net

Usability - Productivity - Business - The web - Singapore & Twins

Running one agent as user or anonymous


An interesting question landed on my desk: " In a web application you use extensive agents to prepare or render content. When the user is authenticated you want that agent to run in the user's context. For anonymous users you want the agent to run in the agent signers security context, so you don't need to expose your resources to anonymous browsing. How to do that?"
Answer:
  1. Write all your business code in functions in a script library. Have one function as entry point. It is a matter of taste to use the documentContext as parameter or to retrieve that inside the function.
  2. Write two agents that both call that function: "agAnonymous" and "agUser". Configure the first one to run with the signer access, the second one to run as web user.
  3. In your WebQuer[Open|Close] use this formula:
    agentToRun := @if(@UserName = "Anonymous";"agAnonymous";"agUser");
    @Command([ToolsRunMacro];agentToRun);
As usual: YMMV.


Posted by on 13 July 2009 | Comments (0) | categories: Show-N-Tell Thursday

Comments

  1. No comments yet, be the first to comment