File tree Expand file tree Collapse file tree 3 files changed +6
-4
lines changed Expand file tree Collapse file tree 3 files changed +6
-4
lines changed Original file line number Diff line number Diff line change 5
5
module . exports = function ( ) {
6
6
return {
7
7
login : require ( '../../user/login/definition.json' ) ,
8
- profile : require ( '../../user/profile/definition.json' )
8
+ profile : require ( '../../user/profile/definition.json' ) ,
9
+ roles : 'roles'
9
10
} ;
10
11
} ;
Original file line number Diff line number Diff line change @@ -10,9 +10,6 @@ class UserStore extends CoreStore {
10
10
conf . definition = conf . definition || buildDefinition ( ) ;
11
11
super ( conf ) ;
12
12
}
13
- getRoles ( ) {
14
- return [ 'DEFAULT_ROLE' ] ;
15
- }
16
13
17
14
}
18
15
Original file line number Diff line number Diff line change @@ -2,12 +2,16 @@ var userBuiltInStore = require('./built-in-store');
2
2
var userStoreInstance = userBuiltInStore ( ) ;
3
3
var isArray = require ( 'lodash/lang/isArray' ) ;
4
4
var intersection = require ( 'lodash/array/intersection' ) ;
5
+ var dispactcher = require ( '../dispatcher' ) ;
5
6
module . exports = {
6
7
login : require ( './login' ) ,
7
8
profile : require ( './profile' ) ,
8
9
builtInStore : userBuiltInStore ,
9
10
hasRole ( role ) {
10
11
role = isArray ( role ) ? role : [ role ] ;
11
12
return intersection ( role , userStoreInstance . getRoles ( ) ) . length > 0 ;
13
+ } ,
14
+ setRoles ( roles ) {
15
+ dispatcher . handleViewAction ( { data : { roles : roles } , type : 'update' } )
12
16
}
13
17
} ;
You can’t perform that action at this time.
0 commit comments