Skip to content

Commit 214482e

Browse files
committed
Create relation between User and Role
1 parent 9767fa4 commit 214482e

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

client/app/modules/users/controllers/users.ctrl.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,13 @@ angular.module('com.module.users')
5656
});
5757
});
5858
};
59+
60+
$scope.loading = true;
61+
$scope.users = User.find({
62+
filter: {
63+
include: ['roles']
64+
}
65+
}, function () {
66+
$scope.loading = false;
67+
});
5968
});

common/models/user.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@
1919
"type": "hasMany",
2020
"model": "userCredential",
2121
"foreignKey": "userId"
22+
},
23+
"roles": {
24+
"type": "hasMany",
25+
"model": "Role",
26+
"through": "RoleMapping",
27+
"foreignKey": "principalId"
2228
}
2329
},
2430
"acls": [

0 commit comments

Comments
 (0)