AnsweredAssumed Answered

Getting User Role programatically

Question asked by dynamolalit on Sep 14, 2009
Latest reply on Sep 15, 2009 by janv
Hi,

i want to get role of the user who has logged in programatically on click of delete icon.

I am getting user name & user role using this api

ServiceRegistry services = (ServiceRegistry) factory.getBean(ServiceRegistry.SERVICE_REGISTRY);
NodeService nodeServ = services.getNodeService();
User user1 = bean.getCurrentUser();
NodeRef nodeRef = user1.getPerson();
String username = (String) nodeServ.getProperty(nodeRef, WCMAppModel.PROP_WEBUSERNAME);
String userrole = (String) nodeServ.getProperty(nodeRef, WCMAppModel.PROP_WEBUSERROLE);

But i am getting null for both.

Can anyone tell me where it is going wrong or which api should i use to get the user role.

Outcomes