Command to execute usergrpdef to add user

 4 Replies
 1 Subscribed to this topic
 27 Subscribed to this forum
Sort:
Author
Messages
Roger French
Veteran Member
Posts: 549
Veteran Member

    Has anyone have a LID command to automatically add a new user to a user group, using usergrpdef. I have the user, group (existing), but I want to run it in a command, and not have to run usergrpdef manually and the subscreens to add the user to the group, etc.

    Thanks in advance.

    Edited: 

    This is V10 so LAUA is not possible. 

    Also I am trying to avoid manually populating the required GEN Tables.

     

     

    Kwane McNeal
    Veteran Member
    Posts: 479
    Veteran Member
      Two ways I know of:
      1) Pass a keystroke stream to usergrpdef
      2) load the data directly into GEN
      ...I have never done it using method #1, but I have done something similar with laua, and know it's possible.

      Unless you have some odd requirement for using usergrpdef, I'd use method #2
      Leonard Courchaine
      Veteran Member
      Posts: 55
      Veteran Member
        Hi, I've done it using method #2 described above. Here's the shell script code that I use that does even more than you're asking:
        echo "Adding Lawson environment data..."
        # Next, we'll add usergrpdef needed values
        sqlplus -s gen/$mGen < set echo off
        set feedback off
        UPDATE gen.userinfo
        set usergrp='LSFALL', jobqgrp='LSFALL'
        where username='$mAIXID';
        UPDATE gen.r_user
        set printergroup='LSFALL'
        where username='$mAIXID';
        INSERT INTO gen.usergrpdtl
        (USERGRP, USERNAME, R_TYPE)
        VALUES
        ('LSFALL','$mAIXID','55');
        exit
        EOF11

        (you can see that I'm using variables for the gen pword along with the user)
        Let me know if you have questions.
        Kwane McNeal
        Veteran Member
        Posts: 479
        Veteran Member
          Another would be to write temp files, and use importdb.
          This is the tool I use if it's in a script.

          Leonard's script also looks good, just remember to update the literal values.
          Roger French
          Veteran Member
          Posts: 549
          Veteran Member

            But the thing with the SQL INSERT, for new records (adding a new record) into R_USER, because the columns are all NOT_NULL type (SQL DB, LSFV10.0.9), you have to have all the values in R_USER populated using SQL INSERT. I don't want to populate all of the columns in R_USER because for this install, the values aren't needed.

            I'll just use importdb instead.