首页 > 解决方案 > Liferay Spring MVC 权限检查器

问题描述

我需要为角色创建自定义权限以显示/隐藏div'sbuttons取决于用户角色。在 Internet 上,我找不到使用 Spring MVC 4.3.21 对 Liferay 7.1 的自定义权限。

这是一个带有示例的站点:创建自定义权限和显示/隐藏

问题是我的结构项目与上面的示例不同。

我有一个春季项目。

项目结构:

web.xml

portlet.xml

liferay-portlet.xml

liferay-display.xml

弹簧上下文(文件夹)

- spring-context
    portlet-application-context.xml
      - portlet:
          Employee-portlet.xml

portlet.xml

<portlet>
        <portlet-name>Employee</portlet-name>
        <display-name>Employee</display-name>
        <portlet-class>org.springframework.web.portlet.DispatcherPortlet</portlet-class>
        <init-param>
            <name>contextConfigLocation</name>
            <value>/WEB-INF/spring-context/portlet/Employee-portlet.xml</value>
        </init-param>
        <expiration-cache>0</expiration-cache>
        <supports>
            <mime-type>text/html</mime-type>
        </supports>
        <portlet-info>
            <title>Employee</title>
            <short-title>Employee</short-title>
            <keywords>Employee</keywords>
        </portlet-info>
        <security-role-ref>
            <role-name>administrator</role-name>
        </security-role-ref>
        <security-role-ref>
            <role-name>guest</role-name>
        </security-role-ref>
        <security-role-ref>
            <role-name>power-user</role-name>
        </security-role-ref>
        <security-role-ref>
            <role-name>user</role-name>
        </security-role-ref>
    </portlet>

员工-portlet.xml

<bean id="portletModeHandlerMapping"
          class="org.springframework.web.portlet.handler.PortletModeHandlerMapping">
        <property name="portletModeMap">
            <map>
                <entry key="view">
                    <ref bean="employeeV## Heading ##iewController" />
                </entry>
            </map>
        </property>
    </bean>

标签: springpermissionsliferay

解决方案


推荐阅读