public void removePortletRegistration ( IPerson person , PortletDefinitionForm form ) { /* TODO: Service-Layer Security Reboot (great need of refactoring with a community-approved plan in place) */ // Arguably a check here is redundant since -- in the current // portlet-manager webflow -- you can't get to this point in the // conversation with out first obtaining a PortletDefinitionForm; but // it makes sense to check permissions here as well since the route(s) // to reach this method could evolve in the future. // Let's enforce the policy that you may only delete a portlet thet's // currently in a lifecycle state you have permission to MANAGE. // (They're hierarchical.) if ( ! hasLifecyclePermission ( person , form . getLifecycleState ( ) , form . getCategories ( ) ) ) { logger . warn ( "User '" + person . getUserName ( ) + "' attempted to remove portlet '" + form . getFname ( ) + "' without the proper MANAGE permission" ) ; throw new SecurityException ( "Not Authorized" ) ; } IPortletDefinition def = portletDefinitionRegistry . getPortletDefinition ( form . getId ( ) ) ; /* * It's very important to remove portlets via the portletPublishingService * because that API cleans up details like category memberships and permissions. */ portletPublishingService . removePortletDefinition ( def , person ) ; }
Delete the portlet with the given portlet ID .