On Wed, Mar 30, 2011 at 04:24:29AM -0700, Gernot wrote:
> 
> My question: What is the best way to impersonate a process? All the
> process examples I found work with static users (bob, alice). But in
> my example, the supervisor participant must be set dynamically (each
> user knows his supervisor).

Hello Gernot,

welcome to ruote's mailing list.

You could use a workitem field :

---8<---
pdef = Ruote.process_definition do
  participant '${supervisor}'
  participant '${user}'
end

engine.launch(
  pdef,
  'user' => 'gernot',
  'supervisor' => 'ueber-gernot')
--->8---

or a variable :

---8<---
pdef = Ruote.process_definition do
  participant '${v:supervisor}'
  participant '${v:user}'
end

engine.launch(
  pdef,
  {}, # no fields pre-set
  'user' => 'gernot',
  'supervisor' => 'ueber-gernot')
--->8---

or aliases (thanks to variables) :

---8<---
pdef = Ruote.process_definition do
  supervisor
  user
end

engine.launch(
  pdef,
  {}, # no fields pre-set
  'user' => 'gernot',
  'supervisor' => 'ueber-gernot')
--->8---

Most of the time, people go for groups or roles though :

---8<---
pdef = Ruote.process_definition do
  supervisor
  participant '${user}'
end

engine.launch(
  pdef,
  'user' => 'gernot')
--->8---

Where supervisor is a participant that stacks workitems and gives access to 
them according to some authorization logic (this logic could take into account 
the participant name in the workitem and some other fields, like priority, 
region, date, ...).

Probably the 'supervisor' participant can derive the supervisor username based 
on the value of the workitem field 'user'.


I hope this will help, best regards,

-- 
John Mettraux - http://jmettraux.wordpress.com

-- 
you received this message because you are subscribed to the "ruote users" group.
to post : send email to [email protected]
to unsubscribe : send email to [email protected]
more options : http://groups.google.com/group/openwferu-users?hl=en

Reply via email to