A global object for interacting with cookies in the current request
| $cookie | A global object for interacting with cookies in the current request |
| Properties | |
| data | Array of javax.servlet.http.Cookie objects sent in this request. |
| Functions | |
| get | returns the value of the named cookie. |
| set | sets a cookie |
| setAuthUserId | sets a cookie that contains the supplied user_id and a timestamp |
| clearAuthUserId | Clears the “myna_auth_cookie”. |
| getAuthUserId | Returns the user_id in “myna_auth_cookie”, or null if there is no cookie |
| getAuthUser | Return the result of Myna.Permissions.getUserById for the user_id in “myna_auth_cookie”, or null if there is no cookie |
| clear | clears a cookie. |
get:function( name )
returns the value of the named cookie.
| name | Name of cookie to retrieve |
The value of the named cookie or null if not defined.
set:function( name, value, options )
sets a cookie
| name | Name of cookie to set |
| value | String value of cookie |
| options | Optional JavaScript Object of extra optional parameters. See below: |
| domain | Default null Domain to share the cookie with. If set, the browser will send this cookie to any page in this domain that matches path. |
| path | Default null Start path of page that the cookie should be sent to. |
| expireSeconds | Default -1 An integer specifying the maximum age of the cookie in seconds; if negative, means the cookie is not stored; if zero, deletes the cookie |
void
setAuthUserId:function( user_id )
sets a cookie that contains the supplied user_id and a timestamp
| user_id | user_id of the user to track |
void
This function sets an encrypted cookie “myna_auth_cookie” that contains the supplied user_id. Once set, this cookie will be refreshed on every request until cleared with $cookie.clearAuthUserId.
This functionality can bee used as an alternative to sessions.
To access the contents of this cookie, call $cookie.getAuthUser, which will return the result of Myna.Permissions.getUserById for the user_id in the cookie, or null if there is no cookie.
clearAuthUserId:function( name )
Clears the “myna_auth_cookie”. Equivalent to $cookie.clear(“myna_auth_cookie”)
void
getAuthUserId:function()
Returns the user_id in “myna_auth_cookie”, or null if there is no cookie
void
getAuthUser:function()
Return the result of Myna.Permissions.getUserById for the user_id in “myna_auth_cookie”, or null if there is no cookie
void
returns the value of the named cookie.
get:function( name )
sets a cookie
set:function( name, value, options )
sets a cookie that contains the supplied user_id and a timestamp
setAuthUserId:function( user_id )
Clears the “myna_auth_cookie”.
clearAuthUserId:function( name )
Returns the user_id in “myna_auth_cookie”, or null if there is no cookie
getAuthUserId:function()
Return the result of Myna.Permissions.getUserById for the user_id in “myna_auth_cookie”, or null if there is no cookie
getAuthUser:function()
returns the User object that matches the supplied id or null
getUserById:function( id )
clears a cookie.
clear:function( name )