dba/sessions
library moduleR
Summary
Kill web sessions.
- Tags
Author: Christian Grün, BaseX Team 2005-21, BSD License
__source : sessions/session-kill.xqm
Imports
This module is imported by 0 modules. It imports 1 modules.
Variables
Functions
4.1 dba:drop
Arities: dba:drop#1R
dba:drop
(
$ids
as
xs:string*
)
as
element(rest:response)
- ids
as
xs:string*
session ids (including names)
element(rest:response)
redirection
Invokes 5 functions from 4 modules
- util:info#3
- {http://basex.org/modules/sessions}delete#2
- {http://basex.org/modules/web}redirect#2
- {http://www.w3.org/2005/xpath-functions}substring-after#2
- {http://www.w3.org/2005/xpath-functions}substring-before#2
Invoked by 0 functions from 0 modules
Annotations
%rest:GET | () |
%rest:path | ('/dba/session-kill') |
%rest:query-param | ('id','{$ids}') |
Source ( 11 lines)
function dba:drop(
$ids as xs:string*
) as element(rest:response) {
try {
for $id in $ids
return sessions:delete(substring-before($id, '|'), substring-after($id, '|')),
web:redirect($dba:CAT, map { 'info': util:info($ids, 'session', 'killed') })
} catch * {
web:redirect($dba:CAT, map { 'error': $err:description })
}
}
Namespaces
The following namespaces are defined:
Prefix | Uri |
---|---|
dba | dba/sessions 2 |
rest | http://exquery.org/ns/restxq |
util | dba/util |
Source Code
(:~
: Kill web sessions.
:
: @author Christian Grün, BaseX Team 2005-21, BSD License
:)
module namespace dba = 'dba/sessions';
import module namespace util = 'dba/util' at '../lib/util.xqm';
(:~ Top category :)
declare variable $dba:CAT := 'sessions';
(:~
: Kills web sessions.
: @param $ids session ids (including names)
: @return redirection
:)
declare
%rest:GET
%rest:path('/dba/session-kill')
%rest:query-param('id', '{$ids}')
function dba:drop(
$ids as xs:string*
) as element(rest:response) {
try {
for $id in $ids
return sessions:delete(substring-before($id, '|'), substring-after($id, '|')),
web:redirect($dba:CAT, map { 'info': util:info($ids, 'session', 'killed') })
} catch * {
web:redirect($dba:CAT, map { 'error': $err:description })
}
};