KFSG#41700 -- Scim koppeling realiseren.

svn path=/Website/branches/v2017.2/; revision=35614
This commit is contained in:
Arthur Egberink
2017-10-09 14:34:11 +00:00
parent b95a4b99e8
commit 3afb853b21
3 changed files with 31 additions and 28 deletions

View File

@@ -58,8 +58,7 @@ function initialize(params)
function transform_filter(filter)
{
if ("count" in filter)
filter.limit = filter.count;
filter.nolimit = 1;
return filter;
}
@@ -143,7 +142,7 @@ function transform_outgoing(params, data)
return {
"totalResults": allgroups.length,
"itemsPerPage": 10,
"itemsPerPage": allgroups.length,
"startIndex": 1,
"schemas": ["urn:ietf:params:scim:api:messages:2.0:ListResponse"],
"Resources": allgroups

View File

@@ -60,8 +60,7 @@ function initialize(params)
function transform_filter(filter)
{
if ("count" in filter)
filter.limit = filter.count;
filter.nolimit = 1;
return filter;
}
@@ -106,6 +105,8 @@ FCLT.DEZE.__DoLog(department);
function transform_one_department(params, department)
{
FCLT.DEZE.__Log(department);
var unique = FCLT.DEZE.customerId + "_department_" + String(department.id);
var costc = "";
if (department.costcentre)
@@ -118,14 +119,14 @@ function transform_one_department(params, department)
"id":unique,
"costCenter":costc,
"schemas":[
"urn:ietf:params:scim:schemas:core:2.0:OrgUnits",
"urn:ietf:params:scim:schemas:extension:enterprise:2.0:OrgUnits"
"urn:ietf:params:scim:schemas:extension:2.0:OrgUnit",
"urn:ietf:params:scim:schemas:extension:enterprise:2.0:OrgUnit"
],
"meta":{
"created":department.created,
"lastModified":department.lastchange,
"location":FCLT.DEZE.HTTP.urlzelf() + "/appl/SCIM/OrgUnits/" + unique,
"resourceType":"OrgUnits"
"resourceType":"OrgUnit"
}
}
@@ -137,6 +138,8 @@ function transform_one_department(params, department)
function transform_outgoing(params, data)
{
FCLT.DEZE.__DoLog("Params:");
FCLT.DEZE.__DoLog(data);
if ("department" in data)
{
var onedepartment = transform_one_department(params, data.department);
@@ -151,11 +154,12 @@ function transform_outgoing(params, data)
break;
var department = data.departments[i];
alldepartments.push(transform_one_department(params, department));
FCLT.DEZE.__DoLog(params.limit);
}
return {
"totalResults": alldepartments.length,
"itemsPerPage": 10,
"itemsPerPage": alldepartments.length,
"startIndex": 1,
"schemas": ["urn:ietf:params:scim:api:messages:2.0:ListResponse"],
"Resources": alldepartments

View File

@@ -60,8 +60,7 @@ function initialize(params)
function transform_filter(filter)
{
if ("count" in filter)
filter.limit = filter.count;
filter.nolimit = 1;
return filter;
}
@@ -77,7 +76,8 @@ function get_eTag(params, data)
function transform_incoming(params, data)
{
FCLT.DEZE.__DoLog(data);
var extension = data["urn:ietf:params:scim:schemas:extension:enterprise:2.0:User"];
var enterprise = data["urn:ietf:params:scim:schemas:extension:enterprise:2.0:User"];
var facilitor = data["urn:ietf:params:scim:schemas:extension:facilitor:2.0:User"];
var person =
{
@@ -85,25 +85,25 @@ FCLT.DEZE.__DoLog(data);
externallogin: data["userName"],
externalid : data["externalId"],
// name : data["name"]["displayName"],
initials : data["userFacilitor"]["initials"],
initials : facilitor["initials"],
lastname : data["name"]["familyName"],
middlename : data["name"]["middleName"],
firstname : data["name"]["givenName"],
deactivated : data["active"]?null:new Date(),
employeenumber : extension["employeeNumber"]
employeenumber : enterprise["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 = "";
if (enterprise["employeeNumber"] == undefined) person.employeenumber = "";
var dep_id = data["orgUnit"]["id"].replace (FCLT.DEZE.customerId + "_department_", "");
var dep_id = facilitor["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
person["function"] = { name: facilitor["title"] } // id mag achterwege blijven omdat desc_is_unique
if (data["emails"])
{
@@ -128,9 +128,6 @@ 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,
@@ -149,7 +146,6 @@ function transform_one_person(params, person)
"location":FCLT.DEZE.HTTP.urlzelf() + "/appl/SCIM/Users/" + unique,
"resourceType":"User"
},
"Title":person["function"].name,
"emails":[
{
"value":person.email,
@@ -164,16 +160,20 @@ function transform_one_person(params, person)
"primary":true
}
],
"orgunit":
{
"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":[],
"urn:ietf:params:scim:schemas:extension:enterprise:2.0:User" :
{
"employeeNumber":person.employeenumber
},
"urn:ietf:params:scim:schemas:extension:facilitor:2.0:User" :
{
"orgunit":
{
"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)
},
"initials":person.initials,
"title":person["function"].name
}
}
var allgroups = [];
@@ -216,7 +216,7 @@ function transform_outgoing(params, data)
return {
"totalResults": allusers.length,
"itemsPerPage": 10,
"itemsPerPage": allusers.length,
"startIndex": 1,
"schemas": ["urn:ietf:params:scim:api:messages:2.0:ListResponse"],
"Resources": allusers