These events occur when a principal (role) is added to a workspace in which the module is running. To register for these events, you need to create a property com.sap.workspaces.module.metadata.extension~principal in the portalapp.xml , for example:
<property name="com.sap.workspaces.module.metadata.extension~principal" value="prt_service:com.yourname.portal.workspaces.modules.MyExtensionService"/>
The workspace member role is added to a workspace after its permission policy has been changed from public to restricted or private.
public void onAddPrincipal(PrincipalInfo principalInfo, IModuleContext moduleContext) { // Get workspace role WorkspaceRole workSpaceRole = principalInfo.getWorkspaceRole(); String roleID = principalInfo.getID(); try { // Get UME principal IPrincipal UMEPrincipal = UMFactory.getPrincipalFactory().getPrincipal(roleID); // Do something for the UME principal, such as set permission in a back-end system } catch (UMException e) { // Handle error } }
The workspace member role is removed when a workspace permission policy has been changed from public to restricted or private.
public void onRemovePrincipal(PrincipalInfo principalInfo, IModuleContext moduleContext) { // Get workspace role WorkspaceRole workSpaceRole = principalInfo.getWorkspaceRole(); String roleID = principalInfo.getID(); try { // Get UME principal IPrincipal UMEPrincipal = UMFactory.getPrincipalFactory().getPrincipal(roleID); // Do something with the UME principal, such as remove permission on a back-end system } catch (UMException e) { // Handle error } }