Re: Letting a user see only the data they should.
Re: Letting a user see only the data they should.
- Subject: Re: Letting a user see only the data they should.
- From: Arturo PĂ©rez <email@hidden>
- Date: Wed, 5 May 2004 14:07:32 -0400
On May 5, 2004, at 1:19 PM, Justin Tocci wrote:
I have a table I want to display. I want to filter the table based on
a username field that will not be shown in the display of said table.
The text of the filter, "joesmith" say, is in the session in a string
variable named login.
Now, in such a way that the user can not change the filter (don't want
it added to the hyperlink because once logged in the user could change
the filter to "maryjones" and see another user's records) I want to
apply said filter to table before display.
Well, heck that's easy! :-) Assuming you don't want sessionless (as
you say above, you're using session). You do it like this:
Put the qualifying value in session using your favorite method: public
ivar, get/set methods. Let's say you're using
getUserRestriction()/setUserRestriction().
To get the table entries restricted to that user I would do
NSArray visibleInfo =
EOUtilities.objectsMatchingKeyAndValue(session().defaultEditingContext()
,
"Table",
"username",
((Session)session()).getUserRestriction());
This you would be able to do in any WOComponent. You could even do it
in WODisplayGroup if your needs are more complicated than just
displaying stuff.
--arturo
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.