1 |
|
2 | var Base = require("./Base")
|
3 |
|
4 |
|
5 | class Admin extends Base {
|
6 |
|
7 | constructor(container) {
|
8 | super(container)
|
9 | }
|
10 |
|
11 | User() {
|
12 | if(!this.user) {
|
13 | const UserModule = require("./admin/User")
|
14 | this.user = new UserModule(this.getContainer())
|
15 | }
|
16 | return this.user
|
17 | }
|
18 |
|
19 | Client() {
|
20 | if(!this.client) {
|
21 | const ClientModule = require("./admin/Client")
|
22 | this.client = new ClientModule(this.getContainer())
|
23 | }
|
24 | return this.client
|
25 | }
|
26 |
|
27 | Role() {
|
28 | if(!this.role) {
|
29 | const Role = require("./admin/Role")
|
30 | this.role = new Role(this.getContainer())
|
31 | }
|
32 | return this.role
|
33 | }
|
34 |
|
35 | getPermission(type) {
|
36 | this.permissions = this.permissions || {}
|
37 | if(!this.permissions[type]) {
|
38 | const Permission = require("./admin/Permission")
|
39 | this.permissions[type] = new Permission(this.getContainer(), type)
|
40 | }
|
41 | return this.permissions[type]
|
42 | }
|
43 |
|
44 | Token() {
|
45 | if(!this.token) {
|
46 | const Token = require("./admin/Token")
|
47 | this.token = new Token(this.getContainer())
|
48 | }
|
49 | return this.token
|
50 | }
|
51 | }
|
52 |
|
53 | module.exports = Admin
|