@holoyan/adonisjs-permissions 1.0.0 → 1.0.2

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/README.md CHANGED
@@ -132,8 +132,8 @@ export default class Post extends BaseModel implements AclModelInterface {
132
132
 
133
133
  ## Release Notes
134
134
 
135
- Version: >= 'v0.8.18'
136
- * Fix: Overwriting global scope
135
+ Version: >= v1.0.2
136
+ * Update: Mixin getModelId method return type
137
137
 
138
138
  ## Mixins
139
139
 
@@ -1,8 +1,8 @@
1
1
  import type { NormalizeConstructor } from '@adonisjs/core/types/helpers';
2
- import { AclModel } from '../types.js';
2
+ import { AclModel, ModelIdType } from '../types.js';
3
3
  export declare function hasPermissions(): <Model extends NormalizeConstructor<import("@adonisjs/lucid/types/model").LucidModel>>(superclass: Model) => {
4
4
  new (...args: any[]): {
5
- getModelId(): string;
5
+ getModelId(): ModelIdType;
6
6
  roles(): import("@adonisjs/lucid/types/model").ModelQueryBuilderContract<import("@adonisjs/lucid/types/model").LucidModel, import("../types.js").RoleModel<import("@adonisjs/lucid/types/model").LucidModel>>;
7
7
  hasRole(role: string): Promise<boolean>;
8
8
  hasAllRoles(...roles: string[]): Promise<boolean>;
@@ -10,6 +10,6 @@ export default class ModelManager {
10
10
  if (key in this.models) {
11
11
  return this.models[key];
12
12
  }
13
- throw new Error('Model not defined');
13
+ throw new Error('Model not defined for key: ' + key);
14
14
  }
15
15
  }
@@ -15,7 +15,7 @@ export default class UserScopeMiddleware {
15
15
  //@ts-ignore
16
16
  async handle(ctx: HttpContext, next: NextFn) {
17
17
  const scope = new Scope()
18
- ctx.acl = new AclManager().scope(scope)
18
+ ctx.acl = new AclManager(true).scope(scope)
19
19
  /**
20
20
  * Call next method in the pipeline and return its output
21
21
  */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@holoyan/adonisjs-permissions",
3
3
  "description": "Adonisjs roles and permissions system",
4
- "version": "1.0.0",
4
+ "version": "1.0.2",
5
5
  "engines": {
6
6
  "node": ">=18.16.0"
7
7
  },