code: @Programmatic
      public ApplicationUser newDelegateUser(
              final String username,
              final ApplicationRole initialRole,
              final Boolean enabled) {
          final ApplicationUser user = getApplicationUserFactory().newApplicationUser();
          user.setUsername(username);
          user.setStatus(ApplicationUserStatus.parse(enabled));
          user.setAccountType(AccountType.DELEGATED);
          if (initialRole != null) {
              user.addRole(initialRole);
          }
          container.persistIfNotAlready(user);
          return user;
      }
docs: region > newDelegateUser (action)