我需要为角色创建自定义权限,以根据用户角色显示/隐藏div's
和buttons
。在Internet上,找不到带有Spring MVC 4.3.21的Liferay 7.1的自定义权限。
这是一个带有示例的网站:Create Custom Permission and Show/Hide。
问题是我的结构项目与上面的示例不同。
我有一个春季项目。
项目结构:
web.xml
portlet.xml
liferay-portlet.xml
liferay-display.xml
spring-context(文件夹)
- 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>
Employee-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>