Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
import java.util.Set;
import org.joget.apps.app.service.AppUtil;
import org.joget.commons.util.SecurityUtil;
import org.joget.directory.dao.UserDao;
import org.joget.directory.dao.RoleDao;
import org.joget.directory.model.User;
import org.joget.directory.model.service.DirectoryUtil;
import org.joget.directory.model.service.UserSecurity;
 
UserSecurity us = DirectoryUtil.getUserSecurity();
 
UserDao userDao = (UserDao) AppUtil.getApplicationContext().getBean("userDao");
RoleDao roleDao = (RoleDao) AppUtil.getApplicationContext().getBean("roleDao");
 
//Create an User
User user = new User();
user.setId("testuser");
user.setUsername("testuser");
user.setTimeZone("0");
user.setActive(1);
user.setFirstName("Test User");
if (us != null) {
    user.setPassword(us.encryptPassword("testuser", "password"));
} else {
    user.setPassword(StringUtil.md5Base16("password"));
}
user.setConfirmPassword("password");
 
//set role
Set roleSet = new HashSet();
roleSet.add(roleDao.getRole("ROLE_USER"));
user.setRoles(roleSet);
 
userDao.addUser(user);
if (us != null) {
    us.insertUserPostProcessing(user);
}

Methods

Thai

กระบวนการ

getPropertyOptions
public java.lang.String getPropertyOptions()
English
Get JSON property options to embed into the property options of Directory Manager Plugin
Thai

รับตัวเลือกคุณสมบัติ JSON เพื่อฝังลงในตัวเลือกคุณสมบัติของปลั๊กอินตัวจัดการไดเรกทอรี

...