• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
How to Retrieve Session User?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to Retrieve Session User?


  • Subject: How to Retrieve Session User?
  • From: Fred Shurtleff <email@hidden>
  • Date: Wed, 04 Apr 2007 16:10:35 -0400

Hello,

I have a basic question on how to access the logged in user for later use in updates. After authenticating a user I enter him into the session, but when I later try to retrieve this user in another page, it fails(returns null).

So in my main page I record the user as follows:

if (_password.equals(password)) { EOEnterpriseObject user = EOUtilities.objectMatchingKeyAndValue(session().defaultEditingContext(), "User", "name", username);
// set the session.user session().takeValueForKey(user, "user");


And on another page to add a new transaction which needs the user relation attribute(as a foreign key):

EOEnterpriseObject user = (EOEnterpriseObject) valueForKeyPath("session.user"); // user evals to null???
purchase.addObjectToBothSidesOfRelationshipWithKey(user, "user");


The save fails because user is a required attribute. And I'm not sure if I am not properly storing the user in the session, or not properly retrieving the user from the session.

Can anyone see what I am doing wrong or suggest another approach?

TIA

_______________________________________________
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


  • Follow-Ups:
    • Re: How to Retrieve Session User?
      • From: Mark Morris <email@hidden>
  • Prev by Date: Re: Delete statement
  • Next by Date: Re: Writing IE specific code
  • Previous by thread: Re: Delete statement
  • Next by thread: Re: How to Retrieve Session User?
  • Index(es):
    • Date
    • Thread