1

How to call ViewModel method with parameter

asked 2014-03-27 13:40:49 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

updated 2014-03-27 13:41:36 +0800

zul:
<button visible="@load(vm.allowed, right='btnTest')"

java:
  public boolean isAllowed(@BindingParam("right") String right) {

        // TODO get from GrantedRights (Spring)
        System.out.println("XXXXXXXXXXXXX " + right);
        return true;
    }

I do not find usefull informations how the syntax goes right, or if this is not possible.

Thanks for all infos.

Stephan

delete flag offensive retag edit

4 Answers

Sort by ยป oldest newest most voted
1

answered 2014-03-27 18:36:04 +0800

chillworld gravatar image chillworld flag of Belgium
5367 4 9
https://github.com/chillw...

updated 2014-03-27 18:37:06 +0800

I thought is was like this :

<button visible="@load(vm.isAllowed('btnTest')"/>

and you don't need to set the bindingparam.

As described in this topic.

Greetz chill.

link publish delete flag offensive edit
1

answered 2014-03-28 05:49:25 +0800

chillworld gravatar image chillworld flag of Belgium
5367 4 9
https://github.com/chillw...

updated 2014-03-28 05:50:10 +0800

Terry,

You use spring security

Maybe you can do this also (depends of course it has something to do with the roles) :

<?taglib uri="http://security/util" prefix="sec" ?>
<button if="${sec:isAnyGranted('ROLE_1,ROLE_2')}"/>

greetz chill.

link publish delete flag offensive edit
1

answered 2014-03-28 08:24:17 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

Yes chill,

thanks for the hint.

best Stephan

link publish delete flag offensive edit
0

answered 2014-03-27 22:57:57 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

updated 2014-03-27 23:00:21 +0800

Argh, i have tried a few things. Yours is better. Works. Great.

Many thanks chill

zul:
<button label="Add New" visible="@load(vm.isAllowed('btnNew'))" onClick="@command('onAddNew')"></button>

java: public class BaseVM {

    /**
     * Check if it's allowed. Checks against the SpringSecurity Granted Rights.
     * 
     * @param rightname The right name.
     * @return True if it's allowed otherwise false.
     */
    public boolean allowed(String rightname) {

        // TODO get from GrantedRights (Spring)
        System.out.println("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" + rightname);
        return true;
    }

}
link publish delete flag offensive edit

Comments

your welcome

chillworld ( 2014-03-28 04:35:14 +0800 )edit
Your answer
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
1 follower

RSS

Stats

Asked: 2014-03-27 13:40:49 +0800

Seen: 80 times

Last updated: Mar 28 '14

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