0.0.22 • Published 10 months ago
@l1go/system-permission v0.0.22
修改config.ts
config.permission = {
passport: true,
override: false,
mode: 'safe', // safe,
roles: {
guest: {
can: ['LEVEL0']
}
}
}
config.orm = {
type: 'mysql', // 数据库类型
host: '127.0.0.1', // 数据库地址
port: 3306, // 数据库端口号
username: 'root', // 数据库用户名
password: '111111', // 密码
database: 'midway', // 数据库名
synchronize: true,
}
修改configuration.ts
import * as systemPermission from '@l1go/system-permission'
@Configuration({
imports: [
systemPermission
],
importConfigs: ["./config"],
})
this.app.use(await this.app.generateMiddleware('permissionMiddleware'));
this.manageService = await this.app.getApplicationContext().getAsync('PERMISSION:manageService')
await this.manageService.startScan()
await this.manageService.regist(1, 'get_/graphql', 'LEVEL0:*')
await this.manageService.regist(1, 'post_/graphql', 'LEVEL0:*')
await this.manageService.regist(1, 'get_/public/*', 'LEVEL0:*')
通知管理服务当前用户的权限,目前是以session为准
if (this.app.getAttr('PERMISSION')) {
this.manageService = await this.app.getApplicationContext().getAsync('PERMISSION:manageService')
await this.manageService.setUserRole(this.ctx, 'admin')
}
0.0.22
10 months ago
0.0.20
10 months ago
0.0.21
10 months ago
0.0.19
10 months ago
0.0.16
10 months ago
0.0.17
10 months ago
0.0.18
10 months ago
0.0.15
11 months ago
0.0.14
12 months ago
0.0.13
1 year ago
0.0.12
3 years ago
0.0.11
4 years ago
0.0.10
4 years ago
0.0.9
4 years ago
0.0.8
4 years ago
0.0.7
4 years ago
0.0.5
4 years ago
0.0.6
4 years ago
0.0.4
4 years ago
0.0.3
4 years ago
0.0.2
4 years ago
0.0.1
4 years ago