Quantcast
Channel: SCN : All Content - SAP Enterprise Portal
Viewing all articles
Browse latest Browse all 3876

Get Role Info of user by coding

$
0
0

Hi ,

 

I have to get roles of user by coding.

 

Scenario : we have one Group named as Group A having 5 roles .

                  and also have one user named as test user having 2 roles. And Test user  assigned to Group A.

   Group A = 5 Role

Test user = 2 Role.

  so finally Test user having 7 roles

 

I'm trying to get roles ( should get  2 Roles) of test user alone by code. but i'm getting  7 roles  by below coding.

 

                                       IUserFactory ufactory=UMFactory.getUserFactory();

                                                                                IRoleFactory rfcat=UMFactory.getRoleFactory();

                                                                                IUser myuser=ufactory.getUserByLogonID(userID);

                                       Iterator i=myuser.getRoles(true);

                                       IRole urole=null;

 

                                                                                while(i.hasNext())

                                                                                { 

                                                                                  String s=(String)i.next();

                                                                                  urole=rfcat.getRole(s);

                                                                                  String desc= urole.getDescription();

                                       }

This code giving group role(5 roles) + User roles(2 roles) = 7 roles.

but i need user roles alone (2 roles)

 

 

Can anyone please help me to get this scenario.

 

 

Cheers,

Prasad.

 

 



Viewing all articles
Browse latest Browse all 3876

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>