@driveflux/auth 4.0.77 → 4.0.79

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 (159) hide show
  1. package/dist/AuthProvider.d.ts +1 -0
  2. package/dist/AuthProvider.d.ts.map +1 -0
  3. package/dist/AuthProvider.js +76 -59
  4. package/dist/ability.d.ts +1 -0
  5. package/dist/ability.d.ts.map +1 -0
  6. package/dist/authorization/constants.d.ts +2 -1
  7. package/dist/authorization/constants.d.ts.map +1 -0
  8. package/dist/authorization/constants.js +45 -24
  9. package/dist/authorization/define.d.ts +1 -0
  10. package/dist/authorization/define.d.ts.map +1 -0
  11. package/dist/authorization/define.js +57 -28
  12. package/dist/authorization/fields/index.d.ts +1 -0
  13. package/dist/authorization/fields/index.d.ts.map +1 -0
  14. package/dist/authorization/fields/index.js +4 -7
  15. package/dist/authorization/helpers.d.ts +1 -0
  16. package/dist/authorization/helpers.d.ts.map +1 -0
  17. package/dist/authorization/helpers.js +10 -8
  18. package/dist/authorization/index.d.ts +1 -0
  19. package/dist/authorization/index.d.ts.map +1 -0
  20. package/dist/authorization/index.js +6 -6
  21. package/dist/authorization/permissions-list.d.ts +2 -0
  22. package/dist/authorization/permissions-list.d.ts.map +1 -0
  23. package/dist/authorization/permissions-list.js +6 -7
  24. package/dist/authorization/quick.d.ts +1 -0
  25. package/dist/authorization/quick.d.ts.map +1 -0
  26. package/dist/authorization/quick.js +1 -1
  27. package/dist/authorization/roles/admin/business-development-executive.d.ts +1 -0
  28. package/dist/authorization/roles/admin/business-development-executive.d.ts.map +1 -0
  29. package/dist/authorization/roles/admin/business-development-executive.js +20 -7
  30. package/dist/authorization/roles/admin/ceo.d.ts +1 -0
  31. package/dist/authorization/roles/admin/ceo.d.ts.map +1 -0
  32. package/dist/authorization/roles/admin/ceo.js +4 -2
  33. package/dist/authorization/roles/admin/common.d.ts +1 -0
  34. package/dist/authorization/roles/admin/common.d.ts.map +1 -0
  35. package/dist/authorization/roles/admin/common.js +7 -3
  36. package/dist/authorization/roles/admin/concierge.d.ts +1 -0
  37. package/dist/authorization/roles/admin/concierge.d.ts.map +1 -0
  38. package/dist/authorization/roles/admin/concierge.js +35 -10
  39. package/dist/authorization/roles/admin/customer-success-executive.d.ts +1 -0
  40. package/dist/authorization/roles/admin/customer-success-executive.d.ts.map +1 -0
  41. package/dist/authorization/roles/admin/customer-success-executive.js +40 -10
  42. package/dist/authorization/roles/admin/data-analyst.d.ts +1 -0
  43. package/dist/authorization/roles/admin/data-analyst.d.ts.map +1 -0
  44. package/dist/authorization/roles/admin/data-analyst.js +7 -4
  45. package/dist/authorization/roles/admin/designer.d.ts +1 -0
  46. package/dist/authorization/roles/admin/designer.d.ts.map +1 -0
  47. package/dist/authorization/roles/admin/designer.js +7 -4
  48. package/dist/authorization/roles/admin/engineer.d.ts +1 -0
  49. package/dist/authorization/roles/admin/engineer.d.ts.map +1 -0
  50. package/dist/authorization/roles/admin/engineer.js +7 -4
  51. package/dist/authorization/roles/admin/finance-executive.d.ts +1 -0
  52. package/dist/authorization/roles/admin/finance-executive.d.ts.map +1 -0
  53. package/dist/authorization/roles/admin/finance-executive.js +11 -4
  54. package/dist/authorization/roles/admin/head-of-business-development.d.ts +1 -0
  55. package/dist/authorization/roles/admin/head-of-business-development.d.ts.map +1 -0
  56. package/dist/authorization/roles/admin/head-of-business-development.js +14 -4
  57. package/dist/authorization/roles/admin/head-of-data-analytics.d.ts +1 -0
  58. package/dist/authorization/roles/admin/head-of-data-analytics.d.ts.map +1 -0
  59. package/dist/authorization/roles/admin/head-of-data-analytics.js +14 -4
  60. package/dist/authorization/roles/admin/head-of-engineering.d.ts +1 -0
  61. package/dist/authorization/roles/admin/head-of-engineering.d.ts.map +1 -0
  62. package/dist/authorization/roles/admin/head-of-engineering.js +17 -6
  63. package/dist/authorization/roles/admin/head-of-finance.d.ts +1 -0
  64. package/dist/authorization/roles/admin/head-of-finance.d.ts.map +1 -0
  65. package/dist/authorization/roles/admin/head-of-finance.js +8 -3
  66. package/dist/authorization/roles/admin/head-of-human-resources.d.ts +1 -0
  67. package/dist/authorization/roles/admin/head-of-human-resources.d.ts.map +1 -0
  68. package/dist/authorization/roles/admin/head-of-human-resources.js +13 -5
  69. package/dist/authorization/roles/admin/head-of-marketing.d.ts +1 -0
  70. package/dist/authorization/roles/admin/head-of-marketing.d.ts.map +1 -0
  71. package/dist/authorization/roles/admin/head-of-marketing.js +17 -5
  72. package/dist/authorization/roles/admin/head-of-operations.d.ts +1 -0
  73. package/dist/authorization/roles/admin/head-of-operations.d.ts.map +1 -0
  74. package/dist/authorization/roles/admin/head-of-operations.js +8 -3
  75. package/dist/authorization/roles/admin/head-of-product.d.ts +1 -0
  76. package/dist/authorization/roles/admin/head-of-product.d.ts.map +1 -0
  77. package/dist/authorization/roles/admin/head-of-product.js +17 -6
  78. package/dist/authorization/roles/admin/head-of-sales.d.ts +1 -0
  79. package/dist/authorization/roles/admin/head-of-sales.d.ts.map +1 -0
  80. package/dist/authorization/roles/admin/head-of-sales.js +17 -5
  81. package/dist/authorization/roles/admin/human-resources-executive.d.ts +1 -0
  82. package/dist/authorization/roles/admin/human-resources-executive.d.ts.map +1 -0
  83. package/dist/authorization/roles/admin/human-resources-executive.js +12 -5
  84. package/dist/authorization/roles/admin/marketing-executive.d.ts +1 -0
  85. package/dist/authorization/roles/admin/marketing-executive.d.ts.map +1 -0
  86. package/dist/authorization/roles/admin/marketing-executive.js +7 -4
  87. package/dist/authorization/roles/admin/product-manager.d.ts +1 -0
  88. package/dist/authorization/roles/admin/product-manager.d.ts.map +1 -0
  89. package/dist/authorization/roles/admin/product-manager.js +7 -4
  90. package/dist/authorization/roles/admin/sales-executive.d.ts +1 -0
  91. package/dist/authorization/roles/admin/sales-executive.d.ts.map +1 -0
  92. package/dist/authorization/roles/admin/sales-executive.js +24 -8
  93. package/dist/authorization/roles/consumer/business-admin.d.ts +1 -0
  94. package/dist/authorization/roles/consumer/business-admin.d.ts.map +1 -0
  95. package/dist/authorization/roles/consumer/business-admin.js +19 -6
  96. package/dist/authorization/roles/consumer/business-user.d.ts +1 -0
  97. package/dist/authorization/roles/consumer/business-user.d.ts.map +1 -0
  98. package/dist/authorization/roles/consumer/business-user.js +18 -6
  99. package/dist/authorization/roles/consumer/member.d.ts +1 -0
  100. package/dist/authorization/roles/consumer/member.d.ts.map +1 -0
  101. package/dist/authorization/roles/consumer/member.js +16 -6
  102. package/dist/authorization/types.d.ts +1 -0
  103. package/dist/authorization/types.d.ts.map +1 -0
  104. package/dist/authorization/types.js +1 -1
  105. package/dist/authorization/update-user-permissions.d.ts +1 -0
  106. package/dist/authorization/update-user-permissions.d.ts.map +1 -0
  107. package/dist/authorization/update-user-permissions.js +22 -15
  108. package/dist/authorization/utils.d.ts +1 -0
  109. package/dist/authorization/utils.d.ts.map +1 -0
  110. package/dist/authorization/utils.js +26 -11
  111. package/dist/constants.d.ts +1 -0
  112. package/dist/constants.d.ts.map +1 -0
  113. package/dist/constants.js +2 -4
  114. package/dist/context.d.ts +1 -0
  115. package/dist/context.d.ts.map +1 -0
  116. package/dist/context.js +8 -9
  117. package/dist/default.d.ts +1 -0
  118. package/dist/default.d.ts.map +1 -0
  119. package/dist/default.js +1 -1
  120. package/dist/index.d.ts +1 -0
  121. package/dist/index.d.ts.map +1 -0
  122. package/dist/providers.d.ts +1 -0
  123. package/dist/providers.d.ts.map +1 -0
  124. package/dist/react.d.ts +1 -0
  125. package/dist/react.d.ts.map +1 -0
  126. package/dist/server/authenticate-user.d.ts +1 -0
  127. package/dist/server/authenticate-user.d.ts.map +1 -0
  128. package/dist/server/authenticate-user.js +11 -7
  129. package/dist/server/cors.d.ts +1 -0
  130. package/dist/server/cors.d.ts.map +1 -0
  131. package/dist/server/cors.js +23 -12
  132. package/dist/server/credentials-provider.d.ts +1 -0
  133. package/dist/server/credentials-provider.d.ts.map +1 -0
  134. package/dist/server/credentials-provider.js +2 -2
  135. package/dist/server/index.d.ts +1 -0
  136. package/dist/server/index.d.ts.map +1 -0
  137. package/dist/server/next-auth.d.ts +16 -15
  138. package/dist/server/next-auth.d.ts.map +1 -0
  139. package/dist/server/next-auth.js +104 -109
  140. package/dist/server/prisma-adapter.d.ts +1 -0
  141. package/dist/server/prisma-adapter.d.ts.map +1 -0
  142. package/dist/server/prisma-adapter.js +88 -52
  143. package/dist/server/types.d.ts +1 -0
  144. package/dist/server/types.d.ts.map +1 -0
  145. package/dist/server/verfiy-token.d.ts +1 -0
  146. package/dist/server/verfiy-token.d.ts.map +1 -0
  147. package/dist/server/verfiy-token.js +39 -24
  148. package/dist/translations.d.ts +1 -0
  149. package/dist/translations.d.ts.map +1 -0
  150. package/dist/translations.js +4 -4
  151. package/dist/types.d.ts +1 -0
  152. package/dist/types.d.ts.map +1 -0
  153. package/dist/use-auth.d.ts +1 -0
  154. package/dist/use-auth.d.ts.map +1 -0
  155. package/dist/use-auth.js +1 -1
  156. package/dist/use-session.d.ts +1 -0
  157. package/dist/use-session.d.ts.map +1 -0
  158. package/dist/use-session.js +1 -1
  159. package/package.json +1 -1
