From d9f42153525c01a4df63df8c3f135d8fe8c58ee8 Mon Sep 17 00:00:00 2001 From: PHAN Date: Thu, 17 May 2018 15:58:04 +0200 Subject: [PATCH 1/3] FEATURE: Hypertopic viewpoint emulation. --- index.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index f52d3de..d136bf9 100644 --- a/index.js +++ b/index.js @@ -19,7 +19,7 @@ var payload = { if (!(attribute in config.reserved.attributes || entry[attribute] in config.reserved.values)) { var value = {}; value[config.hypertopic[attribute]||attribute] = entry[attribute]; - this.rows.push({ + this.rows.push({ key: key, value: value }); @@ -37,7 +37,7 @@ function sendItems(request, response) { filter = '(&' + filter + '('+ config.ldap.id + '=' + request.params.item + '))'; } var options = { - scope: 'sub', + scope: 'sub', filter: filter, attributes: config.ldap.attributes }; @@ -55,8 +55,13 @@ function sendItems(request, response) { }); } +function sendEmpty(request, response){ + response.json({rows: []}); +} + app.use(cors) -.get(['/corpus/:corpus', '/item/:corpus/:item'], sendItems); +.get(['/corpus/:corpus', '/item/:corpus/:item'], sendItems) +.get('/viewpoint/:viewpoint', sendEmpty); app.listen(config.port); console.log('Server running on port ' + config.port); From e1c5a7a99c0ffda316af5ba2a8c20b6027c988b5 Mon Sep 17 00:00:00 2001 From: PHAN Date: Thu, 17 May 2018 15:59:14 +0200 Subject: [PATCH 2/3] FEATURE: Hypertopic user emulation. --- index.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index d136bf9..7740b64 100644 --- a/index.js +++ b/index.js @@ -59,9 +59,17 @@ function sendEmpty(request, response){ response.json({rows: []}); } +function sendUser(request, response){ + response.json({rows: [{ + key:'annuaire', + value:{"corpus":{"id":"student", "name":"Étudiants"}} + }]}); +} + app.use(cors) .get(['/corpus/:corpus', '/item/:corpus/:item'], sendItems) -.get('/viewpoint/:viewpoint', sendEmpty); +.get('/viewpoint/:viewpoint', sendEmpty) +.get('/user/annuaire', sendUser); app.listen(config.port); console.log('Server running on port ' + config.port); From b6be3592040c5792e5a4c13535ccbca03a075712 Mon Sep 17 00:00:00 2001 From: David PHAN Date: Fri, 1 Jun 2018 12:00:13 +0200 Subject: [PATCH 3/3] FIX: Hypertopic thumbnail correction AUTHOR: davp01x, tbilah --- config/default.json | 10 +++++----- index.js | 10 ++++++++-- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/config/default.json b/config/default.json index 78588d9..024bef3 100644 --- a/config/default.json +++ b/config/default.json @@ -22,14 +22,14 @@ "id":"uid" }, "hypertopic":{ - "uid": "id", - "displayName": "name", - "jpegPhoto": "thumbnail" + "uid": ["id"], + "displayName": ["name"], + "jpegPhoto": ["thumbnail", "resource"] }, "reserved":{ "attributes":{ - "dn":0, - "uid":0, + "dn":0, + "uid":0, "controls":0 }, "values":{ diff --git a/index.js b/index.js index 7740b64..d0cdb1a 100644 --- a/index.js +++ b/index.js @@ -18,7 +18,13 @@ var payload = { for (var attribute in entry) { if (!(attribute in config.reserved.attributes || entry[attribute] in config.reserved.values)) { var value = {}; - value[config.hypertopic[attribute]||attribute] = entry[attribute]; + if(config.hypertopic[attribute]){ + for(var indexAttribute in config.hypertopic[attribute]){ + value[config.hypertopic[attribute][indexAttribute]] = entry[attribute]; + } + }else{ + value[attribute] = entry[attribute]; + } this.rows.push({ key: key, value: value @@ -63,7 +69,7 @@ function sendUser(request, response){ response.json({rows: [{ key:'annuaire', value:{"corpus":{"id":"student", "name":"Étudiants"}} - }]}); + }]}); } app.use(cors)