Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
jainmayank85
Explorer

Hello Friends,

Agenda:

               Make a Portal Service to listen UME activities and perform operations as per requirement. We can listen like user\role\group addition or modification.

Lets start step by step , I am showing how to log UME activities in Developer traces :

1)     Create an Enterprise Application from File->New-> Create a Portal Project and then create a Portal Service in that project.

2)     Service will create 2 files i.e. Service interface and Class to implement Service interface.

3)     Now include com.sap.security.api jar . This will provide User\Role\Group listeners , listener is interface (UserListeners, RoleListeners, GroupListeners). So we have to implement these interfaces to listen UME activities. You can implement these listeners in the same class that is implementing service interface. Lets take an example of RoleListener.

4)     First we have to register Listener , below is the code to register . Like below code we can register for other listeners as well.

          RoleListener roleListener = new "Classname that is implementing RoleListener"();

          IRoleFactory userFactory=UMFactory.getRoleFactory();

          userFactory.registerListeners(roleListener, RoleListener.INFORM_ON_USER_ASSIGNED);

        

5)     RoleListener interface has some methods that will come automatically after implementing . So leave those methods blank which you don't want to listen. Like I am using INFORM_ON_USER_ASSIGNED , so as per my requirement i'll get data in method public void userAssigned (String arg0 , String arg1) throws UMException{} only.

6)     Now I want to check "which role is modified" , "assigned userid"  , "who modified" and at what time .In method userAssigned , arg0 is role name and arg1 is  username. To get who modified role you have to put below code and for time just add date variable:

          IUser user=UMFactory.getAuthenticator().getLoggedinUser();

          Date date=new date();

7)     Import com.sap.tc.logging.Location to log entries . Use logger wherever you want to log entries.

Now you will be able to implement Service and find out who is performing Security activities.

Hope this is helpful......

Thanks You,

Regards,

Mayank Jain

1 Comment
Labels in this area