Announcement Announcement Module
Collapse
No announcement yet.
enabling disabling menuitem in menubar Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • enabling disabling menuitem in menubar

    I would like after the login form to be able to "greyed" or to hide some menuitems in the menubar.
    Is there any possiblities to disable or hide menuitems in the menuBar ?

    Example
    if you log as an admin, you can access to adminMenu
    if you log as user, you do not.

    Thanks for your help

  • #2
    Spring Rich Client foresees in possibilities to link security credentials to the enabling/disabling of commands or other components (such as binders) for that matter.
    For this, Spring RCP has tight integration with Spring Security. You can configure any command with a security controller, which can then alter the enabled/disabled state of your component. Take a look at SecurityControllable, SecurityController and the other classes in the org.springframework.richclient.security package.

    Comment


    • #3
      I'm using spring-security for allowing access to my application with a login Form

      In command-context.xml
      I add
      <bean id="myCreateCommand" class="com.xxx.MyCommand">
      <property name="securityControllerId" value="adminController"/></bean>
      and I set
      <bean id="adminController" class="org.springframework.richclient.security.sup port.UserRoleSecurityController">
      <property name="authorizingRoles" value="ROLE_ADMIN" />
      </bean>
      I succeed to disable menu but if I give to my User the ROLE_ADMIN Role
      The command from the menu is still disabled.My user still not have access

      GrantedAuthority[] arrayAuths = new GrantedAuthority[1];
      arrayAuths[0]= new GrantedAuthorityImpl("ROLE_ADMIN");
      What do I miss ?

      Comment


      • #4
        find it

        I miss to add

        <bean id="securityAwareConfigurer"
        class="org.springframework.richclient.security.Sec urityAwareConfigurer"
        lazy-init="false"/>

        Now, it is working, thanks for you jelp

        Comment


        • #5
          premium quality wigs

          Specializing in lace front wigs, lace wigs premium quality wigs, full lace front wigs and synthetic wigs. Every wig in our luxurious collection is made with best-in-class Remy hair, synthetic hair, cap design, and construction.

          Comment


          • #6
            something strange

            I have something strange
            In commands-context.xml I have

            Code:
             <bean id="reportCommand" class="com.MyBeanCommand">
                <property name="securityControllerId" value="adminController"/>
            </bean>
            In security-context.xml, I have
            Code:
            <bean id="adminController" class="org.springframework.richclient.security.support.UserRoleSecurityController">
                   <property name="authorizingRoles" value="ROLE_ADMIN" />
               </bean>
              <bean id="accessDecisionManager" class="org.acegisecurity.vote.AffirmativeBased">
                <property name="allowIfAllAbstainDecisions" value="false" />
                <property name="decisionVoters">
                  <list>
                    <ref bean="roleVoter" />
                  </list>
                </property>
              </bean>
            MyBean.java
            Code:
            public class MyBeanCommand extends ApplicationWindowAwareCommand {
            
                private static final String ID = "myBeanCommand ";
            ...............
            ............
            }
            When I check my user information, I see that I have ROLE_ADMIN in grantedAuthority property
            I do not have access to MyBeanCommand in the menu
            But, if I change my commands-context by
            [CODE]
            Code:
             <bean id="reportCommand" class="com.MyBeanCommand">
                <property name="securityControllerId" value="blabla"/>
            </bean>
            I have access. Can anybody understand what it is wrong ?

            Comment

            Working...
            X