@nocobase/acl 2.0.0-alpha.49 → 2.0.0-alpha.50

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/acl.js +4 -2
  2. package/package.json +4 -4
package/lib/acl.js CHANGED
@@ -465,9 +465,11 @@ const _ACL = class _ACL extends import_events.default {
465
465
  __name(_ACL, "ACL");
466
466
  let ACL = _ACL;
467
467
  function getUser(ctx) {
468
+ const dataSource = ctx.app.dataSourceManager.dataSources.get("main");
469
+ const db = dataSource.collectionManager.db;
468
470
  return async ({ fields }) => {
469
471
  var _a, _b;
470
- const userFields = fields.filter((f) => f && ctx.db.getFieldByPath("users." + f));
472
+ const userFields = fields.filter((f) => f && db.getFieldByPath("users." + f));
471
473
  (_a = ctx.logger) == null ? void 0 : _a.info("filter-parse: ", { userFields });
472
474
  if (!ctx.state.currentUser) {
473
475
  return;
@@ -475,7 +477,7 @@ function getUser(ctx) {
475
477
  if (!userFields.length) {
476
478
  return;
477
479
  }
478
- const user = await ctx.db.getRepository("users").findOne({
480
+ const user = await db.getRepository("users").findOne({
479
481
  filterByTk: ctx.state.currentUser.id,
480
482
  fields: userFields
481
483
  });
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@nocobase/acl",
3
- "version": "2.0.0-alpha.49",
3
+ "version": "2.0.0-alpha.50",
4
4
  "description": "",
5
5
  "license": "AGPL-3.0",
6
6
  "main": "./lib/index.js",
7
7
  "types": "./lib/index.d.ts",
8
8
  "dependencies": {
9
- "@nocobase/resourcer": "2.0.0-alpha.49",
10
- "@nocobase/utils": "2.0.0-alpha.49",
9
+ "@nocobase/resourcer": "2.0.0-alpha.50",
10
+ "@nocobase/utils": "2.0.0-alpha.50",
11
11
  "minimatch": "^5.1.1"
12
12
  },
13
13
  "repository": {
@@ -15,5 +15,5 @@
15
15
  "url": "git+https://github.com/nocobase/nocobase.git",
16
16
  "directory": "packages/acl"
17
17
  },
18
- "gitHead": "99f71bc8961da62a761630b3eae11092a4372e3e"
18
+ "gitHead": "a6eb64abf3632e116ad0b295a7f410270a1059d1"
19
19
  }