Re: D2W automatically assign a value to an attribute
Re: D2W automatically assign a value to an attribute
- Subject: Re: D2W automatically assign a value to an attribute
- From: Francesco Romano <email@hidden>
- Date: Tue, 7 Dec 2010 09:42:10 +0100
On 06/dic/2010, at 22.44, David LeBer wrote:
>
> On 2010-12-06, at 4:35 PM, Francesco Romano wrote:
>
>> Ok.. today I'm asking stupid questions.. but.. D2W is not so simple with the rule system :)
>> I have a page (CreateMovie) which is displayed only if a user is logged in (I disabled the automatic login and added a condition in the navigation menu bind to session.isUserLoggedIn).
>> I have a required attribute in the Movie entity named "uploader". What I want to do is not allow the user to insert that name, but retrieve it from session.username().
>> How can I do this? I tried a lot of things, but either they don't work or they give exception..
>>
>> Francesco
>>
>> PS: the big picture is to make the login on a LDAP server, and then save the username in the session.
>
> If what you are asking is how to set the username on the EO try:
>
> Use awakeFromInsertion or (ERXGenericRecord's) willInsert to set the username in the EO, obtaining the username from ERXThreadStorage.
>
> Push the username into ERXThreadStorage in the Session awake().
>
> ;david
Thank you.
It works!
(before I tried to do something in the willInsert method, but I don't have access to session and I din't know the existence of ERXThreadStorage :)
Francesco
PS: yesterday i did't reply to the list but only to david.. sorry :)
>
> --
> David LeBer
> Codeferous Software
> 'co-def-er-ous' adj. Literally 'code-bearing'
> site: http://codeferous.com
> blog: http://davidleber.net
> profile: http://www.linkedin.com/in/davidleber
> twitter: http://twitter.com/rebeld
> --
> Toronto Area Cocoa / WebObjects developers group:
> http://tacow.org
>
>
>
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden