Class User
Class for representing a user.
Examples
User u;
u.load(2); // Loads user with id = 2
print(u.getValue("username"));
u.setValue("email", "bob@example.com");
u.setValue("language", "en"); // "no" or "en"
u.setValue("status", "1"); // 1 is Active, 2 is Not Present, 3 is deleted
print(u.isLoggedIn(2).toString()); // 2 = web pages, 1 = soap interface
Constructors
User()
Class for representing a user.
Declaration
User Examples
User u;
u.load(2); // Loads user with id = 2
print(u.getValue("username"));
u.setValue("email", "bob@example.com");
u.setValue("language", "en"); // "no" or "en"
u.setValue("status", "1"); // 1 is Active, 2 is Not Present, 3 is deleted
print(u.isLoggedIn(2).toString()); // 2 = web pages, 1 = soap interface
Methods
getValue(String)
Gets the value of a given column.
Declaration
String getValue(String colName) Parameters
| Type | Name | Description |
| String | colName | String with column name. |
Returns
| Type | Description |
| String | Returns a string with value in given column. |
hasTicketAccess(Integer,Integer)
Returns true if the user have at least the given access to the given ticket id.
Declaration
Bool hasTicketAccess(Integer ticketId, Integer accessLevel) Parameters
| Type | Name | Description |
| Integer | ticketId | |
| Integer | accessLevel | AccessLevel is 0 for listing tickets, 1 for reading tickets and 2 for editing tickets. |
Returns
| Type | Description |
isAdministrator()
Returns true if the user is an administrator, false if not.
Declaration
Bool isAdministrator() Returns
| Type | Description |
isLoggedIn(Integer)
Checks if a user is logged in or not.
Declaration
Bool isLoggedIn(Integer origin) Parameters
| Type | Name | Description |
| Integer | origin | 2 = web pages, 1 = soap interface. |
Returns
| Type | Description |
load(Integer)
Loads a user from the database
Declaration
Bool load(Integer p_id) Parameters
| Type | Name | Description |
| Integer | p_id | The user Id. |
Returns
| Type | Description |
| True if the user is loaded successfully. |
loadFromAgentAndKey(Integer,String)
Loads a user from an Agent with userId and the Agent's key.
Declaration
Bool loadFromAgentAndKey(Integer id, String Key) Parameters
| Type | Name | Description |
| Integer | id | ID of the user |
| String | Key | Key of the agent. |
Returns
| Type | Description |
| True if the user is loaded successfully. |
save()
Saves a user object to the database, returns the ID of the user.
Declaration
Integer save() Returns
| Type | Description |
| Integer | Returns the ID of the user. |