• 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: Chuck Hill <email@hidden>
  • Date: Fri, 14 Mar 2008 19:58:17 -0700


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());


Chuck



--

Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/products/practical_webobjects






_______________________________________________
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: Simple Stuff Help
      • From: David LeBer <email@hidden>
    • Re: Simple Stuff Help
      • From: Gustavo Pizano <email@hidden>
References: 
 >Simple Stuff Help (From: Gustavo Pizano <email@hidden>)

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