new $k.User(userInstance)
Constructs a user from the user instance
| Name | Type | Description | 
|---|---|---|
userInstance | 
            
            
            $k.Instance | 
                
                 User instance Represents a user.  | 
        
Methods
static$k.User.getAuthenticatedUser() : $k.User
Finds, authenticates and returns the user.
Returns undefined if thre is either no such user, or if the password does not match.
Requires a transaction.
- Version:
 - Experimental feature, might be removed at any time
 
- Since:
 - 5.0.1
 
Returns:
| Type | Description | 
|---|---|
| $k.User | The authenticated used, or undefined | 
changePassword(oldPassword, newPassword) : boolean
Changes the current users password
| Name | Type | Description | 
|---|---|---|
oldPassword | 
            
            
            string | 
                
                 The old password to be verified  | 
        
newPassword | 
            
            
            string | 
                
                 The new password to set  | 
        
Throws:
| Type | Description | 
|---|---|
| $k.exception.AccessDenied | If the user object and transaction-user mismatch  | 
            
| $k.exception.InvalidValue | If one of the provided passwords is undefined/null  | 
            
| $k.exception.ObjectNotFound | If there is no current user set or no password attribute available  | 
            
Returns:
| Type | Description | 
|---|---|
| boolean | Return true if the password change was successful | 
Example
try { result = $k.user().changePassword("oldsecret", "newsecret") }
catch(e) { error = e.toString() }
    
    
instance() : $k.Instance
Returns the instance associated with the user, or undefined if there is none
Returns:
| Type | Description | 
|---|---|
| $k.Instance | 
name() : string
Returns the name of the user
Returns:
| Type | Description | 
|---|---|
| string |