cancel
Showing results for 
Search instead for 
Did you mean: 

How to make an user into Service authenticated user like cmadmin_service

Former Member
0 Kudos

Hi All,

I am trying to fetch the list of documents, properties, log on/logoff functionality with an iUser ex: epuser, through java code.

The list of docs are presented in the Documents Folder with teh following sample code

|

RID rid = RID.getRID("/documents");

String userName = "epuser";

IUserFactory userFactory = UMFactory.getUserFactory();

com.sap.security.api.IUser userNew;

userNew = userFactory.getUser(userName);

com.sapportals.portal.security.usermanagement.IUser user = WPUMFactory.getUserFactory().getEP5User(userNew);

ctx.setUser(user);

IResource res = null;

res = ResourceFactory.getInstance().getResource(rid, ctx);

wnen i am trying to fetch all the docs and the corresponding properties by passing " cmadmin_service " as an user name. i am getting the right results. But when i tried with "epuser " i am getting the output as Service Authentication value false.

Then i added epuser in the System Principal--->System User. still i am not getting the right results.

plz help me how to make this epuser as service authenticated user like cmadmin_service user

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi phani,

I have no direct solution but you should check the service permissions of the resources you are trying to fetch. The exception sounds like there is the problem. Go to the Details of the CM-Resource and Select Settings-->Service Permissions.

Does the epuser has the necessary permissions for your operations?

Another thing is the way you are creating users:

The WPUMFactory has a special factory-method for creating service users. Perhaps this is a better aproach:


WPUMFactory.getServiceUserFactory().getServiceUser(user);

Best regards,

Stefan Brauneis

Former Member
0 Kudos

Hi,

I think you should use <i>serviceContext</i> to get the service user context. THis works for sure:


IResourceFactory m_Factory = ResourceFactory.getInstance();
IResourceContext context = m_Factory.getServiceContext("cmadmin_service");
RID rid = RID.getRID("/documents");
IResource res  = m_Factory.getResource(rid, context);

A long time ago (~EP6 SP2) I was also trying to add a service user with no success, so now I just use the <i>cmadmin_service</i> user...

Romano