fix(acl): add rolesUsers through collection

This commit is contained in:
chenos 2023-10-07 21:49:01 +08:00
parent 1b3b07f029
commit 86309e33be
3 changed files with 38 additions and 2 deletions

View File

@ -381,6 +381,43 @@ export class PluginACL extends Plugin {
default: true,
},
});
const data = {
name: 'rolesUsers',
title: 'rolesUsers',
hidden: true,
fields: [
{
name: 'roleName',
type: 'string',
interface: 'input',
isForeignKey: true,
uiSchema: {
type: 'string',
title: 'roleName',
'x-component': 'Input',
'x-read-pretty': true,
},
},
{
name: 'userId',
type: 'bigInt',
interface: 'integer',
isForeignKey: true,
uiSchema: {
type: 'number',
title: 'userId',
'x-component': 'InputNumber',
'x-read-pretty': true,
},
},
],
timestamps: true,
autoGenId: false,
autoCreate: true,
isThrough: true,
sortable: false,
};
await this.db.getRepository('collections').create({ values: data });
});
this.app.on('beforeInstallPlugin', async (plugin) => {

View File

@ -3,7 +3,7 @@ import { afterCreateForForeignKeyField } from '../hooks/afterCreateForForeignKey
export default class DropForeignKeysMigration extends Migration {
async up() {
const result = await this.app.version.satisfies('<0.8.0');
const result = await this.app.version.satisfies('<0.14.0-alpha.8');
if (!result) {
return;

View File

@ -9,7 +9,6 @@ import * as actions from './actions/users';
import initAuthenticators from './authenticators';
import { JwtOptions, JwtService } from './jwt-service';
import { enUS, zhCN } from './locale';
import { parseToken } from './middlewares';
export interface UserPluginConfig {
name?: string;