You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Linda van der Pal <lv...@heritageagenturen.nl> on 2009/04/07 11:46:29 UTC

authorizing a tab

I'm trying to disable a tab in a TabbedPanel based on authorization. I'm 
using wicket-auth-roles, and it works in other places, for example for 
buttons. Could anybody tell me what I'm doing wrong? The tab just keeps 
on showing, and if you click on it you go to a page that states that you 
don't have authorization for that page. (As I have added an annotation 
to that page as well.)

public class BookDetailsPanel extends Panel {
    ...
    public BookDetailsPanel(String id, final String isbn, boolean 
showEditPanel) {
       ...
       List tabs = new ArrayList();
       ...
       tabs.add(new OwnerEditTab(new Model("edit"), isbn));
       ...
    }
    @AuthorizeAction(action = Action.RENDER, roles = { "OWNER" })
    private class OwnerEditTab extends AbstractTab {
        private static final long serialVersionUID = 1L;
        private String isbn;
       
        public OwnerEditTab(IModel model, String isbn) {
            super(model);
            this.isbn = isbn;
        }
       
        @Override
        public Panel getPanel(String panelId) {
            return new BookDetailsEditPanel(panelId, isbn);
        }
    }
}

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


Re: authorizing a tab

Posted by Brill Pappin <br...@pappin.ca>.
You could also use one of the two PageTabPanel components we wrote at  
wicketskunkworks.org which would allow you to secure the content of a  
tab using normal page authorization.

There is not much in the way of docs at the moment but you can check  
out both components from:
http://wicket-skunkworks.googlecode.com/svn/trunk/wicket-pagetabs/

and you can include it in your project using the maven repo. See:
http://code.google.com/p/wicket-skunkworks/wiki/MavenRepository

- Brill Pappin


On 7-Apr-09, at 6:36 AM, Marieke Vandamme wrote:

>
> I think I had the same problem a while ago.
> Look at the solution in discussion underneath:
> http://www.nabble.com/TabbedPanel-%2B-authorization-strategy-td13949910.html#a13965618
>
>
> Linda van der Pal wrote:
>>
>> I'm trying to disable a tab in a TabbedPanel based on  
>> authorization. I'm
>> using wicket-auth-roles, and it works in other places, for example  
>> for
>> buttons. Could anybody tell me what I'm doing wrong? The tab just  
>> keeps
>> on showing, and if you click on it you go to a page that states  
>> that you
>> don't have authorization for that page. (As I have added an  
>> annotation
>> to that page as well.)
>>
>> public class BookDetailsPanel extends Panel {
>>    ...
>>    public BookDetailsPanel(String id, final String isbn, boolean
>> showEditPanel) {
>>       ...
>>       List tabs = new ArrayList();
>>       ...
>>       tabs.add(new OwnerEditTab(new Model("edit"), isbn));
>>       ...
>>    }
>>    @AuthorizeAction(action = Action.RENDER, roles = { "OWNER" })
>>    private class OwnerEditTab extends AbstractTab {
>>        private static final long serialVersionUID = 1L;
>>        private String isbn;
>>
>>        public OwnerEditTab(IModel model, String isbn) {
>>            super(model);
>>            this.isbn = isbn;
>>        }
>>
>>        @Override
>>        public Panel getPanel(String panelId) {
>>            return new BookDetailsEditPanel(panelId, isbn);
>>        }
>>    }
>> }
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>>
>
> -- 
> View this message in context: http://www.nabble.com/authorizing-a-tab-tp22925752p22926397.html
> Sent from the Wicket - User mailing list archive at Nabble.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


Re: authorizing a tab

Posted by Marieke Vandamme <ma...@tvh.be>.
I think I had the same problem a while ago.
Look at the solution in discussion underneath:
http://www.nabble.com/TabbedPanel-%2B-authorization-strategy-td13949910.html#a13965618


Linda van der Pal wrote:
> 
> I'm trying to disable a tab in a TabbedPanel based on authorization. I'm 
> using wicket-auth-roles, and it works in other places, for example for 
> buttons. Could anybody tell me what I'm doing wrong? The tab just keeps 
> on showing, and if you click on it you go to a page that states that you 
> don't have authorization for that page. (As I have added an annotation 
> to that page as well.)
> 
> public class BookDetailsPanel extends Panel {
>     ...
>     public BookDetailsPanel(String id, final String isbn, boolean 
> showEditPanel) {
>        ...
>        List tabs = new ArrayList();
>        ...
>        tabs.add(new OwnerEditTab(new Model("edit"), isbn));
>        ...
>     }
>     @AuthorizeAction(action = Action.RENDER, roles = { "OWNER" })
>     private class OwnerEditTab extends AbstractTab {
>         private static final long serialVersionUID = 1L;
>         private String isbn;
>        
>         public OwnerEditTab(IModel model, String isbn) {
>             super(model);
>             this.isbn = isbn;
>         }
>        
>         @Override
>         public Panel getPanel(String panelId) {
>             return new BookDetailsEditPanel(panelId, isbn);
>         }
>     }
> }
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/authorizing-a-tab-tp22925752p22926397.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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