((MyRequestCycle)RequestCycle.get()).getUser();
MyRequestCycle {
private transient User user;
getuser() { if (user==null) { user=loaduser(session.get().getuserid()); }
onendrequest() { user=null; }
}
-Igor
On 7/30/06, Mats Norén <[EMAIL PROTECTED]> wrote:
Ah, neat. OO to the rescue.... :)
On 7/31/06, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
> here is some pseudo code:
>
> class BaseTeamPage extends Webpage {
> private final long teamid;
>
> public long getteamid() { return teamid; }
>
> public BaseTeamPage(long teamid) {
> this.teamid=teamid ;
> }
> }
>
> ....
>
Did you mean isActionAuthorized here?
>From the IAuthorizationStrategy?
> isactionallowed(Component c, Action act) {
> if (act==Component.VISIBLE) {
> if ( c.getPage()!=null&&c.getPage() instanceof BaseTeamPage) {
> final BaseTeamPage page= c.getPage();
> long teamid=page.getteamid(); <==== from here on you have
> the team id so you can do whatever
>
The problem is that I don't really see how I can get the different
roles associated with the User-object based on the teamId and get a
chance to compare them.
I'm guessing that the isActionAuthorized(Component comp, Action act)
gets called on every component render and I don't want to hit my db
(although I'm using Hibernate and it's cache) every time I render a
component.
Is it safe to get the User-object from the session via the page?
My current implementation of a user object is actually a Person-object:
Person
Set<TeamPerson> teamPersons;
TeamPerson
Set<TeamPersonRole> roles;
TeamPersonRole
id
name
Is there a way I can use to extend/use the annotation-approach? Or
mabye combine the two?
I'm guessing that there will eventually be a mixture of pages that
depend on a team and pages that are for every team so to speak.
Btw, thanks for the quick reply! :)
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user
------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user