From a6db4e9b503b8de4d5eb77bab8f8e65244dda384 Mon Sep 17 00:00:00 2001 From: Arthur Egberink Date: Fri, 6 Oct 2017 12:09:01 +0000 Subject: [PATCH] KFSG#41700 -- Scim koppeling realiseren. svn path=/Website/branches/v2017.2/; revision=35599 --- APPL/API2/plugins/scimgroups.wsc | 3 +- APPL/API2/plugins/scimorgunits.wsc | 11 ++++--- APPL/API2/plugins/scimusers.wsc | 46 ++++++++++++++++++++++++------ 3 files changed, 44 insertions(+), 16 deletions(-) diff --git a/APPL/API2/plugins/scimgroups.wsc b/APPL/API2/plugins/scimgroups.wsc index d3c77bb028..6eab538dc5 100644 --- a/APPL/API2/plugins/scimgroups.wsc +++ b/APPL/API2/plugins/scimgroups.wsc @@ -72,7 +72,7 @@ function get_eTag(params, data) function transform_incoming(params, data) { -//FCLT.DEZE.__DoLog(data); +FCLT.DEZE.__DoLog(data); var authorizationgroup = { name : data["displayName"], @@ -112,6 +112,7 @@ function transform_one_group(params, authorizationgroup) var unique = FCLT.DEZE.customerId + "_person_" + String(user.person.id); onegroup.members.push({ "value":unique, + "type":"User", "$ref":FCLT.DEZE.HTTP.urlzelf() + "/appl/SCIM/Users/" + unique, "display":user.person.name }) diff --git a/APPL/API2/plugins/scimorgunits.wsc b/APPL/API2/plugins/scimorgunits.wsc index 3e9104ccd0..4cc6203aef 100644 --- a/APPL/API2/plugins/scimorgunits.wsc +++ b/APPL/API2/plugins/scimorgunits.wsc @@ -79,21 +79,20 @@ FCLT.DEZE.__DoLog(data); { id : data["id"], externalid : data["externalId"], - description: data["Code"], + description: data["code"], name : data["externalId"], - costcenter : { name: data["CostCenter"] }, // id mag achterwege blijven omdat desc_is_unique + costcentre : { name: data["costCenter"] }, // id mag achterwege blijven omdat desc_is_unique company : { name: "Schiphol Group" } }; - var costcenter_key = -1; var sql = "SELECT prs_kostenplaats_key FROM prs_kostenplaats " + "WHERE prs_kostenplaats_verwijder IS NULL " - + " AND prs_kostenplaats_nr = '" + department.costcenter.name + "'"; + + " AND prs_kostenplaats_nr = " + FCLT.DEZE.safe.quoted_sql(department.costcentre.name); var oRs = FCLT.DEZE.Oracle.Execute(sql); if (oRs.eof) { sql = "INSERT INTO prs_kostenplaats (prs_kostenplaats_nr, prs_kostenplaats_omschrijving, prs_kostenplaats_module) " - + "VALUES ('" + department.costcenter.name + "','" + department.costcenter.name + "','PRS')"; + + "VALUES (" + FCLT.DEZE.safe.quoted_sql(department.costcentre.name) + "," + FCLT.DEZE.safe.quoted_sql(department.costcentre.name) + ",'PRS')"; FCLT.DEZE.__DoLog(sql); FCLT.DEZE.Oracle.Execute(sql); } @@ -117,7 +116,7 @@ function transform_one_department(params, department) "code":department.description, "externalid":department.externalid, "id":unique, - "costcenter":costc, + "costCenter":costc, "schemas":[ "urn:ietf:params:scim:schemas:core:2.0:OrgUnits", "urn:ietf:params:scim:schemas:extension:enterprise:2.0:OrgUnits" diff --git a/APPL/API2/plugins/scimusers.wsc b/APPL/API2/plugins/scimusers.wsc index 527150ea72..75e2ac4a64 100644 --- a/APPL/API2/plugins/scimusers.wsc +++ b/APPL/API2/plugins/scimusers.wsc @@ -76,24 +76,40 @@ function get_eTag(params, data) // Als het object aan staat wordt de id opgeleverd, anders -id function transform_incoming(params, data) { -//FCLT.DEZE.__DoLog(data); +FCLT.DEZE.__DoLog(data); + var extension = data["urn:ietf:params:scim:schemas:extension:enterprise:2.0:User"]; + var person = { login : data["userName"], externallogin: data["userName"], externalid : data["externalId"], - name : data["name"]["displayName"], +// name : data["name"]["displayName"], + initials : data["userFacilitor"]["initials"], lastname : data["name"]["familyName"], + middlename : data["name"]["middleName"], firstname : data["name"]["givenName"], - deactivated : data["active"]?null:new Date() + deactivated : data["active"]?null:new Date(), + employeenumber : extension["employeeNumber"] }; + + if (data["userName"] == undefined) person.login = ""; + if (data["userFacilitor"]["initials"] == undefined) person.initials = ""; + if (data["name"]["middleName"] == undefined) person.middlename = ""; + if (data["name"]["givenName"] == undefined) person.firstname = ""; + if (extension["employeeNumber"] == undefined) person.employeenumber = ""; + + + var dep_id = data["orgUnit"]["id"].replace (FCLT.DEZE.customerId + "_department_", ""); + + person["department"] = { id: dep_id }; person["function"] = { name: data["title"] } // id mag achterwege blijven omdat desc_is_unique - if (data["emails"].length) + if (data["emails"]) { person.email = data["emails"][0].value; // type:work/primary:true opzoeken ? } - if (data["phoneNumbers"].length) + if (data["phoneNumbers"]) { person.mobile = data["phoneNumbers"][0].value; // type:mobile/primary:true opzoeken ? } @@ -112,10 +128,14 @@ function transform_one_person(params, person) "userName":person.externallogin || person.login, "externalId":person.externalid, "id":unique, + "userFacilitor":{ + "initials":person.initials + }, "name":{ "formatted":person.name, "familyName":person.lastname, - "givenName":person.firstname + "givenName":person.firstname, + "middleName":person.middlename }, "schemas":[ "urn:ietf:params:scim:schemas:core:2.0:User", @@ -146,11 +166,15 @@ function transform_one_person(params, person) ], "orgunit": { - "id":String(person.department.id), + "id":FCLT.DEZE.customerId + "_department_" + String(person.department.id), "$ref":FCLT.DEZE.HTTP.urlzelf() + "/appl/SCIM/OrgUnits/" + FCLT.DEZE.customerId + "_department_" + String(person.department.id) } , - "groups":[] + "groups":[], + "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User" : + { + "employeeNumber":person.employeenumber + } } var allgroups = []; for (var j = 0; j < person.authorization.length; j++) @@ -183,7 +207,11 @@ function transform_outgoing(params, data) if (params.limit && allusers.length > params.limit) break; var person = data.persons[i]; - allusers.push(transform_one_person(params, person)); + if (person.login && person.login.indexOf('_') != 0) + { + // _ users are not part of the interface. + allusers.push(transform_one_person(params, person)); + } } return {