Represents application's current user object.
The user object contains settings that are fetched from the server and whatever settings the application wants to store.
// Sample user object that is fetched from the server:
{
     id: "1",
     full_name: "Administrator",
     user_name: "admin",
     preferences: {
         timezone: "America\/Los_Angeles",
         datepref: "m\/d\/Y",
         timepref: "h:ia"
     }
}
// Use it like this:
const User = require('core/user');
var userId = User.get('id');
// Set app specific settings
User.set('sortBy:Cases', 'case_number');
// Bind event handlers if necessary
User.on('change', function() {
    // Do your thing
});Members
- 
    <static> lastState :Core/User.LastState
- 
    
    
        Type:
Methods
- 
    <inner> getAcls()
- 
    
    Gets ACLs. Precondition: either the user is logged in or an _resetcall has set the user manually.Returns:Dictionary of ACLs. - Type
- Object
 
- 
    <inner> getCurrency()
- 
    
    Returns an object with all the user's currency preferences. If the user hasn't specified any preferences, these default to system currency preferences. Returns:The user's currency preferences. - Type
- Object
 
- 
    <inner> getLanguage()
- 
    
    Retrieves the current user's preferred language. Returns:The current user's preferred language. - Type
- string
 
- 
    <inner> getPreference(name)
- 
    
    Gets a preference by name. Parameters:Name Type Description namestring The preference name. - To Do:
- 
		- support category parameter for preferences.
 
 Returns:The value of the user preference, or nameif no corresponding preference value exists.- Type
- *
 
- 
    <inner> load( [callback])
- 
    
    Retrieves and sets the user preferences. Parameters:Name Type Argument Description callbackfunction <optional> 
 Callback called when update completes. 
- 
    <inner> loadLocale( [callback])
- 
    
    Loads the current user's locale. Parameters:Name Type Argument Description callbackfunction <optional> 
 Called when loading the locale completes. 
- 
    <inner> setPreference(name, value)
- 
    
    Set preference by name. Will only be stored locally. Parameters:Name Type Description namestring The preference name. value* The new preference value. - To Do:
- 
		- support category parameter for preferences.
- support save preferences on server.
 
 Returns:The instance of this user. - Type
- Object
 
- 
    <inner> update(method, payload, callback)
- 
    
    Updates the user. Parameters:Name Type Description methodstring Operation type: either 'read', 'update', 'create', or 'delete'. {@see SUGAR.Api#me}. payloadObject An object literal with payload. callbackObject Callback called when update completes. In case of error, App.error.handleHttpErrorwill be called here.
- 
    <inner> updateLanguage(language [, callback])
- 
    
    Updates the user's preferred language. Parameters:Name Type Argument Description languagestring Language key. callbackfunction <optional> 
 Callback called when update completes. 
- 
    <inner> updatePreferences(attributes [, callback])
- 
    
    Updates the user's preferences. Parameters:Name Type Argument Description attributesObject The attributes to update for user. callbackfunction <optional> 
 Callback called when update completes. 
- 
    <inner> updateProfile(attributes [, callback])
- 
    
    Updates the user's profile. Parameters:Name Type Argument Description attributesObject The model attributes to update for user. callbackfunction <optional> 
 Callback called when update completes.