@ooneex/permission 1.2.0 → 1.2.1

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
@@ -503,18 +503,18 @@ class AdminPermission extends Permission {
503
503
 
504
504
  // Set permissions based on role
505
505
  switch (user.role) {
506
- case ERole.SUPER_ADMIN:
506
+ case 'ROLE_SUPER_ADMIN':
507
507
  this.ability.can(EPermissionAction.MANAGE, 'all');
508
508
  break;
509
509
 
510
- case ERole.ADMIN:
510
+ case 'ROLE_ADMIN':
511
511
  this.ability.can(EPermissionAction.CREATE, 'User');
512
512
  this.ability.can(EPermissionAction.READ, 'User');
513
513
  this.ability.can(EPermissionAction.UPDATE, 'User');
514
514
  this.ability.cannot(EPermissionAction.DELETE, 'User');
515
515
  break;
516
516
 
517
- case ERole.MODERATOR:
517
+ case 'ROLE_MODERATOR':
518
518
  this.ability.can(EPermissionAction.READ, 'User');
519
519
  this.ability.can(EPermissionAction.MODERATE, 'User');
520
520
  this.ability.can(EPermissionAction.BAN, 'User');
package/dist/index.d.ts CHANGED
@@ -11,7 +11,6 @@ import { ILogger, LogsEntity } from "@ooneex/logger";
11
11
  import { IMailer } from "@ooneex/mailer";
12
12
  import { IPermission } from "@ooneex/permission";
13
13
  import { IRateLimiter } from "@ooneex/rate-limit";
14
- import { ERole } from "@ooneex/role";
15
14
  import { IStorage } from "@ooneex/storage";
16
15
  import { LocaleInfoType } from "@ooneex/translation";
17
16
  import { HttpMethodType, ScalarType } from "@ooneex/types";
@@ -34,7 +33,7 @@ type ContextType<T extends ContextConfigType = ContextConfigType> = {
34
33
  method: HttpMethodType;
35
34
  version: number;
36
35
  description: string;
37
- roles?: ERole[];
36
+ roles?: Uppercase<string>[];
38
37
  } | null;
39
38
  env: IAppEnv;
40
39
  response: IResponse<T["response"]>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ooneex/permission",
3
3
  "description": "Fine-grained access control using CASL — define, evaluate, and enforce ability-based permissions with role and resource scoping",
4
- "version": "1.2.0",
4
+ "version": "1.2.1",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist",
@@ -30,11 +30,11 @@
30
30
  "dependencies": {
31
31
  "@casl/ability": "^6.7.3",
32
32
  "@ooneex/container": "^1.5.1",
33
- "@ooneex/exception": "^1.2.9",
33
+ "@ooneex/exception": "^1.2.10",
34
34
  "@ooneex/http-status": "^1.1.11"
35
35
  },
36
36
  "devDependencies": {
37
- "@ooneex/user": "^1.2.10"
37
+ "@ooneex/user": "^1.2.11"
38
38
  },
39
39
  "keywords": [
40
40
  "authorization",