webmcp

diff framework/env/request/set_allowed_json_request_slots.lua @ 1:985024b16520

Version 1.0.1

New feature: JSON requests

Changes in ui.paginate: Current page setting is directly fetched from CGI params, instead of view params

Changed behavior of load methods of atom library to accept nil as input

Bugfixes in mondelefant_atom_connector timestamp(tz) loaders

Added global constant _WEBMCP_VERSION containing a version string
author jbe
date Tue Nov 17 12:00:00 2009 +0100 (2009-11-17)
parents
children 944642a3e488
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/framework/env/request/set_allowed_json_request_slots.lua	Tue Nov 17 12:00:00 2009 +0100
     1.3 @@ -0,0 +1,23 @@
     1.4 +--[[--
     1.5 +request.set_allowed_json_request_slots(
     1.6 +  slot_idents                            -- list of names of slots which can be requested in JSON format
     1.7 +)
     1.8 +
     1.9 +This function enables JSON requests. The given list of names of slots selects, which slots may be requestd in JSON format (without layout).
    1.10 +
    1.11 +--]]--
    1.12 +
    1.13 +function request.set_allowed_json_request_slots(slot_idents)
    1.14 +  local hash = {}
    1.15 +  for idx, slot_ident in ipairs(slot_idents) do
    1.16 +    hash[slot_ident] = true
    1.17 +  end
    1.18 +  if cgi.params["_webmcp_json_slots[]"] then
    1.19 +    for idx, slot_ident in ipairs(cgi.params["_webmcp_json_slots[]"]) do
    1.20 +      if not hash[slot_ident] then
    1.21 +        error('Requesting slot "' .. slot_ident .. '" is forbidden.')
    1.22 +      end
    1.23 +    end
    1.24 +  end
    1.25 +  request._json_requests_allowed = true
    1.26 +end

Impressum / About Us