Does one of the programs in the stack specify Use Adopted Authority
*NO?
Denny
The user who is adding another user profile to a group profile must have
object management rights to the group profile and those rights may not
be inherited by adopting authority
That sounds plausible but I have another CLP that runs stand-alone and
is able to make any changes without having any rights to the group
profile other than the adopted authority of QSECOFR.
Denny Davis <sp...@nowhere.com> wrote in message news:<ltt9b09b0uj6fkqvu...@4ax.com>...
It appears that you are indeed correct. I discovered that the CLP
that was working did not allow a change of the GRPPRF. When I added
that parameter, it failed the same as the CLP that is called by the
other programs. So even though no change is being made to the GRPPRF,
the presence of the parameter causes additional checking. This also
occurs on other parameters (like PRTDEV)which is the root of the
problem. How can you delegate user profile management if you have to
give rights to every object that might be changed?
The extended help for CHGUSRPRF clearly explains this restriction,
furthermore it only applies to the group and supplemental group
parameters.
If you are having troubles with other parms, then it is due to other
reasons.
The simplest solution to the problem is to grant *OBJMGT authority on
the group profiles to those users that are allowed to maintenance user
profiles.
The other work-around is to have the program swap user profiles to a
user id with sufficient authority by using the QSYGETPH, QWTSETP APIs
The following CL program and command definition demonstrates a
generalized CL program for executing commands under another user
profile:
WRKASUSER ADMIN CMD('CHGUSRPRF JOHNUSER GRPPRF(GROUPA)')
/********************************************************************/
/* This is the command processor program for the WRKASUSER command. */
/* */
/* Be sure to compile with USRPRF(*OWNER) */
/********************************************************************/
PGM (&NEWUSER &CMDSTR)
DCL &NEWUSER *CHAR 10
DCL &CMDSTR *CHAR 512
DCL &OLDHANDLE *CHAR 12
DCL &NEWHANDLE *CHAR 12
DCL &MSGKEY *CHAR 4
Dcl &ErrMsgId *Char 7
Dcl &ErrMsgFile *Char 10
Dcl &ErrMsgFlib *Char 10
Dcl &ErrMsgDta *Char 512
Dcl &ErrFlag *Lgl Value('0')
/*-----------------------------------------------------------------*/
/* By making the program a request processor, SYS RQS 2 (CNLRQS) */
/* can be trapped and the profile swapped back */
/*-----------------------------------------------------------------*/
SNDPGMMSG MSG('make rpp') TOPGMQ(*SAME) MSGTYPE(*RQS) +
KEYVAR(&MSGKEY)
RCVMSG MSGTYPE(*RQS) MSGKEY(&MSGKEY) RMV(*NO)
/*-----------------------------------------------------------------*/
/* Save the current job's profile handle, then get the get the */
/* the handle of the new user profile */
/*-----------------------------------------------------------------*/
CALL QSYGETPH (*CURRENT *NOPWD &OLDHANDLE)
CALL QSYGETPH (&NEWUSER *NOPWD &NEWHANDLE)
CALL QWTSETP (&NEWHANDLE)
/*-----------------------------------------------------------------*/
/* Execute the command in the command string */
/*-----------------------------------------------------------------*/
CALL QCMDEXC (&CMDSTR 512)
MONMSG MSGID(CPF0000) +
EXEC(DO)
/*-------------------------------------------------------------*/
/* Get the escape message that caused QCMDEXC to fail */
/*-------------------------------------------------------------*/
CHGVAR &ErrFlag '1'
RCVMSG MSGTYPE(*EXCP) MSGDTA(&ErrMsgDta) MsgId(&ErrMsgId) +
MSGF(&ErrMsgFile) SNDMSGFLIB(&ErrMsgFLib)
ENDDO
/*-----------------------------------------------------------------*/
/* Removing the request message changes the program back to a */
/* normal program
/*-----------------------------------------------------------------*/
RMVMSG MSGKEY(&MSGKEY)
CALL QWTSETP (&OLDHANDLE)
CALL QSYRLSPH (&NEWHANDLE)
CALL QSYRLSPH (&OLDHANDLE)
IF &ErrFlag +
SNDPGMMSG MSGID(&ErrMsgID) MSGF(&ErrMsgFLib/&ErrMsgFile) +
MSGDTA(&ErrMsgDta) MSGTYPE(*ESCAPE)
ENDPGM
/* Command definition */
CMD PROMPT('Work as User')
PARM KWD(USER) TYPE(*SNAME) LEN(10) MIN(1) +
PROMPT('User Name')
PARM KWD(CMDSTRING) TYPE(*CHAR) LEN(512) MIN(1) +
PROMPT('Command')