diff --git a/APPL/API2/api2.inc b/APPL/API2/api2.inc index e943ca82fc..7269d6284c 100644 --- a/APPL/API2/api2.inc +++ b/APPL/API2/api2.inc @@ -786,10 +786,12 @@ api2 = { if (field.foreign.desc_is_unique) // Dan mag je die bij saven ook opgeven { field.typ = "sql"; - newval = "(SELECT {0} FROM {1} WHERE {2} = {3})".format(field.foreign.key, - field.foreign.tbl, - field.foreign.desc, - safe.quoted_sql(newval.name)); + var where = "{0} = {1}".format(field.foreign.desc, safe.quoted_sql(newval.name)); + if (typeof field.foreign.desc_is_unique == "string") + where += " AND " + field.foreign.desc_is_unique; + newval = "(SELECT {0} FROM {1} WHERE {2})".format(field.foreign.key, + field.foreign.tbl, + where); } } } diff --git a/APPL/API2/api2_dispatch.inc b/APPL/API2/api2_dispatch.inc index 64ab981332..6897ba7dd1 100644 --- a/APPL/API2/api2_dispatch.inc +++ b/APPL/API2/api2_dispatch.inc @@ -105,7 +105,7 @@ var api2_mapper = { "costtypegroups" : { "filename": "appl/mgt/prs_kostensoortgrp.asp" }, "costcentregroups" : { "filename": "appl/mgt/prs_kostenplaatsgrp.asp" }, "costcentres" : { "filename": "appl/mgt/prs_kostenplaats.asp" }, - "persons" : { "filename": "appl/mgt/prs_perslid.asp", "nodoc": true }, + "persons" : { "filename": "appl/api2/api_persons.asp", "nodoc": true }, "mandates" : { "filename": "appl/mgt/prs_perslidkostenplaats.asp" }, "relationtypes" : { "filename": "appl/mgt/prs_relatietype.asp" }, "employeefunctions" : { "filename": "appl/mgt/prs_srtperslid.asp" }, diff --git a/APPL/API2/api2_rest.inc b/APPL/API2/api2_rest.inc index bfb26e89b5..fd3dc28d64 100644 --- a/APPL/API2/api2_rest.inc +++ b/APPL/API2/api2_rest.inc @@ -587,8 +587,12 @@ api2_rest = { // str_antwoord heeft nu het te versturen antwoord // Bepaal eTag - var oCrypto = new ActiveXObject("SLNKDWF.Crypto"); - var eTag = '"' + oCrypto.hex_sha1(String(S("cache_changecounter")) + "_" + str_antwoord).toLowerCase() + '"'; + var eTag = api2_rest.plugin.get_eTag({}, resultdata); + if (!eTag) + { + var oCrypto = new ActiveXObject("SLNKDWF.Crypto"); + var eTag = '"' + oCrypto.hex_sha1(String(S("cache_changecounter")) + "_" + str_antwoord).toLowerCase() + '"'; + } Response.AddHeader("ETag", eTag); if (Request.ServerVariables("HTTP_IF_NONE_MATCH") == eTag) { // We hebben een match! Effectief besparen wel alleen op dataverkeer, de queries zijn al geweest @@ -850,6 +854,15 @@ api2_rest = { outdata = hook.transform_outgoing(params, data); hook = null; return outdata; + }, + get_eTag: function(params, data) + { + var outdata = null; + var hook = api2_rest.find_plugin(); + if ("get_eTag" in hook) + outdata = hook.get_eTag(params, data); + hook = null; + return outdata; } } } diff --git a/APPL/API2/api_persons.asp b/APPL/API2/api_persons.asp new file mode 100644 index 0000000000..b48992921a --- /dev/null +++ b/APPL/API2/api_persons.asp @@ -0,0 +1,26 @@ +<%@ language = "JavaScript" %> +<% /* + $Revision$ + $Id$ + + File: api_persons.asp + + Description: ALG_GEBOUW API + Parameters: + Context: Door een remote systeem (geen persoon) om info uit FACILITOR te halen aan te roepen + + Notes: Eigen bestand zodat we internal: true kunnen meegeven +*/ + DOCTYPE_Disable = true; + ANONYMOUS_Allowed = 1; // Eigenlijk niet waar. We regelen echter alles zelf + THIS_FILE = "appl/api/api_persons.asp"; + +%> + + + + +<% + var perslid = new model_prs_perslid({ internal: true }); // internal zodat PUT/POST/DELETE ook kunnen + api2_rest.process(perslid); +%> \ No newline at end of file diff --git a/APPL/API2/model_prs_perslid.inc b/APPL/API2/model_prs_perslid.inc index 99e79bac8a..7dfc29cc98 100644 --- a/APPL/API2/model_prs_perslid.inc +++ b/APPL/API2/model_prs_perslid.inc @@ -51,11 +51,11 @@ function model_prs_perslid(params) + " AND fac_audit_waarde_oud IN ('{1}')" } }; - this.softdelete = true; + this.soft_delete = "prs_perslid_verwijder"; this.primary = "prs_perslid_key"; this.record_title = L("prs_perslid"); this.records_title = L("prs_perslid_m"); - this.autfunction = false; // we controleren zelf + this.autfunction = params.internal?false:"WEB_PRSSYS"; // we controleren zelf this.fields = { "id": { @@ -131,6 +131,12 @@ function model_prs_perslid(params) "typ": "varchar", "filter": "exact" }, + "externallogin": { + "dbs": "prs_perslid_externoslogin", + "label": L("prs_perslid_externoslogin"), + "typ": "varchar", + "filter": "exact" + }, "employment": { "dbs": "prs_perslid_dienstverband", "label": L("lcl_prs_person_dienstverband"), @@ -160,7 +166,7 @@ function model_prs_perslid(params) "tbl": "prs_srtperslid", "key": "prs_srtperslid_key", "desc": "prs_srtperslid_omschrijving", - "desc_is_unique": true + "desc_is_unique": "prs_srtperslid_verwijder IS NULL" } }, "profile": { @@ -300,6 +306,7 @@ function model_prs_perslid(params) return json; }; + // We willen vooral dat je via Admin/Autorisatie personen niet met API kunt bewerken if (params.internal) // bijvoorbeeld idp die personen kan aanmaken { this.REST_POST = generic_REST_POST(this); diff --git a/APPL/API2/plugins/scimusers.wsc b/APPL/API2/plugins/scimusers.wsc index 05c20093ce..b6df81f2dc 100644 --- a/APPL/API2/plugins/scimusers.wsc +++ b/APPL/API2/plugins/scimusers.wsc @@ -28,6 +28,10 @@ + + + +