YouTrack Standalone 2017.2 Help

User

Extends: BaseEntity

Represents YouTrack user.

Properties

NameTypeDescriptionRead-only
static current User Current (logged in user). /help/img/youtrack/2017.2/checkbox-marked.png
static fieldType String Field type. To be used when defining rule requirements. /help/img/youtrack/2017.2/checkbox-marked.png
email String The email address of the user. /help/img/youtrack/2017.2/checkbox-marked.png
fullName String The full name of the user as seen in their profile. /help/img/youtrack/2017.2/checkbox-marked.png
isBanned Boolean `true` in case the user account is banned. /help/img/youtrack/2017.2/checkbox-marked.png
login String The login of the user. /help/img/youtrack/2017.2/checkbox-marked.png
timeZoneId String User's time zone id. /help/img/youtrack/2017.2/checkbox-marked.png
visibleName String The full name of the user. If the full name is not set, the login is returned. /help/img/youtrack/2017.2/checkbox-marked.png

Methods

 

findByLogin

static findByLogin(login)

Finds a user by login.

Parameters:

NameTypeDescription
login String login to find by.

Returns:

TypeDescription
User user, or null in case no user exists with the provided login.

 

becomes

becomes(fieldName, expected)

Checks that a value a field receives in the current transaction is equal to an expected one.

Parameters:

NameTypeDescription
fieldName string name of the field to check.
expected string expected value.

Returns:

TypeDescription
boolean `true` in case the expectation is met.

 

canBeReadBy

canBeReadBy(fieldName, user)

Checks if a field can be read by a user.

Parameters:

NameTypeDescription
fieldName string name of the field.
user User to check access for.

Returns:

TypeDescription
boolean `true` in case the field can be read by the user.

 

canBeWrittenBy

canBeWrittenBy(fieldName, user)

Checks if a field can be written by a user.

Parameters:

NameTypeDescription
fieldName string name of the field.
user User to check access for.

Returns:

TypeDescription
boolean `true` in case the field can be written by the user.

 

canUnvoteIssue

canUnvoteIssue(issue)

Checks whether the user is able to remove their vote from the specified issue.

Parameters:

NameTypeDescription
issue Issue The issue to check.

Returns:

TypeDescription
Boolean `true` in case the user can unvote.

 

canVoteIssue

canVoteIssue(issue)

Checks whether the user is able to vote for the specified issue.

Parameters:

NameTypeDescription
issue Issue The issue to check.

Returns:

TypeDescription
Boolean `true` in case the user can vote.

 

getSharedTag

getSharedTag(name)

Returns a tag with the specified name that is shared with but not owned by the user. If such a tag does not exist, a null value is returned.

Parameters:

NameTypeDescription
name String The name of the tag.

Returns:

TypeDescription
IssueTag The tag.

 

getTag

getTag(name, createIfNotExists)

Returns a tag that is visible to the user.

Parameters:

NameTypeDescription
name String The name of the tag.
createIfNotExists Boolean If `true` and the specified tag does not exist or is not visible to the user and the user has permission to create tags, a new tag with the specified name is created.

Returns:

TypeDescription
IssueTag The tag.

 

hasRole

hasRole(roleName, project)

Checks whether the user has the specified role in the specified project. In case no project is specified, checks if the user has the specified role in any project.

Parameters:

NameTypeDescription
roleName String The name of the role to check for.
project Project project to check access for.

Returns:

TypeDescription
Boolean `true` in case the user has the specified role.

 

isChanged

isChanged(fieldName)

Checks if a field is changed in the current transaction.

Parameters:

NameTypeDescription
fieldName string name of the field (e.g. 'summary') to check.

Returns:

TypeDescription
boolean `true` in case the field is changed in the current transaction.

 

isInGroup

isInGroup(groupName)

Checks whether the user is a member of the specified group.

Parameters:

NameTypeDescription
groupName String The name of the group to check for.

Returns:

TypeDescription
Boolean `true` in case the user is a member of the specified group.

 

notify

notify(subject, body, ignoreNotifyOnOwnChangesSetting, project)

Sends an email notification to the email address that is set in the user profile.

Parameters:

NameTypeDescription
subject String, JsonForUserNotify The subject line of the email notification. Alternatively, pass a JSON specified by JsonForUserNotify
body String The message text of the email notification.
ignoreNotifyOnOwnChangesSetting Boolean If `false`, the message is not sent when changes are performed on behalf of the current user. The corresponding flag is unchecked. Otherwise, the message is sent anyway.
project Project The email address configured for the project will be used as 'from'.

 

oldValue

oldValue(fieldName)

Returns the previous value of a single-valued field before an update was applied. In case the field is not changedin the transaction, this value is equal to the current value of the field.

Parameters:

NameTypeDescription
fieldName string name of the field (e.g. 'updated') to get previous value of.

Returns:

TypeDescription
Object previous value of the field.

 

required

required(fieldName, message)

Checks if a the entity has a field denoted by field name set, shows error message otherwise.

Parameters:

NameTypeDescription
fieldName string name of the field to check.
message string message to show in case the field is not set.

 

sendJabber

sendJabber(message)

Sends a notification message over Jabber. Similar to `notify`method, the message won't be sent on own changes and corresponding flag unchecked.

Parameters:

NameTypeDescription
message String The message text for the Jabber notification.

 

sendMail

sendMail(subject, body)

An alias for notify(subject, body, true)

Parameters:

NameTypeDescription
subject String see notify for the descripton
body String see notify for the description

 

unvoteIssue

unvoteIssue(issue)

Removes a vote on behalf of the user from the issue, if allowed.

Parameters:

NameTypeDescription
issue Issue The issue from which the vote is removed.

 

unwatchIssue

unwatchIssue(issue)

Removes the current user from the list of watchers for the issue(remove `Star` tag).

Parameters:

NameTypeDescription
issue Issue The issue to from which the user is removed as a watcher.

 

voteIssue

voteIssue(issue)

Adds a vote on behalf of the user to the issue, if allowed.

Parameters:

NameTypeDescription
issue Issue The issue to which the vote is added.

 

watchIssue

watchIssue(issue)

Adds the current user to the issue as a watcher (add `Star` tag).

Parameters:

NameTypeDescription
issue Issue The issue to which the user is added as a watcher.

 

Last modified: 9 August 2017