Docs > API > User

A PostCMS user.
Properties
email The user's email address.
name The username
realName The user's full name, e.g. "Tom Jones".
Methods
User.get(username) Static method returning the named user.
User.getMe() Static method returning the current user.
hasCapability(name) Check whether the user has the named permission.
hasRole(name) Check whether the user has the named role.
sendEmail(arg) Send an email to the user. This is intended for sending notification emails and so on from workflows. The single argument is an object literal defining the email fields. See below for an example.
Example of sending email:
Page home = Page.get('index.php');
User u = User.get(home.owner);
u.sendEmail({
subject: 'Automatic notification',
message: 'You are the home page owner'
});



Can't find what you're looking for?

Let us know and we'll see if we can help.