This module implements the management of sessions. In particular, it defines a cookie that must be sent to the client in order to enable the handling of sessions. Based on sessions, this module also defines a session store that can be used by various parts of the application in order to hold some session-specific data.
doesSessionExist
:: IO Bool
Checks whether the current user session is initialized, i.e., whether a session cookie has been already set. |
sessionCookie
:: IO PageParam
Creates a cookie to hold the current session id. |
withSessionCookie
:: HtmlPage -> IO HtmlPage
Decorates an HTML page with session cookie. |
withSessionCookieInfo
:: HtmlPage -> IO HtmlPage
Decorates an HTML page with session cookie and shows an information page when the session cookie is not set. |
emptySessionStore
:: SessionStore a
An initial value for the empty session store. |
getSessionMaybeData
:: Global (SessionStore a) -> IO (Maybe a)
Retrieves data for the current user session stored in a session store. |
getSessionData
:: Global (SessionStore a) -> a -> IO a
Retrieves data for the current user session stored in a session store where the second argument is returned if there is no data for the current session. |
putSessionData
:: Global (SessionStore a) -> a -> IO ()
Stores data related to the current user session in a session store. |
updateSessionData
:: Global (SessionStore a) -> a -> (a -> a) -> IO ()
Updates the data of the current user session. |
removeSessionData
:: Global (SessionStore a) -> IO ()
Removes data related to the current user session from a session store. |
The type of a session store that holds particular data used in a session. A session store consists of a list of data items for each session in the system together with the clock time of the last access. The clock time is used to remove old data in the store.
Constructors:
Checks whether the current user session is initialized, i.e., whether a session cookie has been already set. |
Creates a cookie to hold the current session id. This cookie should be sent to the client together with every HTML page. |
Decorates an HTML page with session cookie. |
Decorates an HTML page with session cookie and shows an information page when the session cookie is not set. |
An initial value for the empty session store.
|
Retrieves data for the current user session stored in a session store.
Returns |
Retrieves data for the current user session stored in a session store where the second argument is returned if there is no data for the current session. |
Stores data related to the current user session in a session store. |
Updates the data of the current user session. |
Removes data related to the current user session from a session store. |