dba/sessions  library module
R

Summary

Kill web sessions.
Tags

Author: Christian Grün, BaseX Team 2005-21, BSD License

__source : sessions/session-kill.xqm

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
this
imports

Variables

3.1 $dba:CAT

Summary
Top category
Type
xs:string

Functions

4.1 dba:drop

Arities: dba:drop#1R

Summary
Kills web sessions.
Signature
dba:drop ( $ids as xs:string* )  as element(rest:response)
Parameters
  • ids as xs:string* session ids (including names)
Return
  • 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:

    PrefixUri
    dbadba/sessions 2
    resthttp://exquery.org/ns/restxq
    utildba/util

    6 RestXQ

    Paths defined 1.

    PathMethodFunction
    /dba/session-killGETdba:drop#1

    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 })
      }
    };