user_info

user_info

domain: client

language: javascript

class Task

Description

Use user_info attribute to get user information when project Safe mode parameter is set.

user_info is an object that has the following attributes:

  • user_id - the user id

  • user_name - the user name

  • role_id - user role id

  • role_name - the role assigned to the user

  • admin - if true the user can work in the Application builder

If safe mode is false the user_info attribute is an empty object.

Example

function on_page_loaded(task) {
    $("#title").html('Jam.py demo application');
    if (task.safe_mode) {
        $("#user-info").text(task.user_info.role_name + ' ' + task.user_info.user_name);
        $('#log-out')
        .show()
        .click(function(e) {
            e.preventDefault();
            task.logout();
        });
    }
    // some initalization code
}

See also

load

login

logout

Users

Roles