0.0.22 • Published 9 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
9 months ago
0.0.20
9 months ago
0.0.21
9 months ago
0.0.19
9 months ago
0.0.16
9 months ago
0.0.17
9 months ago
0.0.18
9 months ago
0.0.15
10 months ago
0.0.14
10 months ago
0.0.13
11 months 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