Skip to Content

How to update SAP EP IUserAccount SecurityPolicy UME users

Hi,

The below is our current code, which is running successfully to create new test users with

SecurityPolicy to default .

IUserMaint newUser = userfact.newUser(PortalID);
newUser.setFirstName(Firstname);
newUser.setLastName(Lastname);
newUser.setEmail(EmailID);
Locale PortalLang = new Locale("en");
newUser.setLocale(PortalLang);
newUser.save();
newUser.commit();
IUserAccount useracc = UMFactory.getUserAccountFactory().newUserAccount(PortalID,
newUser.getUniqueID());
useracc.setPassword(NewUserPWD);
useracc.save();
useracc.commit();


Now we a have new scenario that while creating new users we need to update the user type to Technical User (Security Policy).

I don't see that property or method is not available to use in the code(setSecurityPolicy

(com.sap.security.api.*))

Have referred the below link but the below method is not available to use.

https://archive.sap.com/discussions/thread/1876052#


Eg.

IUserAccount userAccount = accountFactory.getMutableUserAccount(<UNIQUE ID OF USER>);

userAccount.setSecurityPolicy("<SECURITY POLICY>"); //In my case I'm changing it to technical

userAccount.save();

userAccount.commit();

Please help to suggest, how we can update the user type to Technical User using the code.

What are the other ways of achieving this scenario.

Thanks, SMSVikasK

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    Apr 24 at 09:49 AM

    Hi Vikas,

    Have you tried using 'SECURITY_POLICY_TYPE_TECHNICAL' constant instead of simply technical, e.g:

    userAccount.setSecurityPolicy(IUserAccount.SECURITY_POLICY_TYPE_TECHNICAL);


    Best regards,

    Nick

    Add comment
    10|10000 characters needed characters exceeded

  • Apr 25 at 12:58 PM
    Thanks a lot :) .

    It worked perfectly. The jar was having the required methods com.sap.security_2.0.0.110922073749.jar.

    NWDS Code:

    useracc.setSecurityPolicy(IUserAccount.SECURITY_POLICY_TYPE_TECHNICAL);

    Complied :

    useracc.setSecurityPolicy("technical");

    Thank you. SMSVikasK

    Add comment
    10|10000 characters needed characters exceeded

  • Apr 24 at 01:58 PM

    Hi Nick,

    Thanks for your reply.

    We are using SAP EP 7.4 SPS12, We have referenced the jar (com.sap.security.api.*) and trying to find the methods you told to use. buts its not available to use. I can see other properties but not the below.

    userAccount.setSecurityPolicy(IUserAccount.SECURITY_POLICY_TYPE_TECHNICAL);

    Are you able give code samples having code properties of this *setSecurityPolicy*

    what version your are referring to where this method is there.

    Thanks

    SMSVikasK

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Vikas,

      The IUserAccount interface is inside <nwds-dir>\eclipse\plugins\com.sap.security_<version>.jar. You should be ok once you add the .jar to your project build path.


      If you continue to get build errors please provide the stack trace


      Best regards,

      Nick