Detecting the User Role 
The API provides a possibility to implement different behavior depending on the current user’s role and permissions in a workspace.
The following example illustrates how to detect the role to which the user belongs.
Example
private void detectUserRole(IPortalComponentRequest request)
{
// Get the workspace in which this module is running
IModuleContext moduleContext = ModuleHelper.getModuleContext(request);
IWorkspaceFactory workspaceFactory = (IWorkspaceFactory) RuntimeFactory.getWorkspacesRuntime().getService(IWorkspaceFactory.class);
IIdentifier workspaceIdentifier = moduleContext.getModuleID().getWorkspaceID();
IWorkspace workspace = workspaceFactory.getWorkspace(moduleContext.getUser() ,workspaceIdentifier);
// Check if the user is manager in this workspace
boolean isManager = workspace.getMemberList().isManager(request.getUser());
// Get owner
IUser ownerUser = (IUser) workspace.getMemberList().getOwner();
// Check if the user is member in this workspace
IUser memberToCheck = null;
try {
memberToCheck = UMFactory.getUserFactory().getUser("userToCheck");
}
catch (UMException e) {
// handle exception;
}
boolean isMember = workspace.getMemberList().getRole(WorkspaceRole.MEMBER).isUserInRole(memberToCheck);
}
Package
The relevant APIs are contained in the com.sap.workspaces.workspace package.