On 31/05/2012 19:33, Bob Lannoy wrote:
>
> Hi Sarris,
>
> Notifications are completely decoupled from the workflow, so you don't
> have access to the token variable. You do have access to the user
> object, so a user.getToken() should do the trick.
>

Correct. also a bare $user.token should work, since the bean syntax is
supported and getToken() does not take any parameter.

Regarding

> As you maybe remember I once asked about the SyncopeConf being
> available in the email generation part

as you may remember, we opened SYNCOPE-74 for this, and this issue was
fixed yesterday.
This means that now you can refer to conf params as well in e-mail body:

$syncopeConf.get("smtp.host")

Regards.

> On May 31, 2012 7:22 PM, "Sarris Overbosch | Everett"
> <[email protected] <mailto:[email protected]>> wrote:
>
>     Hi Francesco,
>
>     Thanx for the explanation, but I have a question about the following:
>
>     " 3. assuming that an appropriate notification is defined, an
>     e-mail in
>     sent to the user just created with an activation link containing the
>     value of the token generated "
>
>     I tried to define a notification which has the token in it, the
>     notification is working but the token is not in the email. I
>     wanted the following to be replaced
>     <a
>     href="${selfserviceBaseUrl}/spring/user/activate/${userid}/${token}">
>
>     As you maybe remember I once asked about the SyncopeConf being
>     available in the email generation part (That's where the
>     selfserviceBaseUrl should be coming from) but to make the story
>     short, the ${token} is not substituted with the token value
>     (probably I am using the wrong EL). What should I use to have the
>     token displayed in the email?
>
>     Br,
>
>     Sarris
>
>     On 31-05-12 16:44, Francesco Chicchiriccò wrote:
>>     Hi,
>>     see the response on this topic on other thread
>>     http://syncope-dev.1063484.n5.nabble.com/Tokens-tp5709792p5709798.html
>>
>>     Regards.
>>
>>     On 31/05/2012 13:02, Bob Lannoy wrote:
>>>     Hi Sarris,
>>>
>>>     well I ended up creating an additional REST method in the
>>>     usercontroller (/activate/{userId}) with the token as query parameter.
>>>
>>>     I'm not sure this is the way to go but Francesco will shed some light
>>>     on it when he has the time.
>>>
>>>     My code:
>>>
>>>      @PreAuthorize("hasRole('USER_UPDATE')")
>>>         @RequestMapping(method = RequestMethod.GET, value = 
>>> "/activate/{userId}")
>>>         @Transactional(readOnly = true, rollbackFor = {Throwable.class})
>>>         public UserTO activate(@PathVariable("userId") final Long userId,
>>>                 @RequestParam("token") final String token)
>>>                 throws WorkflowException, NotFoundException,
>>>     UnauthorizedRoleException, PropagationException {
>>>
>>>             LOG.debug("About to activate " + userId +" with token "+token);
>>>
>>>             SyncopeUser user = userDAO.find(userId);
>>>             if (user == null) {
>>>                 throw new NotFoundException("User " + userId);
>>>             }
>>>
>>>             wfAdapter.activate(userId, token);
>>>             return userDataBinder.getUserTO(userId);
>>>         }
>>>
>>>     On 31 May 2012 12:56, Sarris T.L. Overbosch | Everett
>>>     <[email protected]> <mailto:[email protected]> 
>>> wrote:
>>>>     Hi Bob
>>>>
>>>>     I am at the same point you are and haven't found the solution (but 
>>>> that's
>>>>     also because I didn't do any work on this case because
>>>>     of other obligations) So when you find something I would make me happy 
>>>> when
>>>>     you would tell me about the solution.
>>>>
>>>>     Br,
>>>>
>>>>     Sarris
>>>>
>>>>
>>>>
>>>>
>>>>     From: "Bob Lannoy" <[email protected]> <mailto:[email protected]>
>>>>     To: [email protected] 
>>>> <mailto:[email protected]>
>>>>     Sent: Tuesday, May 29, 2012 3:39:40 PM
>>>>     Subject: Re: Notifications
>>>>
>>>>
>>>>     Thanks, that does the trick.
>>>>     It seems that it also results in the token being persisted to the
>>>>     database. Maybe something for JIRA?
>>>>
>>>>     Now that I have in the email, I'm not sure how to proceed using that 
>>>> token.
>>>>     I see that there's an activate method in the usercontroller, but it
>>>>     doesn't take the token as input.
>>>>
>>>>     How do I give the external token to the workflow and make it
>>>>     transition from the usertask "created" into the createdGw with the
>>>>     token variable?
>>>>
>>>>     best regards
>>>>
>>>>     Bob
>>>>
>>>>     On 29 May 2012 14:08, Sarris T.L. Overbosch | Everett
>>>>     <[email protected]> <mailto:[email protected]> 
>>>> wrote:
>>>>>     I had the same problem, solved it by placing the object back on the
>>>>>     workflow
>>>>>     otherwise the information is not available.
>>>>>
>>>>>     From: "Bob Lannoy" <[email protected]> 
>>>>> <mailto:[email protected]>
>>>>>     To: [email protected] 
>>>>> <mailto:[email protected]>
>>>>>     Sent: Tuesday, May 29, 2012 1:10:17 PM
>>>>>     Subject: Re: Notifications
>>>>>
>>>>>
>>>>>     Hi,
>>>>>
>>>>>     I started my own workflow based on the example workflow from the
>>>>>     latest incubating version.
>>>>>     Now I get a mail when the user is in the "created" state just after
>>>>>     the token generation. However, I'm unable to send the generated token
>>>>>     to the user. The token is generated (saw this through debugging) but
>>>>>     it seems that it's not persisted in the database.
>>>>>     In the email template I put "Your token is $user.getToken()." but it
>>>>>     shows up like that in the email, not resolved to a value. Probably
>>>>>     because of the token not being in the DB.
>>>>>
>>>>>     I've attached my WF definition.
>>>>>
>>>>>     regards
>>>>>
>>>>>     Bob
>
-- 
Francesco Chicchiriccò

ASF Member, Apache Cocoon PMC and Apache Syncope PPMC Member
http://people.apache.org/~ilgrosso/

Reply via email to