dba/sessions  library module
R

Summary

Kill web sessions.
Authors
  • Christian Grün, BaseX Team 2005-23, BSD License
Related documents
ViewDescriptionFormat
xqdocxqDoc xml file from the source modulexml
xqparsexqparse xml file from the source modulexml

Imports

This module is imported by 0 modules. It imports 1 modules.

(None)
imports
dba/sessions
imports

Variables

3.1 $dba:CAT

Summary
Top category
Type
Source ( 1 lines)
variable $dba:CAT := 'sessions'

Functions

4.1 dba:drop

Arities: #1R

Summary
Kills web sessions.
Signatures
dba:drop ( $ids as xs:string* ) as element(rest:response)
Parameters
  • ids as xs:string* session ids (including names)
Return
  • element(rest:response) redirection
Invoked by 0 functions from 0 modules
    Annotations (3)
    %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:

    PrefixUri
    dbadba/sessions 2
    errhttp://www.w3.org/2005/xqt-errors
    resthttp://exquery.org/ns/restxq
    sessionshttp://basex.org/modules/sessions
    utildba/util
    webhttp://basex.org/modules/web
    xshttp://www.w3.org/2001/XMLSchema

    6 RestXQ

    Paths defined 1.

    PathMethodFunction
    /dba/session-killGETdba:drop#1

    Source Code

    (:~
     : Kill web sessions.
     :
     : @author Christian Grün, BaseX Team 2005-23, 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 })
      }
    };