Skip to Content
0

How to update SAP EP IUserAccount SecurityPolicy UME users

Apr 24 at 04:59 AM

75

avatar image

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

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Best Answer
Nick Rankin
Apr 24 at 09:49 AM
1

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

Share
10 |10000 characters needed characters left characters exceeded
Vikas Kerehalli Apr 25 at 12:58 PM
0
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

Share
10 |10000 characters needed characters left characters exceeded
Vikas Kerehalli Apr 24 at 01:58 PM
0

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

Show 1 Share
10 |10000 characters needed characters left 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

1