On Mon, Dec 6, 2010 at 3:36 PM, Taner Diler <[email protected]> wrote:
> Hi all,
>
> I'm writing a blog application. as all blog applications it has an admin
> module. I wrote two abstract page : AdminPage and BlogPage. the differencies
> between them are menu, left/right panels and also screen styles. This make
> me develope duplicate pages for admin and blog.
>
> So how can I reduce code duplication, what is the best solution for it?
>
> Thanks
>

Write a single page.  In that page, put both menus.  On the admin menu
class, use the @AuthorizeAction(action=Action.RENDER, roles={ "ADMIN"
}) annotation (if you're using Wicket auth roles).  This will make it
not render for anyone unless they are an admin.  Do the inverse for
the other menu, etc...

If you're not using wicket auth roles, the same principle applies.
Put all your components on the page and let the security strategy hide
the ones you don't have proper auth to see.

-- 
Jeremy Thomerson
http://wickettraining.com
Need a CMS for Wicket?  Use Brix! http://brixcms.org

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to