• 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
Re: Simple Stuff Help
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Simple Stuff Help


  • Subject: Re: Simple Stuff Help
  • From: David LeBer <email@hidden>
  • Date: Fri, 14 Mar 2008 23:46:19 -0400


On 14-Mar-08, at 10:58 PM, Chuck Hill wrote:


On Mar 14, 2008, at 6:46 PM, Gustavo Pizano wrote:

Hello, well after doing the tutorial I will try to do simple things, like log into a system, and depending if the user is Client or Admin it will show diferents webpages, Im planing this to start having a better understanding of the "how does it work".
SO lets say I have a DB with users and privileges, so at the login page will log on as client or admin,
I was reading how to schive this simple thing, but hadn't been able to figure it out. As far as I understadn I must delegate this to the EOF with some especial class and special operation, just I can't find it.


or.. if there is other easier way to do it with WO/EO, then can I get some help, even don;t telling me the "how" otherwise it will take the "magic" away, but the "where" can i find info.

Here is something to get you thinking:

String userID;  // From  your login page
String password;   // From  your login page
Session session = (Session)session();

// You need to write session.setUser() and User.authenticatedUserFromCredentials()
session .setUser (User .authenticatedUserFromCredentials(session.defaultEditingContext(), userID, password);
if (person == null) {
// Handle failure to log in, then
return context().page();
}


// You need to define ADMIN_PRIVILEGE_KEY and write Privilege.privilegeWithKey()
Privilege adminPrivilege = Privilege.privilegeWithKey(session.defaultEditingContext(, Privilege.ADMIN_PRIVILEGE_KEY);


if (session.user().privileges().containsObject(adminPrivilege)) {
   return pageWithName(AdminHomePage.class.getName());
}

return pageWithName(HomePage.class.getName());

If you are having a problem actually figuring out how to fetch and authenticate the User, I enhanced the wiki with some simple examples of the different ways to qualify and create a fetch in EOF:


<http://wiki.objectstyle.org/confluence/display/WO/Programming__WebObjects-EOF-Using+EOF-Fetching >

;david

--
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
--
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
References: 
 >Simple Stuff Help (From: Gustavo Pizano <email@hidden>)
 >Re: Simple Stuff Help (From: Chuck Hill <email@hidden>)

  • Prev by Date: Re: Simple Stuff Help
  • Next by Date: Re: Simple Stuff Help
  • Previous by thread: Re: Simple Stuff Help
  • Next by thread: WOLips Community Installer
  • Index(es):
    • Date
    • Thread