You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Rizal Indra <bu...@yahoo.com> on 2009/07/21 08:15:04 UTC

Re: How to Hidden/Disabled Wicket tree with implementation wicket security (Help)

Hi, i have tried to disable/hide component like buttons (as Warren example) with success.
but how to Wicket tree not populateTreeItem( hide) because my Class Page not include in my hive file?
Does anyone can do it? or my way that call all menu from db for all principals then lets wicket security hide unsecured link is wrong method?

any hints/example will be appreciated. thanks


--- Pada Jum, 17/7/09, Warren Bell <wa...@gmail.com> menulis:

> Dari: Warren Bell <wa...@gmail.com>
> Judul: Re: How to Hidden/Disabled Wicket tree with implementation wicket security
> Kepada: "Rizal Indra" <bu...@yahoo.com>, users@wicket.apache.org
> Tanggal: Jumat, 17 Juli, 2009, 10:50 AM
> Your hive should have something like
> this with whatever actions you want:
> 
> permission ${ComponentPermission}
> "${MyPage}:myPanel:myForm:myWebMarkupContainer", "inherit,
> render, enable";
> 
> And also secure anything in the container like buttons:
> 
> permission ${ComponentPermission}
> "${MyPage}:myPanel:myForm:myWebMarkupContainer:myButton",
> "inherit, render, enable";
> 
> I seem to remember a similar problem that I had. It
> involved the way I used a WebMarkupContainer, a form and a
> panel. I messed around with how I nested the different
> components and I got it to work. Go figure?
> 
> Warren
> 
> Rizal Indra wrote:
> > Thanks for quick reply Warren,
> > exactly my code SecureWebMarkupContainer.java is same
> as with your code.
> > But its still not working. I am newbie in java wicket,
> so i need more example/hint for understanding its. I am sure
> that missing something but i dont know how to solve it.
> > 
> > Can anyone help me? thanks 
> > 
> > 
> > --- Pada Kam, 16/7/09, Warren Bell <wa...@gmail.com>
> menulis:
> > 
> >   
> >> Dari: Warren Bell <wa...@gmail.com>
> >> Judul: Re: How to Hidden/Disabled Wicket tree with
> implementation wicket security
> >> Kepada: users@wicket.apache.org,
> bujang_kuantan@yahoo.com
> >> Tanggal: Kamis, 16 Juli, 2009, 11:09 AM
> >> Try this:
> >> 
> >> Warren
> >> 
> >> public class SecureWebMarkupContainer extends
> >> WebMarkupContainer implements ISecureComponent {
> >> 
> >>    public
> SecureWebMarkupContainer(String
> >> id)
> >>    {
> >>     super(id);
> >> 
> >>        setSecurityCheck(new
> >> ComponentSecurityCheck(this));
> >>    }
> >>      public
> >> SecureWebMarkupContainer(String id, IModel model)
> >>    {
> >>        super(id, model);
> >>        setSecurityCheck(new
> >> ComponentSecurityCheck(this));
> >>    }
> >>      public final void
> >> setSecurityCheck(ISecurityCheck check)
> >>    {
> >>   
>    SecureComponentHelper.setSecurityCheck(this,
> >> check);
> >>    }
> >> 
> >>    public final ISecurityCheck
> >> getSecurityCheck()
> >>    {
> >>        return
> >> SecureComponentHelper.getSecurityCheck(this);
> >>    }
> >> 
> >>    public boolean
> isActionAuthorized(String
> >> action)
> >>    {
> >>        return
> >> SecureComponentHelper.isActionAuthorized(this,
> action);
> >>    }
> >> 
> >>    public boolean
> >> isActionAuthorized(WaspAction action)
> >>    {
> >>        return
> >> SecureComponentHelper.isActionAuthorized(this,
> action);
> >>    }
> >> 
> >>    public boolean isAuthenticated()
> >>    {
> >>        return
> >> SecureComponentHelper.isAuthenticated(this);
> >>    }
> >>      public boolean
> >> isAuthenticatedAndAuthorized(String action)
> >>    {
> >>        return
> isAuthenticated()
> >> && isActionAuthorized(action);
> >>    }
> >> 
> >> {
> >> 
> >> 
> >> Rizal Indra wrote:
> >>     
> >>> Hi,
> >>> I have created my welcome page with menu tree
> (http://wicketstuff.org/wicket13/nested/
> ). I want to
> >>>       
> >> hide/disabled some item menu depend on user right
> >> principal.
> >>     
> >>> I have try put some tricks but not work :-)
> >>> MyTree.java
> >>> public class MyTree extends Tree {
> >>> @Override
> >>>      protected void
> >>>       
> >> populateTreeItem(WebMarkupContainer item, int
> level) {
> >>     
> >>>            
> >>    System.out.println(" getting
> >> populateTreeItem...");
> >>     
> >>>            
> >>    super.populateTreeItem(item, level);
> >>     
> >>>          final
> TreeNode
> >>>       
> >> node = (TreeNode)item.getModelObject();
> >>     
> >>>         
> MarkupContainer
> >>>       
> >> nodeLink =  newNodeLink(item, "nodeLink",
> node);
> >>     
> >>>            
> >>    SecureWebMarkupContainer swmc = new
> >> SecureWebMarkupContainer("hiddenMenu");
> >>     
> >>>            
> >>    swmc.add(nodeLink);
> >>     
> >>>            
> >>    //item.add(nodeLink);
> >>     
> >>>         
> item.add(swmc);
> >>>      }
> >>> }
> >>> 
> >>> SecureWebMarkupContainer.java
> >>> public class SecureWebMarkupContainer extends
> >>>       
> >> WebMarkupContainer implements ISecureComponent {
> >>     
> >>> ...
> >>> }
> >>> 
> >>> can anyone give some example/advice how to
> make it
> >>>       
> >> work. thanks     
> >>>        Pemanasan global?
> Apa
> >>>       
> >> sih itu? Temukan jawabannya di Yahoo! Answers! http://id.answers.yahoo.com
> >>     
> >>>       
> >>
> ---------------------------------------------------------------------
> >>     
> >>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >>> For additional commands, e-mail: users-help@wicket.apache.org
> >>> 
> >>>       
> >>
> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> For additional commands, e-mail: users-help@wicket.apache.org
> >> 
> >> 
> >>     
> > 
> > 
> >       Berbagi foto Flickr
> dengan teman di dalam Messenger. Jelajahi Yahoo! Messenger
> yang serba baru sekarang! http://id.messenger.yahoo.com
> >   
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 


      Berbagi video sambil chatting dengan teman di Messenger. Sekarang bisa dengan Yahoo! Messenger baru. http://id.messenger.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org