GetUser()
ts
GetUser(): User;Returns a reference to the authenticated User object for the current session, if any.
WARNING
This function may return null if no user has been authenticated yet. Always check for null before using the returned object. If you only need the user's ID, it is safer to use Session.GetUserID(), which never returns null (it returns an empty string if no user is authenticated).
Example
ts
{
if (Session) {
var user = Session.GetUser();
if (user) {
// We have a valid User object, so we can use it here...
}
} else {
Log('Session object is not available.');
}
}Certain event-handlers can only be triggered by conditions that require an authenticated user. For example, AfterFileUpload runs after a file upload, which cannot occur unless a user is authenticated. In such cases, you may safely skip the null-check.
