total5 0.0.3-2 → 0.0.3
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.
- package/changelog.txt +3 -0
- package/controller.js +10 -2
- package/package.json +1 -1
- package/querybuilder.js +1 -1
- package/routing.js +4 -0
package/changelog.txt
CHANGED
|
@@ -18,6 +18,9 @@
|
|
|
18
18
|
- added support for inheriting inline schemas in the form e.g. `id:String,@address,@products`
|
|
19
19
|
- added `ctrl.image(opt)` method
|
|
20
20
|
- extended `ctrl.filefs()` method by returing `opt` object
|
|
21
|
+
- extended `QueryBuilder.userid()` by supporting `$` options/controller instance
|
|
22
|
+
- added `controller.action()`
|
|
23
|
+
- improved `controller.authorize()` it assigns `controller.user` automatically
|
|
21
24
|
|
|
22
25
|
========================
|
|
23
26
|
0.0.2
|
package/controller.js
CHANGED
|
@@ -1069,11 +1069,19 @@ Controller.prototype.authorize = function(callback) {
|
|
|
1069
1069
|
opt.TYPE = 'auth';
|
|
1070
1070
|
opt.query = ctrl.query;
|
|
1071
1071
|
opt.next = opt.callback;
|
|
1072
|
-
opt.$callback = (err, response)
|
|
1072
|
+
opt.$callback = function(err, response) {
|
|
1073
|
+
if (response)
|
|
1074
|
+
ctrl.user = response;
|
|
1075
|
+
callback(null, response);
|
|
1076
|
+
};
|
|
1073
1077
|
F.def.onAuthorize(opt);
|
|
1074
1078
|
} else
|
|
1075
1079
|
callback();
|
|
1076
|
-
}
|
|
1080
|
+
};
|
|
1081
|
+
|
|
1082
|
+
Controller.prototype.action = function(name, model) {
|
|
1083
|
+
return F.action(name, model, this);
|
|
1084
|
+
};
|
|
1077
1085
|
|
|
1078
1086
|
Controller.prototype.notmodified = function(date) {
|
|
1079
1087
|
var ctrl = this;
|
package/package.json
CHANGED
package/querybuilder.js
CHANGED
|
@@ -558,7 +558,7 @@ QBP.id = function(id) {
|
|
|
558
558
|
};
|
|
559
559
|
|
|
560
560
|
QBP.userid = function(id) {
|
|
561
|
-
return id instanceof Array ? this.in('userid', id) : this.where('userid', id);
|
|
561
|
+
return id instanceof Array ? this.in('userid', id) : this.where('userid', typeof(id) === 'string' ? id : (id.user ? id.user.id : id.id));
|
|
562
562
|
};
|
|
563
563
|
|
|
564
564
|
QBP.equal = function(obj) {
|
package/routing.js
CHANGED
|
@@ -451,6 +451,9 @@ function compareflags(ctrl, routes, auth) {
|
|
|
451
451
|
|
|
452
452
|
for (let route of routes) {
|
|
453
453
|
|
|
454
|
+
if (route.ext && !route.ext[ctrl.ext])
|
|
455
|
+
continue;
|
|
456
|
+
|
|
454
457
|
if (auth && route.auth && route.auth !== auth)
|
|
455
458
|
continue;
|
|
456
459
|
|
|
@@ -663,6 +666,7 @@ exports.lookupfile = function(ctrl, auth = 0) {
|
|
|
663
666
|
let key = '';
|
|
664
667
|
for (let i = 0; i < ctrl.split2.length - 1; i++)
|
|
665
668
|
key += (i ? '/' : '') + ctrl.split2[i];
|
|
669
|
+
|
|
666
670
|
let routes = F.routes.filescache[key];
|
|
667
671
|
if (routes)
|
|
668
672
|
return compareflags(ctrl, routes, auth);
|