Creating users from scripts
The script allows you to create users and assign them the user role.
Download file create-users_okm.xlsx
The string "newId" is the user Id what will be set.
The string "newPassword" is the user password what will be set.
The string "newMail@mail.com" is the user mail what will be set.
The string "newRealName" is the user real name what will be set.
import com.openkm.util.ContextWrapper;
import com.openkm.api.OKMAuth;
import com.openkm.bean.User;
OKMAuth okmAuth = ContextWrapper.getContext().getBean(OKMAuth.class);
User user = new User("newId", "newPassword", "newMail@mail.com", "New Real Name", true);
okmAuth.createUser(null, user);
okmAuth.assignRole(null, user.getId(), "ROLE_USER");