@Override
public void execute(WebScriptRequest req, WebScriptResponse res) throws IOException {
logger.info("inside Execute method ");
ServiceResponseDTO responseObject = new ServiceResponseDTO();
String message = req.getParameter(MESSAGE);
logger.info(message);
NodeRef node = serviceRegistry.getPersonService().getPerson("-me-");
logger.info("node is " + node);
if(node!= null) {
serviceRegistry.getNodeService().setProperty(node, USER_EMAIL_STATUS, message);
responseObject.setStatus(STATUS_SUCCESS);
responseObject.setMessage("Property update for node ");
} else {
responseObject.setStatus(STATUS_FAILED);
responseObject.setMessage("Node is not there ");
}
res.getWriter().write(new ObjectMapper().writeValueAsString(responseObject));
}
webscript
<bean id="webscript.customer.user-update.get"
class="com.UserUpdate" parent="webscript">
<property name="serviceRegistry">
<ref bean="ServiceRegistry" />
</property>
</bean>
<webscript>
<shortname>User Update</shortname>
<description> User Update</description>
<url>/collaborate/user/update?message={message}</url>
<format default="json"></format>
<authentication>user</authentication>
</webscript>
this is working for admin but not working for other user
Can you add some more details "-me-" is something which is confusing.Are you trying to get current logged in user?If that is so this is not the ppropriate method.Can you add the requirement for webscript as well?
-me- means current logged in user so I am updating property of logged in user
Below is the code for getting current logged in user name.
AuthenticationUtil.getFullyAuthenticatedUser();
Try to run the update code using transaction management and run that particular code as admin/system user.
JFYI: The moniker "-me-" relates to remote public REST API:
https://api-explorer.alfresco.com/api-explorer/#!/people/getPerson
Regards,
Jan
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.