function populateUserInfo(user) {
  if (!user)
    return; // Permissions will be at their default value (false)

  // For now, we don't let users delete things they've created,
  // since things are collaborative in nature
  this.userCanDelete = user.isSuperUser || user.isSiteModerator || false;
  this.userCanEdit = user.isSuperUser || user.isTrusted || user.id === this.createdBy;
  this.userCanUpload = user.isSuperUser || user.isTrusted;
  this.userIsCreator = user.id === this.createdBy;
}
/**
 * Populate virtual permission fields in a Thing object with the rights of a
 * given user.
 *
 * @param {User} user
 *  the user whose permissions to check
 * @memberof Thing
 * @instance
 */
Populate virtual permission fields in a Thing object with the rights of a
given user.

@param {User} user
the user whose permissions to check
@memberof Thing
@instance
Populate virtual permission fields in a Thing object with the rights of a given user . @param { User } user the user whose permissions to check @memberof Thing @instance
function populateUserInfo(user) {
  if (!user)
    return; 
  this.userCanDelete = user.isSuperUser || user.isSiteModerator || false;
  this.userCanEdit = user.isSuperUser || user.isTrusted || user.id === this.createdBy;
  this.userCanUpload = user.isSuperUser || user.isTrusted;
  this.userIsCreator = user.id === this.createdBy;
}
function populateUserInfo ( user ) { if ( ! user ) return ; this . userCanDelete = user . isSuperUser || user . isSiteModerator || false ; this . userCanEdit = user . isSuperUser || user . isTrusted || user . id === this . createdBy ; this . userCanUpload = user . isSuperUser || user . isTrusted ; this . userIsCreator = user . id === this . createdBy ; }
Populate virtual permission fields in a Thing object with the rights of a
 given user.
Populate virtual permission fields in a Thing object with the rights of a given user .
// Permissions will be at their default value (false) // For now, we don't let users delete things they've created, // since things are collaborative in nature