File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change 2
2
3
3
const debug = require ( 'debug' ) ( 'loopback:componenet:access:context' ) ;
4
4
const loopback = require ( 'loopback' ) ;
5
+ const Promise = require ( "bluebird" ) ;
5
6
6
7
module . exports = function userContextMiddleware ( ) {
7
8
// set current user to enable user access for remote methods
@@ -21,10 +22,12 @@ module.exports = function userContextMiddleware() {
21
22
loopbackContext . set ( 'accessToken' , req . accessToken . id ) ;
22
23
const app = req . app ;
23
24
const UserModel = app . accessUtils . options . userModel || 'User' ;
25
+ const GroupAccessModel = app . accessUtils . options . groupAccessModel || 'GroupAccess' ;
26
+
24
27
25
28
return Promise . join (
26
29
app . models [ UserModel ] . findById ( req . accessToken . userId ) ,
27
- app . models . Team . find ( {
30
+ app . models [ GroupAccessModel ] . find ( {
28
31
where : {
29
32
userId : req . accessToken . userId
30
33
}
You can’t perform that action at this time.
0 commit comments