Class Branch

User accounts may belong to no branch or to one branch. Usually, the branch is returned as part of the login response and contains some information about the branch, such as the name and its unique identifier.

var api = new TVS.Api();
api.login('branch-username', 'password').then(function(loginResponse) {
    // name of branch the user belongs to
    if (loginResponse.Branch) {
        console.log('Branch:', loginResponse.Branch.Name);
    } else {
        console.log('User does not belong to any branch');
    }
});
class Branch()

Captures information about a branch. A TVS user account may be associated with a branch and different rules and visibility of information may apply based on the branch.

Arguments
  • json (object()) – The original JSON data object on which basis this branch object is created.

Constant Property

Branch.PRIVILEGE_CREATE_APPLICATIONS

Branch access privilege for creating new applications.

Properties

Branch.Id

The unique identifier of the branch.

Branch.Name

The unique name of the branch.

Branch.Description

An optional description of the branch.

Branch.OrganisationId

The unique identifier of the organisation this branch may belong to or null.

Branch.Privileges

Internal access privileges encoded as bit flags.

Methods

Branch.hasPrivilege(privilege)

Return true if the branch has the given privilege.

Arguments
  • privilege (int()) – Branch privilege.

Branch.canCreateApplications()

Return true if the branch is allowed to create (publish) new applications.