on 04-24-2018 5:59 AM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
NWDS Code:
useracc.setSecurityPolicy(IUserAccount.SECURITY_POLICY_TYPE_TECHNICAL);
Complied :
useracc.setSecurityPolicy("technical");
Thank you. SMSVikasKYou must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.