AnsweredAssumed Answered

how to update property of user  using -me- ?

Question asked by dharmraj on Jul 17, 2019
Latest reply on Jul 18, 2019 by janv

@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 

 

{
    "status": {
        "code": 500,
        "name": "Internal Error",
        "description": "An error inside the HTTP server which prevented it from fulfilling the request."
    },
    "message": "06171445 Access Denied.  You do not have the appropriate permissions to perform this operation.",
    "exception": "",
    "callstack": [],
    "server": "Enterprise v5.2.3 (r852994b1-b12) schema 10,065",
    "time": "Jul 17, 2019 12:10:52 PM"
}

Outcomes