mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 07:15:36 +00:00
fix: reload users collection options on initialization
This commit is contained in:
parent
c6e1fd2d5f
commit
18e7d5ba77
@ -77,6 +77,9 @@ api.resourcer.use(async (ctx: actions.Context, next) => {
|
||||
});
|
||||
|
||||
await api.database.getModel('collections').load({skipExisting: true});
|
||||
await api.database.getModel('collections').load({where: {
|
||||
name: 'users',
|
||||
}});
|
||||
api.listen(process.env.HTTP_PORT, () => {
|
||||
console.log(`http://localhost:${process.env.HTTP_PORT}/`);
|
||||
});
|
||||
|
@ -0,0 +1,19 @@
|
||||
import api from '../app';
|
||||
import Database from '@nocobase/database';
|
||||
|
||||
(async () => {
|
||||
await api.loadPlugins();
|
||||
const database: Database = api.database;
|
||||
await api.database.sync({
|
||||
tables: ['actions_scopes'],
|
||||
});
|
||||
|
||||
const [Collection, User, Role] = database.getModels(['collections', 'users', 'roles']);
|
||||
|
||||
const tables = database.getTables(['actions_scopes']);
|
||||
|
||||
for (let table of tables) {
|
||||
console.log(table.getName());
|
||||
await Collection.import(table.getOptions(), { update: true, migrate: false });
|
||||
}
|
||||
})();
|
@ -211,7 +211,7 @@ export default async (ctx, next) => {
|
||||
let throughName;
|
||||
const { resourceKey: resourceKey2, associatedName, resourceFieldName, associatedKey } = values;
|
||||
// TODO: 暂时不处理 developerMode 和 internal 的情况
|
||||
const permissions = (ctx.ac.isRoot() || collection.developerMode || collection.internal)
|
||||
const permissions = (await ctx.ac.isRoot() || collection.developerMode || collection.internal)
|
||||
? await ctx.ac.getRootPermissions()
|
||||
: await ctx.ac.can(resourceName).permissions();
|
||||
ctx.listFields = [];
|
||||
@ -235,6 +235,7 @@ export default async (ctx, next) => {
|
||||
}
|
||||
}
|
||||
// console.log({
|
||||
// a: (await ctx.ac.isRoot() || collection.developerMode || collection.internal),
|
||||
// listFields: ctx.listFields,
|
||||
// createFields: ctx.createFields,
|
||||
// updateFields: ctx.updateFields,
|
||||
|
Loading…
Reference in New Issue
Block a user