/
Commenting and Markups

Commenting and Markups

FAQ

How to change the author in comments?

The user information (author) of a comment is written by the API server.

Kudo is sending a "sessionId" header with each API request where the sessionId is that one you pass to the editor url when you open a drawing

The API server should use this sessionId to retrieve the current user information associated with this sessionId and write "author" information to comment data json.

The sample API server provides you with a sample of how to implement the comments API on your end and how to write the author information.

See {SampleAPIServerLoctation}/server/api/controllers/comments.js, getAuthor implementation

function getAuthor(sessionId) { var user_object = user_sessions.getUser(sessionId); var authorObject = { id: user_object["_id"], name: user_object.fname + " " + user_object.surname, email: user_object.email }; return authorObject; }

It is called from comment APIs implementation that save the comment data to disk.

user_sessions.getUser retrieves the user information corresponding to the sessionId.

See {SampleAPIServerLoctation}/server/api/helpers/user_sessions.js, has a sample implementation for getUser

const getUser = (session) => { // TODO: validate session and return the correct user object return { fname : "John", surname : "Doe", "_id" : "1000", email : "john.doe@graebert.com", licenseExpirationDate : 1582934399000, preferences : { preferences_display : { graphicswinmodelbackgrndcolor : "Black" }, view : { }, window : { }, variables : { dynasnap : "63" }, }, } };

Here you can add your implementation and return the current user information associated with the sessionId.

Related content

Kudo Editor iframe → Partner Web Application
Kudo Editor iframe → Partner Web Application
More like this
ARES Kudo Server Configuration
ARES Kudo Server Configuration
Read with this
Kudo api server with UI
Kudo api server with UI
Read with this