Check permission for any PortalObjectNode instance
(from http://jboss.org/index.html?module=bb&op=viewtopic&t=98906)
Access to PortalAuthorizationManagerFactory, then to the PortalAuthorizationManager for permission checking.
From within a portlet, retrieve this factory using :
PortalAuthorizationManagerFactory pamf = (PortalAuthorizationManagerFactory) getPortletContext().getAttribute("AMF");
Then use the checkPermission() method of the Manager.
You have to inject the service in the portlet context attribute, by declaring in jboss-portlet.xml file :
<service> <service-name>AMF</service-name> <service-class>org.jboss.portal.security.spi.auth.PortalAuthorizationManagerFactory</service-class> <service-ref>:service=PortalAuthorizationManagerFactory</service-ref> </service>
Comments