adminizer 4.6.0-build.202 → 4.6.0-build.203

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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "adminizer",
3
3
  "type": "module",
4
- "version": "4.6.0-build.202",
4
+ "version": "4.6.0-build.203",
5
5
  "main": "index.js",
6
6
  "exports": {
7
7
  ".": "./index.js",
@@ -10,5 +10,5 @@ export default class Router {
10
10
  */
11
11
  bind(): Promise<void>;
12
12
  unbindModelRoutes(model: string): void;
13
- bindModelRoutes(policies: MiddlewareType[], model: string): Promise<void>;
13
+ bindModelRoutes(model: string, policies?: MiddlewareType[]): Promise<void>;
14
14
  }
package/system/Router.js CHANGED
@@ -132,7 +132,7 @@ export default class Router {
132
132
  adminizer.app.get(`${adminizer.config.routePrefix}/get-timezones`, adminizer.policyManager.bindPolicies(policies, timezones));
133
133
  if (adminizer.config.models) {
134
134
  for (let model in adminizer.config.models) {
135
- await this.bindModelRoutes(policies, model);
135
+ await this.bindModelRoutes(model, policies);
136
136
  }
137
137
  }
138
138
  /**
@@ -172,7 +172,9 @@ export default class Router {
172
172
  this.modelRoutePatterns.delete(model);
173
173
  Adminizer.log.debug(`Adminpanel removed routes for model \`${model}\`: ${removedPaths.join(', ')}`);
174
174
  }
175
- async bindModelRoutes(policies, model) {
175
+ async bindModelRoutes(model, policies) {
176
+ if (!policies)
177
+ policies = this.adminizer.config.policies;
176
178
  if (this.modelRoutePatterns.has(model)) {
177
179
  this.unbindModelRoutes(model);
178
180
  }