You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Marieke Vandamme <ma...@tvh.be> on 2010/06/08 15:42:26 UTC

get rights for mounted url

Hello, 

In my application I have the following:
mountBookmarkablePage("/insecure.html", InsecurePage.class);
mountBookmarkablePage("/secure.html", SecurePage.class);
MetaDataRoleAuthorizationStrategy.authorize(SecurePage.class, Roles.USER);

I have a reusable component (homemade) that generates the navigation for the
site from a database. In the database the 'secure.html' - url is specified,
but when making the link in the navigation, I need to check if the user has
right to the page.

Now my question: Is it possible that I get the rights for my SecurePage,
when only having the 'secure.html' to start from? I tried to look into the
wicket-code, but somewhere between BookmarkablePageRequestTarget and
RequestCycle I got lost... 
Hope someone can help me! Thanks for any help ! Marieke Vandamme
-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/get-rights-for-mounted-url-tp2247394p2247394.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


Re: get rights for mounted url

Posted by Igor Vaynberg <ig...@gmail.com>.
wicket-auth-roles is just an example, it is meant for you to take and
paste into your own code base so you can tweak it to suit your needs.

-igor

On Wed, Jun 9, 2010 at 5:35 AM, Marieke Vandamme
<ma...@tvh.be> wrote:
>
> Hi,
>
> Thanks for the hints, but there's only one thing I'm stuck with.
> I want to use MetaDataRoleAuthorizationStrategy.authorize(component,
> Component.RENDER, rights); to set the right on my link, where rights are the
> Roles. I now got my class from the IRequestTarget, but the only function in
> MetaDataRoleAuthorizationStrategy that returns the Roles for my class,
> rolesAuthorizedToInstantiate, is private..
> Or my I use the code from within that function directly?
>     final InstantiationPermissions permissions =
> Application.get().getMetaData(
>                        INSTANTIATION_PERMISSIONS);
>                if (permissions != null)
>                {
>                        return permissions.authorizedRoles(componentClass);
>                }
>
> Thanks again! Marieke
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/get-rights-for-mounted-url-tp2247394p2248769.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: get rights for mounted url

Posted by Marieke Vandamme <ma...@tvh.be>.
Hi, 

Thanks for the hints, but there's only one thing I'm stuck with. 
I want to use MetaDataRoleAuthorizationStrategy.authorize(component,
Component.RENDER, rights); to set the right on my link, where rights are the
Roles. I now got my class from the IRequestTarget, but the only function in
MetaDataRoleAuthorizationStrategy that returns the Roles for my class,
rolesAuthorizedToInstantiate, is private.. 
Or my I use the code from within that function directly?
     final InstantiationPermissions permissions =
Application.get().getMetaData(
			INSTANTIATION_PERMISSIONS);
		if (permissions != null)
		{
			return permissions.authorizedRoles(componentClass);
		}

Thanks again! Marieke
-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/get-rights-for-mounted-url-tp2247394p2248769.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


Re: get rights for mounted url

Posted by Igor Vaynberg <ig...@gmail.com>.
you can use the request coding strategy to resolve the request that
has a "secure.html" page back to an irequesttarget. you can then check
if the irequesttarget is an instance of
ibookmarkablepagerequesttarget. if it is, you can cast and call
getpageclass(), then pass that to the
metadataroleauthorizationstrategy to see which roles are associated
with it.

-igor

On Tue, Jun 8, 2010 at 6:42 AM, Marieke Vandamme
<ma...@tvh.be> wrote:
>
> Hello,
>
> In my application I have the following:
> mountBookmarkablePage("/insecure.html", InsecurePage.class);
> mountBookmarkablePage("/secure.html", SecurePage.class);
> MetaDataRoleAuthorizationStrategy.authorize(SecurePage.class, Roles.USER);
>
> I have a reusable component (homemade) that generates the navigation for the
> site from a database. In the database the 'secure.html' - url is specified,
> but when making the link in the navigation, I need to check if the user has
> right to the page.
>
> Now my question: Is it possible that I get the rights for my SecurePage,
> when only having the 'secure.html' to start from? I tried to look into the
> wicket-code, but somewhere between BookmarkablePageRequestTarget and
> RequestCycle I got lost...
> Hope someone can help me! Thanks for any help ! Marieke Vandamme
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/get-rights-for-mounted-url-tp2247394p2247394.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