How to create a new user in WorkflowGen using SQL script


#1

The following SQL query examples can be run directly in SQL Server Management Studio for SQL Server or in SQL Developer for Oracle.

  1. Add a new user (John Doe in this example) to the WorkflowGen directory with the minimum information required.

    Note: For Oracle, replace GETUTCDATE in the query shown below with (SELECT SYS_EXTRACT_UTC(SYSTIMESTAMP) FROM DUAL).

    INSERT INTO USERS
               (ID_USER
               ,ID_DIRECTORY
               ,DATE_CREATION
               ,LASTNAME
               ,FIRSTNAME
               ,USERNAME
               ,EMAIL
               ,ACTIVE
               ,BUILTIN
               ,ARCHIVE
               ,LANGUAGE
               ,ID_TIMEZONE)
         VALUES
               ((SELECT MAX(ID_USER)+1 FROM USERS)
               ,1
               ,GETUTCDATE()
               ,'Doe'
               ,'John'
               ,'johndoe'
               ,'johndoe@me.com'
               ,'Y'
               ,'N'
               ,'N'
               ,'en-US'
               ,9);
    
  2. Give the new user (John Doe) either an Administrator profile or a User profile.

    Administrator profile:

    INSERT INTO USERS_PROFILE
               (ID_USER
               ,ID_PROFILE)
         VALUES
               ((SELECT MAX(ID_USER) FROM USERS)
               ,1);
    

    User profile:

    INSERT INTO USERS_PROFILE
               (ID_USER
               ,ID_PROFILE)
         VALUES
               ((SELECT MAX(ID_USER) FROM USERS)
               ,2);
    
  3. Assign the new user (John Doe) to the My Group 1 group in the WorkflowGen directory.

    INSERT INTO USERS_GROUPS
               (ID_USER
               ,ID_GROUP)
         VALUES
               ((SELECT MAX(ID_USER) FROM USERS)
               ,(SELECT ID_GROUP FROM GROUPS WHERE GROUPNAME = 'My Group 1' AND ID_DIRECTORY = 1));