Java Code Examples for org.flowable.engine.IdentityService#saveUser()

The following examples show how to use org.flowable.engine.IdentityService#saveUser() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Application.java    From flowable-engine with Apache License 2.0 6 votes vote down vote up
@Bean
InitializingBean usersAndGroupsInitializer(final IdentityService identityService) {

    return new InitializingBean() {
        @Override
        public void afterPropertiesSet() throws Exception {

            // install groups & users
            Group group = identityService.newGroup("user");
            group.setName("users");
            group.setType("security-role");
            identityService.saveGroup(group);

            User josh = identityService.newUser("jlong");
            josh.setFirstName("Josh");
            josh.setLastName("Long");
            josh.setPassword("password");
            identityService.saveUser(josh);

            identityService.createMembership("jlong", "user");
        }
    };
}
 
Example 2
Source File: CreateUserAndMembershipTestDelegate.java    From flowable-engine with Apache License 2.0 6 votes vote down vote up
@Override
public void execute(DelegateExecution execution) {

    ManagementService managementService = Context.getProcessEngineConfiguration().getManagementService();
    managementService.executeCommand(new Command<Void>() {
        @Override
        public Void execute(CommandContext commandContext) {
            return null;
        }
    });

    IdentityService identityService = Context.getProcessEngineConfiguration().getIdentityService();

    String username = "Kermit";
    User user = identityService.newUser(username);
    user.setPassword("123");
    user.setFirstName("Manually");
    user.setLastName("created");
    identityService.saveUser(user);

    // Add admin group
    Group group = identityService.newGroup("admin");
    identityService.saveGroup(group);

    identityService.createMembership(username, "admin");
}
 
Example 3
Source File: Sample15RestApplication.java    From flowable-engine with Apache License 2.0 5 votes vote down vote up
@Bean
public CommandLineRunner usersAndGroupsInitializer(final IdentityService identityService) {
    return args -> {
        // install groups & users
        Group group = identityService.newGroup("user");
        group.setName("users");
        group.setType("security-role");
        identityService.saveGroup(group);

        User joram = identityService.newUser("jbarrez");
        joram.setFirstName("Joram");
        joram.setLastName("Barrez");
        joram.setPassword("password");
        identityService.saveUser(joram);

        User filip = identityService.newUser("filiphr");
        filip.setFirstName("Filip");
        filip.setLastName("Hrisafov");
        filip.setPassword("password");
        identityService.saveUser(filip);

        User josh = identityService.newUser("jlong");
        josh.setFirstName("Josh");
        josh.setLastName("Long");
        josh.setPassword("password");
        identityService.saveUser(josh);

        identityService.createMembership("jbarrez", "user");
        identityService.createMembership("filiphr", "user");
        identityService.createMembership("jlong", "user");
    };
}
 
Example 4
Source File: SpringIdmTransactionsTest.java    From flowable-engine with Apache License 2.0 5 votes vote down vote up
@Override
public void notify(DelegateTask delegateTask) {
    IdentityService identityService = Context.getProcessEngineConfiguration().getIdentityService();
    User user = identityService.newUser("Kermit");
    user.setFirstName("Mr");
    user.setLastName("Kermit");
    identityService.saveUser(user);
}
 
Example 5
Source File: SpringIdmTransactionsTest.java    From flowable-engine with Apache License 2.0 5 votes vote down vote up
@Override
public void execute(DelegateExecution execution) {

    ManagementService managementService = Context.getProcessEngineConfiguration().getManagementService();
    managementService.executeCommand(new Command<Void>() {

        @Override
        public Void execute(CommandContext commandContext) {
            return null;
        }
    });

    IdentityService identityService = Context.getProcessEngineConfiguration().getIdentityService();

    String username = "Kermit";
    User user = identityService.newUser(username);
    user.setPassword("123");
    user.setFirstName("Manually");
    user.setLastName("created");
    identityService.saveUser(user);

    // Add admin group
    Group group = identityService.newGroup("admin");
    identityService.saveGroup(group);

    identityService.createMembership(username, "admin");
}
 
Example 6
Source File: IdmTransactionsTest.java    From flowable-engine with Apache License 2.0 5 votes vote down vote up
@Override
public void notify(DelegateTask delegateTask) {
    IdentityService identityService = Context.getProcessEngineConfiguration().getIdentityService();
    User user = identityService.newUser("Kermit");
    user.setFirstName("Mr");
    user.setLastName("Kermit");
    identityService.saveUser(user);
}