cancel
Showing results for 
Search instead for 
Did you mean: 

unlock a user through WD program

Former Member
0 Kudos

Hi All, I need help on how to unlock the locked user (on portal) using WebDynpro programming. I have written the follwing code

IUserAccountFactory factory = UMFactory.getUserAccountFactory();

IUserAccount useraccount;

IUserAccount userAccount = null;

IUserAccount mUserAccount = null;

userAccount = factory.getUserAccountByLogonId(wdContext.currentUserdataElement().getUnique_id());

mUserAccount = factory.getMutableUserAccount(userAccount.getUniqueID());

// mUserAccount.setLocked(false,IUserAccount.LOCKED_NO);

mUserAccount.setLocked(false,IUserAccount.LOCKED_BY_ADMIN);

mUserAccount.save();

mUserAccount.commit();

I am getting error given bellow :

UME ExceptionUSER_AUTH_FAILED: User account for logonid "USER.PRIVATE_DATASOURCE.un:test3" not found!

note: test3 is the user id created by me. I am also not sure abt the following line

mUserAccount = factory.getMutableUserAccount(userAccount.getUniqueID());

What value should the method getMutableUserAccount() have? .Could some one help me .I promise to award points

Thank you in advance

Maruti

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi

Try this code.

IWDClientUser wdUser = WDClientUser.getCurrentUser();

IUser user = wdUser.getSAPUser();

IUserAccount[] acct = user.getUserAccounts();

String userId = acct[0].getLogonUid();

IUserAccountFactory accountFactory = UMFactory.getUserAccountFactory();

IUserAccount account = accountFactory.getUserAccountByLogonId(userId);

IUserAccount mutableAccount = accountFactory.getMutableUserAccount(account.getUniqueID());

mUserAccount.setLocked(false,IUserAccount.LOCKED_BY_ADMIN);

mUserAccount.save();

mUserAccount.commit();

It might helps , otherwise post your issues.

Thanks

Lohi.

Former Member
0 Kudos

Thank you Lohita,

Regards

Maruti

Message was edited by: Maruti cr

Former Member
0 Kudos

Hi Lohita,

Thx

Regards

Maruti

Message was edited by: Maruti cr

former_member197348
Active Contributor
0 Kudos

Hai Maruti,

Just check whether wdContext.currentUserdataElement().getUnique_id() return proper value?

Thanks,

Siva

Former Member
0 Kudos

Hi Siva,

Thank you for your reply.

wdContext.currentUserdataElement().getUnique_id() has the value USER.PRIVATE_DATASOURCE.un:test4

Regards

Purna