@@ -1,6 +1,11 @@
1
- export const defineRoleAbilitiesHeadOfFinance = async (can, cannot) => {
1
+ export const defineRoleAbilitiesHeadOfFinance = async (can, cannot)=>{
2
2
  can('manage', 'all');
3
- cannot('update', 'Host', ['accountManagerId']);
4
- cannot('manage', ['Vacancy', 'Applicant']);
3
+ cannot('update', 'Host', [
4
+ 'accountManagerId'
5
+ ]);
6
+ cannot('manage', [
7
+ 'Vacancy',
8
+ 'Applicant'
9
+ ]);
5
10
  can('manageAdmin', 'Reports');
6
11
  };
@@ -1,3 +1,4 @@
1
1
  import type { AbilityBuilder } from '@casl/ability';
2
2
  import type { AppAbility } from '../../types.js';
3
3
  export declare const defineRoleAbilitiesHeadOfHumanResources: (can: AbilityBuilder<AppAbility>["can"], cannot: AbilityBuilder<AppAbility>["cannot"]) => Promise<void>;
4
+ //# sourceMappingURL=head-of-human-resources.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"head-of-human-resources.d.ts","sourceRoot":"","sources":["../../../../src/authorization/roles/admin/head-of-human-resources.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAEnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAEhD,eAAO,MAAM,uCAAuC,GACnD,KAAK,cAAc,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,EACtC,QAAQ,cAAc,CAAC,UAAU,CAAC,CAAC,QAAQ,CAAC,kBAU5C,CAAA"}
@@ -1,11 +1,19 @@
1
1
  import { OWNER_ROLES } from '../../constants.js';
2
- export const defineRoleAbilitiesHeadOfHumanResources = async (can, cannot) => {
2
+ export const defineRoleAbilitiesHeadOfHumanResources = async (can, cannot)=>{
3
3
  can('manage', 'all');
4
- cannot(['create', 'update', 'delete'], 'User', undefined, {
4
+ cannot([
5
+ 'create',
6
+ 'update',
7
+ 'delete'
8
+ ], 'User', undefined, {
5
9
  groups: {
6
- hasSome: [...OWNER_ROLES],
7
- },
10
+ hasSome: [
11
+ ...OWNER_ROLES
12
+ ]
13
+ }
8
14
  });
9
- cannot('update', 'Host', ['accountManagerId']);
15
+ cannot('update', 'Host', [
16
+ 'accountManagerId'
17
+ ]);
10
18
  can('manageAdmin', 'Reports');
11
19
  };
@@ -1,3 +1,4 @@
1
1
  import type { AbilityBuilder } from '@casl/ability';
2
2
  import type { AppAbility } from '../../types.js';
3
3
  export declare const defineRoleAbilitiesHeadOfMarketing: (can: AbilityBuilder<AppAbility>["can"], cannot: AbilityBuilder<AppAbility>["cannot"]) => Promise<void>;
4
+ //# sourceMappingURL=head-of-marketing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"head-of-marketing.d.ts","sourceRoot":"","sources":["../../../../src/authorization/roles/admin/head-of-marketing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAEhD,eAAO,MAAM,kCAAkC,GAC9C,KAAK,cAAc,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,EACtC,QAAQ,cAAc,CAAC,UAAU,CAAC,CAAC,QAAQ,CAAC,kBAU5C,CAAA"}
@@ -1,10 +1,22 @@
1
- export const defineRoleAbilitiesHeadOfMarketing = async (can, cannot) => {
1
+ export const defineRoleAbilitiesHeadOfMarketing = async (can, cannot)=>{
2
2
  can('manage', 'all');
3
- cannot(['create', 'update'], 'Payout');
4
- cannot(['release', 'reverse', 'deletePayoutChargeLine'], 'Payout');
3
+ cannot([
4
+ 'create',
5
+ 'update'
6
+ ], 'Payout');
7
+ cannot([
8
+ 'release',
9
+ 'reverse',
10
+ 'deletePayoutChargeLine'
11
+ ], 'Payout');
5
12
  cannot('cancelInvoice', 'Invoice');
6
13
  cannot('markInvoice', 'Invoice');
7
- cannot('update', 'Host', ['accountManagerId']);
8
- cannot('manage', ['Vacancy', 'Applicant']);
14
+ cannot('update', 'Host', [
15
+ 'accountManagerId'
16
+ ]);
17
+ cannot('manage', [
18
+ 'Vacancy',
19
+ 'Applicant'
20
+ ]);
9
21
  can('manageAdmin', 'Reports');
10
22
  };
@@ -1,3 +1,4 @@
1
1
  import type { AbilityBuilder } from '@casl/ability';
2
2
  import type { AppAbility } from '../../types.js';
3
3
  export declare const defineRoleAbilitiesHeadOfOperations: (can: AbilityBuilder<AppAbility>["can"], cannot: AbilityBuilder<AppAbility>["cannot"]) => Promise<void>;
4
+ //# sourceMappingURL=head-of-operations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"head-of-operations.d.ts","sourceRoot":"","sources":["../../../../src/authorization/roles/admin/head-of-operations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAEhD,eAAO,MAAM,mCAAmC,GAC/C,KAAK,cAAc,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,EACtC,QAAQ,cAAc,CAAC,UAAU,CAAC,CAAC,QAAQ,CAAC,kBAO5C,CAAA"}
@@ -1,7 +1,12 @@
1
- export const defineRoleAbilitiesHeadOfOperations = async (can, cannot) => {
1
+ export const defineRoleAbilitiesHeadOfOperations = async (can, cannot)=>{
2
2
  can('manage', 'all');
3
- cannot('update', 'Host', ['accountManagerId']);
4
- cannot('manage', ['Vacancy', 'Applicant']);
3
+ cannot('update', 'Host', [
4
+ 'accountManagerId'
5
+ ]);
6
+ cannot('manage', [
7
+ 'Vacancy',
8
+ 'Applicant'
9
+ ]);
5
10
  can('updateSubscriptionUser', 'Subscription');
6
11
  can('manageAdmin', 'Reports');
7
12
  };
@@ -1,3 +1,4 @@
1
1
  import type { AbilityBuilder } from '@casl/ability';
2
2
  import type { AppAbility } from '../../types.js';
3
3
  export declare const defineRoleAbilitiesHeadOfProduct: (can: AbilityBuilder<AppAbility>["can"], cannot: AbilityBuilder<AppAbility>["cannot"]) => Promise<void>;
4
+ //# sourceMappingURL=head-of-product.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"head-of-product.d.ts","sourceRoot":"","sources":["../../../../src/authorization/roles/admin/head-of-product.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAEnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAEhD,eAAO,MAAM,gCAAgC,GAC5C,KAAK,cAAc,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,EACtC,QAAQ,cAAc,CAAC,UAAU,CAAC,CAAC,QAAQ,CAAC,kBAW5C,CAAA"}
@@ -1,12 +1,23 @@
1
1
  import { OWNER_ROLES } from '../../constants.js';
2
- export const defineRoleAbilitiesHeadOfProduct = async (can, cannot) => {
2
+ export const defineRoleAbilitiesHeadOfProduct = async (can, cannot)=>{
3
3
  can('manage', 'all');
4
- cannot(['create', 'update', 'delete'], 'User', undefined, {
4
+ cannot([
5
+ 'create',
6
+ 'update',
7
+ 'delete'
8
+ ], 'User', undefined, {
5
9
  groups: {
6
- hasSome: [...OWNER_ROLES],
7
- },
10
+ hasSome: [
11
+ ...OWNER_ROLES
12
+ ]
13
+ }
8
14
  });
9
- cannot('update', 'Host', ['accountManagerId']);
10
- cannot('manage', ['Vacancy', 'Applicant']);
15
+ cannot('update', 'Host', [
16
+ 'accountManagerId'
17
+ ]);
18
+ cannot('manage', [
19
+ 'Vacancy',
20
+ 'Applicant'
21
+ ]);
11
22
  can('manageAdmin', 'Reports');
12
23
  };
@@ -1,3 +1,4 @@
1
1
  import type { AbilityBuilder } from '@casl/ability';
2
2
  import type { AppAbility } from '../../types.js';
3
3
  export declare const defineRoleAbilitiesHeadOfSales: (can: AbilityBuilder<AppAbility>["can"], cannot: AbilityBuilder<AppAbility>["cannot"]) => Promise<void>;
4
+ //# sourceMappingURL=head-of-sales.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"head-of-sales.d.ts","sourceRoot":"","sources":["../../../../src/authorization/roles/admin/head-of-sales.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAEhD,eAAO,MAAM,8BAA8B,GAC1C,KAAK,cAAc,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,EACtC,QAAQ,cAAc,CAAC,UAAU,CAAC,CAAC,QAAQ,CAAC,kBAU5C,CAAA"}
@@ -1,10 +1,22 @@
1
- export const defineRoleAbilitiesHeadOfSales = async (can, cannot) => {
1
+ export const defineRoleAbilitiesHeadOfSales = async (can, cannot)=>{
2
2
  can('manage', 'all');
3
- cannot(['create', 'update'], 'Payout');
4
- cannot(['release', 'reverse', 'deletePayoutChargeLine'], 'Payout');
3
+ cannot([
4
+ 'create',
5
+ 'update'
6
+ ], 'Payout');
7
+ cannot([
8
+ 'release',
9
+ 'reverse',
10
+ 'deletePayoutChargeLine'
11
+ ], 'Payout');
5
12
  cannot('cancelInvoice', 'Invoice');
6
13
  cannot('markInvoice', 'Invoice');
7
- cannot('update', 'Host', ['accountManagerId']);
8
- cannot('manage', ['Vacancy', 'Applicant']);
14
+ cannot('update', 'Host', [
15
+ 'accountManagerId'
16
+ ]);
17
+ cannot('manage', [
18
+ 'Vacancy',
19
+ 'Applicant'
20
+ ]);
9
21
  can('manageAdmin', 'Reports');
10
22
  };
@@ -1,3 +1,4 @@
1
1
  import type { AbilityBuilder } from '@casl/ability';
2
2
  import type { AppAbility } from '../../types.js';
3
3
  export declare const defineRoleAbilitiesHumanResourceExecutive: (can: AbilityBuilder<AppAbility>["can"], cannot: AbilityBuilder<AppAbility>["cannot"]) => Promise<void>;
4
+ //# sourceMappingURL=human-resources-executive.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"human-resources-executive.d.ts","sourceRoot":"","sources":["../../../../src/authorization/roles/admin/human-resources-executive.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAGhD,eAAO,MAAM,yCAAyC,GACrD,KAAK,cAAc,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,EACtC,QAAQ,cAAc,CAAC,UAAU,CAAC,CAAC,QAAQ,CAAC,kBA8B5C,CAAA"}
@@ -1,5 +1,5 @@
1
1
  import { getDocumentsFields } from '../../utils.js';
2
- export const defineRoleAbilitiesHumanResourceExecutive = async (can, cannot) => {
2
+ export const defineRoleAbilitiesHumanResourceExecutive = async (can, cannot)=>{
3
3
  can('read', [
4
4
  'Subscription',
5
5
  'Invoice',
@@ -17,15 +17,22 @@ export const defineRoleAbilitiesHumanResourceExecutive = async (can, cannot) =>
17
17
  'Discount',
18
18
  'PlatformConfig',
19
19
  'Vacancy',
20
- 'Applicant',
20
+ 'Applicant'
21
+ ]);
22
+ cannot('read', [
23
+ 'User'
24
+ ], [
25
+ 'documents'
21
26
  ]);
22
- cannot('read', ['User'], ['documents']);
23
27
  cannot('create', 'Business');
24
28
  cannot('read', 'User', [
25
29
  ...getDocumentsFields('identification'),
26
30
  ...getDocumentsFields('drivingHistory'),
27
31
  ...getDocumentsFields('financial'),
28
- ...getDocumentsFields('offerLetter'),
32
+ ...getDocumentsFields('offerLetter')
33
+ ]);
34
+ can('manage', [
35
+ 'Vacancy',
36
+ 'Applicant'
29
37
  ]);
30
- can('manage', ['Vacancy', 'Applicant']);
31
38
  };
@@ -1,3 +1,4 @@
1
1
  import type { AbilityBuilder } from '@casl/ability';
2
2
  import type { AppAbility } from '../../types.js';
3
3
  export declare const defineRoleAbilitiesMarketingExecutive: (can: AbilityBuilder<AppAbility>["can"], cannot: AbilityBuilder<AppAbility>["cannot"]) => Promise<void>;
4
+ //# sourceMappingURL=marketing-executive.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"marketing-executive.d.ts","sourceRoot":"","sources":["../../../../src/authorization/roles/admin/marketing-executive.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAGhD,eAAO,MAAM,qCAAqC,GACjD,KAAK,cAAc,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,EACtC,QAAQ,cAAc,CAAC,UAAU,CAAC,CAAC,QAAQ,CAAC,kBA8B5C,CAAA"}
@@ -1,5 +1,5 @@
1
1
  import { getDocumentsFields } from '../../utils.js';
2
- export const defineRoleAbilitiesMarketingExecutive = async (can, cannot) => {
2
+ export const defineRoleAbilitiesMarketingExecutive = async (can, cannot)=>{
3
3
  can('read', [
4
4
  'Subscription',
5
5
  'Cycle',
@@ -16,7 +16,7 @@ export const defineRoleAbilitiesMarketingExecutive = async (can, cannot) => {
16
16
  'PaymentLink',
17
17
  'Invoice',
18
18
  'Transaction',
19
- 'Refund',
19
+ 'Refund'
20
20
  ]);
21
21
  can('manage', 'Coupon');
22
22
  can('readPricingInput', 'Vehicle');
@@ -25,7 +25,10 @@ export const defineRoleAbilitiesMarketingExecutive = async (can, cannot) => {
25
25
  ...getDocumentsFields('identification'),
26
26
  ...getDocumentsFields('drivingHistory'),
27
27
  ...getDocumentsFields('financial'),
28
- ...getDocumentsFields('offerLetter'),
28
+ ...getDocumentsFields('offerLetter')
29
+ ]);
30
+ cannot('read', [
31
+ 'Vacancy',
32
+ 'Applicant'
29
33
  ]);
30
- cannot('read', ['Vacancy', 'Applicant']);
31
34
  };
@@ -1,3 +1,4 @@
1
1
  import type { AbilityBuilder } from '@casl/ability';
2
2
  import type { AppAbility } from '../../types.js';
3
3
  export declare const defineRoleAbilitiesProductManager: (can: AbilityBuilder<AppAbility>["can"], cannot: AbilityBuilder<AppAbility>["cannot"]) => Promise<void>;
4
+ //# sourceMappingURL=product-manager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"product-manager.d.ts","sourceRoot":"","sources":["../../../../src/authorization/roles/admin/product-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAGhD,eAAO,MAAM,iCAAiC,GAC7C,KAAK,cAAc,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,EACtC,QAAQ,cAAc,CAAC,UAAU,CAAC,CAAC,QAAQ,CAAC,kBA0B5C,CAAA"}
@@ -1,5 +1,5 @@
1
1
  import { getDocumentsFields } from '../../utils.js';
2
- export const defineRoleAbilitiesProductManager = async (can, cannot) => {
2
+ export const defineRoleAbilitiesProductManager = async (can, cannot)=>{
3
3
  can('read', [
4
4
  'Subscription',
5
5
  'Cycle',
@@ -11,17 +11,20 @@ export const defineRoleAbilitiesProductManager = async (can, cannot) => {
11
11
  'ServiceCenter',
12
12
  'Coupon',
13
13
  'Discount',
14
- 'PlatformConfig',
14
+ 'PlatformConfig'
15
15
  ]);
16
16
  cannot('read', 'User', [
17
17
  ...getDocumentsFields('identification'),
18
18
  ...getDocumentsFields('drivingHistory'),
19
19
  ...getDocumentsFields('financial'),
20
- ...getDocumentsFields('offerLetter'),
20
+ ...getDocumentsFields('offerLetter')
21
21
  ]);
22
22
  cannot('create', 'Business');
23
23
  cannot('read', 'Business', 'paymentMethods');
24
24
  cannot('read', 'User', 'paymentMethods');
25
25
  cannot('read', 'Invoice');
26
- cannot('read', ['Vacancy', 'Applicant']);
26
+ cannot('read', [
27
+ 'Vacancy',
28
+ 'Applicant'
29
+ ]);
27
30
  };
@@ -1,3 +1,4 @@
1
1
  import type { AbilityBuilder } from '@casl/ability';
2
2
  import type { AppAbility } from '../../types.js';
3
3
  export declare const defineRoleAbilitiesSalesExecutive: (can: AbilityBuilder<AppAbility>["can"], cannot: AbilityBuilder<AppAbility>["cannot"]) => Promise<void>;
4
+ //# sourceMappingURL=sales-executive.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sales-executive.d.ts","sourceRoot":"","sources":["../../../../src/authorization/roles/admin/sales-executive.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAGhD,eAAO,MAAM,iCAAiC,GAC7C,KAAK,cAAc,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,EACtC,QAAQ,cAAc,CAAC,UAAU,CAAC,CAAC,QAAQ,CAAC,kBA6C5C,CAAA"}
@@ -1,5 +1,5 @@
1
1
  import { getDocumentsFields, getPricingFields } from '../../utils.js';
2
- export const defineRoleAbilitiesSalesExecutive = async (can, cannot) => {
2
+ export const defineRoleAbilitiesSalesExecutive = async (can, cannot)=>{
3
3
  can('read', [
4
4
  'Subscription',
5
5
  'Cycle',
@@ -9,16 +9,26 @@ export const defineRoleAbilitiesSalesExecutive = async (can, cannot) => {
9
9
  'Host',
10
10
  'Discount',
11
11
  'PlatformConfig',
12
- 'PaymentLink',
12
+ 'PaymentLink'
13
13
  ]);
14
- can(['read', 'update'], ['Invoice', 'Transaction', 'Refund']);
15
- can(['read', 'update'], 'User');
14
+ can([
15
+ 'read',
16
+ 'update'
17
+ ], [
18
+ 'Invoice',
19
+ 'Transaction',
20
+ 'Refund'
21
+ ]);
22
+ can([
23
+ 'read',
24
+ 'update'
25
+ ], 'User');
16
26
  cannot('update', 'User', 'status');
17
27
  cannot('update', 'User', [
18
28
  ...getDocumentsFields('identification'),
19
29
  ...getDocumentsFields('drivingHistory'),
20
30
  ...getDocumentsFields('financial'),
21
- ...getDocumentsFields('offerLetter'),
31
+ ...getDocumentsFields('offerLetter')
22
32
  ]);
23
33
  can('manage', 'Business');
24
34
  can('manage', 'Inquiry');
@@ -29,17 +39,23 @@ export const defineRoleAbilitiesSalesExecutive = async (can, cannot) => {
29
39
  'endedAt',
30
40
  'plan',
31
41
  'mileagePackage',
32
- 'payerType',
42
+ 'payerType'
33
43
  ]);
34
44
  can('read', 'SubscriptionReservation');
35
- cannot('update', 'Subscription', ['status', 'started']);
45
+ cannot('update', 'Subscription', [
46
+ 'status',
47
+ 'started'
48
+ ]);
36
49
  cannot('update', 'Vehicle', getPricingFields());
37
50
  can('testPricingInput', 'Vehicle');
38
51
  can('readPricingInput', 'Vehicle');
39
52
  cannot('cancelInvoice', 'Invoice');
40
53
  cannot('markInvoice', 'Invoice');
41
54
  cannot('delete', 'Quotation');
42
- cannot('read', ['Vacancy', 'Applicant']);
55
+ cannot('read', [
56
+ 'Vacancy',
57
+ 'Applicant'
58
+ ]);
43
59
  can('read', 'Activity');
44
60
  can('read', 'ActivityTask');
45
61
  };
@@ -2,3 +2,4 @@ import type { AbilityBuilder } from '@casl/ability';
2
2
  import type { User } from '@driveflux/db';
3
3
  import type { AppAbility } from '../../types.js';
4
4
  export declare const defineRoleAbilitiesBusinessAdmin: (can: AbilityBuilder<AppAbility>["can"], user: User) => Promise<void>;
5
+ //# sourceMappingURL=business-admin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"business-admin.d.ts","sourceRoot":"","sources":["../../../../src/authorization/roles/consumer/business-admin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AACzC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAEhD,eAAO,MAAM,gCAAgC,GAC5C,KAAK,cAAc,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,EACtC,MAAM,IAAI,kBAaV,CAAA"}
@@ -1,12 +1,25 @@
1
- export const defineRoleAbilitiesBusinessAdmin = async (can, user) => {
1
+ export const defineRoleAbilitiesBusinessAdmin = async (can, user)=>{
2
2
  if (!user.businessId) {
3
3
  return;
4
4
  }
5
- can(['read', 'update'], 'User', { businessId: user.businessId });
6
- can('read', 'Subscription', { businessId: user.businessId });
7
- can('update', 'Business', ['phoneNumber', 'mobileNumber', 'addresses'], {
8
- id: user.businessId,
5
+ can([
6
+ 'read',
7
+ 'update'
8
+ ], 'User', {
9
+ businessId: user.businessId
10
+ });
11
+ can('read', 'Subscription', {
12
+ businessId: user.businessId
13
+ });
14
+ can('update', 'Business', [
15
+ 'phoneNumber',
16
+ 'mobileNumber',
17
+ 'addresses'
18
+ ], {
19
+ id: user.businessId
20
+ });
21
+ can('read', 'Business', {
22
+ id: user.businessId
9
23
  });
10
- can('read', 'Business', { id: user.businessId });
11
24
  can('create', 'Mandate');
12
25
  };
@@ -2,3 +2,4 @@ import type { AbilityBuilder } from '@casl/ability';
2
2
  import type { User } from '@driveflux/db';
3
3
  import type { AppAbility } from '../../types.js';
4
4
  export declare const defineRoleAbilitiesBusinessUser: (can: AbilityBuilder<AppAbility>["can"], user: User) => Promise<void>;
5
+ //# sourceMappingURL=business-user.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"business-user.d.ts","sourceRoot":"","sources":["../../../../src/authorization/roles/consumer/business-user.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AACzC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAEhD,eAAO,MAAM,+BAA+B,GAC3C,KAAK,cAAc,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,EACtC,MAAM,IAAI,kBAaV,CAAA"}
@@ -1,12 +1,24 @@
1
- export const defineRoleAbilitiesBusinessUser = async (can, user) => {
1
+ export const defineRoleAbilitiesBusinessUser = async (can, user)=>{
2
2
  if (!user.businessId) {
3
3
  return;
4
4
  }
5
- can(['read'], 'User', { businessId: user.businessId });
6
- can('read', 'Subscription', { businessId: user.businessId });
7
- can('update', 'Business', ['phoneNumber', 'mobileNumber', 'addresses'], {
8
- id: user.businessId,
5
+ can([
6
+ 'read'
7
+ ], 'User', {
8
+ businessId: user.businessId
9
+ });
10
+ can('read', 'Subscription', {
11
+ businessId: user.businessId
12
+ });
13
+ can('update', 'Business', [
14
+ 'phoneNumber',
15
+ 'mobileNumber',
16
+ 'addresses'
17
+ ], {
18
+ id: user.businessId
19
+ });
20
+ can('read', 'Business', {
21
+ id: user.businessId
9
22
  });
10
- can('read', 'Business', { id: user.businessId });
11
23
  can('create', 'Mandate');
12
24
  };
@@ -2,3 +2,4 @@ import type { AbilityBuilder } from '@casl/ability';
2
2
  import type { User } from '@driveflux/db';
3
3
  import type { AppAbility } from '../../types.js';
4
4
  export declare const defineRoleAbilitiesMember: (can: AbilityBuilder<AppAbility>["can"], user: User) => Promise<void>;
5
+ //# sourceMappingURL=member.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"member.d.ts","sourceRoot":"","sources":["../../../../src/authorization/roles/consumer/member.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AACzC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAEhD,eAAO,MAAM,yBAAyB,GACrC,KAAK,cAAc,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,EACtC,MAAM,IAAI,kBA0BV,CAAA"}
@@ -1,4 +1,4 @@
1
- export const defineRoleAbilitiesMember = async (can, user) => {
1
+ export const defineRoleAbilitiesMember = async (can, user)=>{
2
2
  can('read', 'Cycle', [
3
3
  'id',
4
4
  'startDate',
@@ -6,13 +6,23 @@ export const defineRoleAbilitiesMember = async (can, user) => {
6
6
  'utilization.pricePerKm',
7
7
  'utilization.paid',
8
8
  'utilization.allowedMileage',
9
- 'utilization.mileage',
10
- ], { subscription: { userId: user.id } });
11
- can('read', 'Vehicle', { status: 'listed' });
9
+ 'utilization.mileage'
10
+ ], {
11
+ subscription: {
12
+ userId: user.id
13
+ }
14
+ });
15
+ can('read', 'Vehicle', {
16
+ status: 'listed'
17
+ });
12
18
  can('create', 'Business');
13
19
  if (user.businessId) {
14
- can('update', 'Business', { id: user.businessId });
20
+ can('update', 'Business', {
21
+ id: user.businessId
22
+ });
15
23
  }
16
- can('read', 'Subscription', { userId: user.id });
24
+ can('read', 'Subscription', {
25
+ userId: user.id
26
+ });
17
27
  can('read', 'Coupon');
18
28
  };
@@ -28,3 +28,4 @@ export type Department = keyof typeof DEPARTMENTS_MAP;
28
28
  export type AdminRole = (typeof DEPARTMENTS_MAP)[keyof typeof DEPARTMENTS_MAP][number];
29
29
  export type UserGroup = (typeof GENERAL_ROLES)[number];
30
30
  export {};
31
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/authorization/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AACpE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAC5C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAC5D,OAAO,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AACzD,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpE,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAE3E,MAAM,MAAM,MAAM,GACf,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,MAAM,GACN,QAAQ,GACR,SAAS,GACT,SAAS,GACT,gBAAgB,GAChB,wBAAwB,GACxB,uBAAuB,GACvB,QAAQ,GACR,SAAS,GACT,qBAAqB,GACrB,aAAa,GACb,aAAa,GACb,wBAAwB,GACxB,yBAAyB,GACzB,eAAe,GACf,aAAa,GACb,kBAAkB,GAClB,kBAAkB,GAClB,aAAa,GACb,QAAQ,GACR,0BAA0B,GAC1B,4BAA4B,GAC5B,wBAAwB,GACxB,mBAAmB,CAAA;AAEtB,MAAM,MAAM,cAAc,GAAG;KAC3B,CAAC,IAAI,cAAc,GAAG,SAAS,CAAC,CAAC,CAAC;CACnC,CAAA;AAED,KAAK,eAAe,GAAG;KACrB,CAAC,IAAI,MAAM,CAAC,SAAS,GAAG,YAAY,CAAC,CAAC,CAAC,SAAS,MAAM,YAAY,GAChE,OAAO,CACP,UAAU,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,EACzD;QAAE,KAAK,CAAC,EAAE,GAAG,CAAA;KAAE,CACf,CAAC,OAAO,CAAC,GACT,KAAK;CACR,CAAA;AACD,UAAU,sBAAuB,SAAQ,GAAG,CAAC,cAAc;IAC1D,OAAO,EAAE,UAAU,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC,CAAA;CAC9D;AACD,KAAK,UAAU,CAAC,UAAU,SAAS,cAAc,IAAI,OAAO,CAC3D,eAAe,CAAC,UAAU,CAAC,EAC3B,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,CAChB,CAAA;AACD,KAAK,KAAK,CAAC,CAAC,EAAE,KAAK,SAAS,MAAM,IAAI,CAAC,GAAG,aAAa,CAAC,KAAK,CAAC,CAAA;AAC9D,KAAK,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,CAAC,CAAA;AACrD,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW,IAAI,UAAU,CACxE,gBAAgB,CAAC,CAAC,EAAE,cAAc,CAAC,CACnC,GACA,GAAG,CAAC,SAAS,CAAC,sBAAsB,CAAC,CAAA;AAEtC,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC,cAAc,CAAC,GAAG,KAAK,GAAG,SAAS,CAAA;AACtE,MAAM,MAAM,eAAe,GAAG,cAAc,GAAG,KAAK,GAAG,SAAS,CAAA;AAEhE,MAAM,MAAM,UAAU,GAAG,WAAW,CAAC,CAAC,MAAM,EAAE,WAAW,CAAC,EAAE,WAAW,CAAC,CAAA;AAExE,MAAM,MAAM,IAAI,GAAG,CAAC,OAAO,KAAK,CAAC,CAAC,MAAM,OAAO,KAAK,CAAC,CAAA;AAErD,MAAM,MAAM,UAAU,GAAG,MAAM,OAAO,eAAe,CAAA;AAErD,MAAM,MAAM,SAAS,GACpB,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAA;AAE/D,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAA"}
@@ -1 +1 @@
1
- export {};
1
+ export { };
@@ -6,3 +6,4 @@ export declare const updateUserPermissions: (userId: string | RawModels<"User">
6
6
  user: User;
7
7
  ability: AppAbility;
8
8
  }>;
9
+ //# sourceMappingURL=update-user-permissions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-user-permissions.d.ts","sourceRoot":"","sources":["../../src/authorization/update-user-permissions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,IAAI,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAE5D,OAAO,EAAW,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAEhE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAE5C,eAAO,MAAM,qBAAqB,GACjC,QAAQ,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,EACnD,YAAY,MAAM,EAAE,GAAG,GAAG,CAAC,MAAM,CAAC,KAChC,cAAc,CAAC;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,OAAO,EAAE,UAAU,CAAA;CAAE,CAwCpD,CAAA"}
@@ -2,32 +2,39 @@ import { prisma } from '@driveflux/db';
2
2
  import { makeProblem, PROBLEM_NOT_FOUND } from '@driveflux/problem';
3
3
  import { Err, Ok } from '@driveflux/result';
4
4
  import { defineAbilityFor } from './define.js';
5
- export const updateUserPermissions = async (userId, newGroups) => {
6
- const user = typeof userId === 'string'
7
- ? await prisma.user.findUnique({
8
- where: {
9
- id: userId,
10
- },
11
- })
12
- : userId;
5
+ export const updateUserPermissions = async (userId, newGroups)=>{
6
+ const user = typeof userId === 'string' ? await prisma.user.findUnique({
7
+ where: {
8
+ id: userId
9
+ }
10
+ }) : userId;
13
11
  if (!user) {
14
12
  return new Err(makeProblem(PROBLEM_NOT_FOUND, 'User not found when trying to update the permissions'));
15
13
  }
16
- const groups = newGroups ? [...newGroups] : [...user.groups];
14
+ const groups = newGroups ? [
15
+ ...newGroups
16
+ ] : [
17
+ ...user.groups
18
+ ];
17
19
  const ability = await defineAbilityFor({
18
20
  ...user,
19
- groups,
21
+ groups
20
22
  });
21
23
  await prisma.user.update({
22
24
  where: {
23
- id: user.id,
25
+ id: user.id
24
26
  },
25
27
  data: {
26
- groups: [...groups],
27
- permissions: ability.rules,
28
- },
28
+ groups: [
29
+ ...groups
30
+ ],
31
+ permissions: ability.rules
32
+ }
29
33
  });
30
34
  user.groups = groups;
31
35
  user.permissions = ability.rules;
32
- return new Ok({ user, ability });
36
+ return new Ok({
37
+ user,
38
+ ability
39
+ });
33
40
  };
@@ -11,3 +11,4 @@ export declare const getDocumentsFields: (documentsGroup: keyof typeof documents
11
11
  export declare const getPricingFields: () => string[];
12
12
  export declare const s: (modelName: AppSubjectNames, key?: string) => any;
13
13
  export {};
14
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/authorization/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAW,MAAM,eAAe,CAAA;AAE9D,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAE7D,eAAO,MAAM,iBAAiB,EAAE,gBAAgB,CAAC,UAAU,CAAC,CAAC,mBAAmB,CAQ9E,CAAA;AAEF,QAAA,MAAM,SAAS;;;;;CAWL,CAAA;AAEV,eAAO,MAAM,kBAAkB,GAAI,gBAAgB,MAAM,OAAO,SAAS,aAClB,CAAA;AAEvD,eAAO,MAAM,gBAAgB,gBAU5B,CAAA;AAGD,eAAO,MAAM,CAAC,GAAI,WAAW,eAAe,EAAE,YAAU,KAEkB,GACzE,CAAA"}