
You have referenced the user management development component tc/je/usermanagement/api in your project.
More information: Defining Development Component Dependencies .
For any functions that require write access to attributes, you have configured the relevant data sources of the user management engine (UME) for read-write access.
For the purpose of the example class, you have created a user with the user ID demo_user
This section provides an example of how to add user management functions for groups. This section demonstrates the following functions:
Creating groups
Assigning users to groups
Editing group attributes
Searching for groups
Displaying groups
Deleting groups
This code example provides a framework for you to plug in the example code from the group tasks in the sections that follow. This class imports the required interfaces, sets up the group management methods, and gets the required factories of the UME API.
package com.example;
import com.sap.security.api.*;
public class GroupTest {
public static void main() {
init();
createGroup("demo_group", "This group is for demo purposes.");
modifyGroup_setAssignment("demo_group", "demo_user");
modifyGroup_additionalAttribute("demo_group", "com.example", "myAttributeName",
"myValue");
groupStandardSearch("com.example", "myAttributeName", "myValue");
groupSimpleSearch("demo_group");
showGroup("demo_group", "com.example", "myAttributeName");
deleteGroup("demo_group");
}
// TODO: Add the method for the group function you want to test.
// --------------------------------------------------------------------------------
/*
* You only need the user factory for group assignment.
* You only need the principal factory for reading and editing group attributes.
*/
static IUserFactory userFactory;
static IGroupFactory groupFactory;
static IPrincipalFactory principalFactory;
public static void init() {
// Get the factories.
userFactory = UMFactory.getUserFactory();
groupFactory = UMFactory.getGroupFactory();
principalFactory = UMFactory.getPrincipalFactory();
}
}