soajs.controller 4.2.18 → 4.2.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -12,7 +12,7 @@ const coreLibs = require("soajs.core.libs");
|
|
|
12
12
|
|
|
13
13
|
module.exports = (configuration) => {
|
|
14
14
|
let core = configuration.core;
|
|
15
|
-
|
|
15
|
+
|
|
16
16
|
let return_SOAJS_keyACL = (req) => {
|
|
17
17
|
let ACL = null;
|
|
18
18
|
let ALLOWED_PACKAGES = null;
|
|
@@ -73,21 +73,47 @@ module.exports = (configuration) => {
|
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
|
+
|
|
77
|
+
let urac = null;
|
|
78
|
+
if (req.soajs.uracDriver) {
|
|
79
|
+
let uracObj = req.soajs.uracDriver.getProfile();
|
|
80
|
+
if (uracObj) {
|
|
81
|
+
urac = {
|
|
82
|
+
"_id": uracObj._id
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
let tenant = null;
|
|
88
|
+
let keyObj = req.soajs.controller.serviceParams.keyObj;
|
|
89
|
+
if (keyObj && keyObj.application && keyObj.application.package) {
|
|
90
|
+
tenant = {
|
|
91
|
+
"id": keyObj.tenant.id,
|
|
92
|
+
"name": keyObj.tenant.name,
|
|
93
|
+
"code": keyObj.tenant.code,
|
|
94
|
+
// "locked": keyObj.tenant.locked,
|
|
95
|
+
// "roaming": data.req.soajs.tenant.roaming,
|
|
96
|
+
"type": keyObj.tenant.type
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
|
|
76
100
|
let response = {
|
|
77
101
|
"acl": ACL,
|
|
78
102
|
"finalACL": finalACL,
|
|
79
|
-
"packages": ALLOWED_PACKAGES
|
|
103
|
+
"packages": ALLOWED_PACKAGES,
|
|
104
|
+
"urac": urac,
|
|
105
|
+
"tenant": tenant
|
|
80
106
|
};
|
|
81
107
|
return req.soajs.controllerResponse(response);
|
|
82
108
|
};
|
|
83
|
-
|
|
109
|
+
|
|
84
110
|
return (req, res, next) => {
|
|
85
|
-
|
|
111
|
+
|
|
86
112
|
//doesn't work without a key in the headers
|
|
87
113
|
if (!req.headers || !req.headers.key) {
|
|
88
114
|
return req.soajs.controllerResponse(core.error.getError(132));
|
|
89
115
|
}
|
|
90
|
-
|
|
116
|
+
|
|
91
117
|
//mimic a service named controller with route /key/permission/get
|
|
92
118
|
let serviceName = configuration.serviceName;
|
|
93
119
|
req.soajs.controller.serviceParams.registry = req.soajs.registry.services[serviceName];
|
|
@@ -112,10 +138,10 @@ module.exports = (configuration) => {
|
|
|
112
138
|
]
|
|
113
139
|
}
|
|
114
140
|
};
|
|
115
|
-
|
|
141
|
+
|
|
116
142
|
//assign the correct method to gotoservice in controller
|
|
117
143
|
req.soajs.controller.gotoservice = return_SOAJS_keyACL;
|
|
118
144
|
return next();
|
|
119
|
-
|
|
145
|
+
|
|
120
146
|
};
|
|
121
147
|
};
|
package/package.json
CHANGED