0

Spring Security Integration

asked 2009-10-26 12:21:41 +0800

fabian gravatar image fabian
18

Hello,

im still struggling a little bit with the Spring Security Integration. I understand that i can not use (custom) tag libraries in zul pages (in a portlet environment). But how can i disable page regions or components based on the user authorities? I've seen a post in this forum where a user builds the menucomponents onCreation of the window. but this feels just way to awkward somehow (at least to me). isnt there a better way to solve this? taglibraries would be the answer but when those arent working, isnt there something else?

im new to zk, normally in jsf i would have a backing bean, like the SecurityUtil to ask, whether or not to render a component in the window? cant i access that bean with some kind of expressionlanguage?

something like that:

<button onClick="win.safe()" visible="SecurityUtil.isAllGranted('Role_Administrator')"/>

thanks for your help

delete flag offensive retag edit

1 Reply

Sort by ยป oldest newest

answered 2009-10-26 19:51:56 +0800

joylo0122 gravatar image joylo0122
688 1
www.zkoss.org

@fabian

Hi fabian, here is a sample for you.

In zul

<?taglib uri="http://www.zkoss.org/dsp/web/core" prefix="c"?>
<?taglib uri="/WEB-INF/tld/my.tld" prefix="z"?>
...

<button if="${z:authorize('Role_Administrator')}" />

In tld

<?xml version="1.0" encoding="ISO-8859-1" ?>
<taglib>
        <tlib-version>1.0</tlib-version>
	<jspversion>1.1</jspversion>
	<uri>http://www.mytld.com/tld/</uri>

        <function>
		<name>authorize</name>
		<function-class>com.mytld.util.MyUtil</function-class>
		<function-signature>boolean authorize(java.lang.String);</function-signature>
		<description>Remove html tags of text.</description>
	</function>
        ...
</taglib>

Otherwise, you just write a normal java method in the com.mytld.util.MyUtil (name and return must be the same with function-signature).

Regards
/Joy

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2009-10-26 12:21:41 +0800

Seen: 235 times

Last updated: Oct 26 '09

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More