@driveflux/auth 4.0.55 → 4.0.57
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/dist/AuthProvider.js +59 -76
- package/dist/authorization/constants.js +24 -45
- package/dist/authorization/define.js +28 -57
- package/dist/authorization/fields/index.js +7 -4
- package/dist/authorization/helpers.js +8 -10
- package/dist/authorization/index.js +6 -6
- package/dist/authorization/permissions-list.js +7 -5
- package/dist/authorization/quick.js +1 -1
- package/dist/authorization/roles/admin/business-development-executive.js +7 -20
- package/dist/authorization/roles/admin/ceo.js +2 -4
- package/dist/authorization/roles/admin/common.js +2 -4
- package/dist/authorization/roles/admin/concierge.js +10 -35
- package/dist/authorization/roles/admin/customer-success-executive.js +10 -40
- package/dist/authorization/roles/admin/data-analyst.js +4 -7
- package/dist/authorization/roles/admin/designer.js +4 -7
- package/dist/authorization/roles/admin/engineer.js +4 -7
- package/dist/authorization/roles/admin/finance-executive.js +4 -11
- package/dist/authorization/roles/admin/head-of-business-development.js +5 -14
- package/dist/authorization/roles/admin/head-of-data-analytics.js +4 -14
- package/dist/authorization/roles/admin/head-of-engineering.js +7 -17
- package/dist/authorization/roles/admin/head-of-finance.js +4 -8
- package/dist/authorization/roles/admin/head-of-human-resources.js +6 -13
- package/dist/authorization/roles/admin/head-of-marketing.js +6 -17
- package/dist/authorization/roles/admin/head-of-operations.js +4 -8
- package/dist/authorization/roles/admin/head-of-product.js +7 -17
- package/dist/authorization/roles/admin/head-of-sales.js +6 -17
- package/dist/authorization/roles/admin/human-resources-executive.js +5 -12
- package/dist/authorization/roles/admin/marketing-executive.js +4 -7
- package/dist/authorization/roles/admin/product-manager.js +4 -7
- package/dist/authorization/roles/admin/sales-executive.js +8 -24
- package/dist/authorization/roles/consumer/business-admin.js +6 -19
- package/dist/authorization/roles/consumer/business-user.js +6 -18
- package/dist/authorization/roles/consumer/member.js +6 -16
- package/dist/authorization/types.js +1 -1
- package/dist/authorization/update-user-permissions.js +15 -22
- package/dist/authorization/utils.js +11 -26
- package/dist/context.js +9 -8
- package/dist/default.js +1 -1
- package/dist/server/authenticate-user.js +7 -11
- package/dist/server/cors.js +12 -23
- package/dist/server/credentials-provider.js +2 -2
- package/dist/server/next-auth.js +109 -104
- package/dist/server/prisma-adapter.js +52 -88
- package/dist/server/verfiy-token.js +24 -39
- package/dist/translations.js +4 -4
- package/dist/use-auth.js +1 -1
- package/dist/use-session.js +1 -1
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getDocumentsFields } from '../../utils.js';
|
|
2
|
-
export const defineRoleAbilitiesConcierge = async (can, cannot)=>{
|
|
2
|
+
export const defineRoleAbilitiesConcierge = async (can, cannot) => {
|
|
3
3
|
can('read', [
|
|
4
4
|
'Subscription',
|
|
5
5
|
'Cycle',
|
|
@@ -12,14 +12,11 @@ export const defineRoleAbilitiesConcierge = async (can, cannot)=>{
|
|
|
12
12
|
'Inquiry',
|
|
13
13
|
'Discount',
|
|
14
14
|
'PlatformConfig',
|
|
15
|
-
'PaymentLink'
|
|
15
|
+
'PaymentLink',
|
|
16
16
|
]);
|
|
17
17
|
cannot('create', 'Business');
|
|
18
18
|
can('manage', 'ServiceCenter');
|
|
19
|
-
can('update', 'Vehicle', [
|
|
20
|
-
'images',
|
|
21
|
-
'allowedServiceCenterIds'
|
|
22
|
-
]);
|
|
19
|
+
can('update', 'Vehicle', ['images', 'allowedServiceCenterIds']);
|
|
23
20
|
can('readPricingInput', 'Vehicle');
|
|
24
21
|
can('update', 'Host', 'serviceCenterIds');
|
|
25
22
|
can('manage', 'Subscription');
|
|
@@ -33,38 +30,16 @@ export const defineRoleAbilitiesConcierge = async (can, cannot)=>{
|
|
|
33
30
|
'payerType',
|
|
34
31
|
'driversIds',
|
|
35
32
|
'drivers',
|
|
36
|
-
'vehicleId'
|
|
37
|
-
]);
|
|
38
|
-
can([
|
|
39
|
-
'read'
|
|
40
|
-
], [
|
|
41
|
-
'Invoice',
|
|
42
|
-
'Transaction',
|
|
43
|
-
'Refund'
|
|
33
|
+
'vehicleId',
|
|
44
34
|
]);
|
|
35
|
+
can(['read'], ['Invoice', 'Transaction', 'Refund']);
|
|
45
36
|
cannot('read', 'User', [
|
|
46
37
|
...getDocumentsFields('drivingHistory'),
|
|
47
38
|
...getDocumentsFields('financial'),
|
|
48
|
-
...getDocumentsFields('offerLetter')
|
|
49
|
-
]);
|
|
50
|
-
can([
|
|
51
|
-
'manage'
|
|
52
|
-
], [
|
|
53
|
-
'Activity',
|
|
54
|
-
'ActivityTask'
|
|
55
|
-
]);
|
|
56
|
-
cannot([
|
|
57
|
-
'create',
|
|
58
|
-
'delete'
|
|
59
|
-
], [
|
|
60
|
-
'Activity',
|
|
61
|
-
'ActivityTask'
|
|
62
|
-
]);
|
|
63
|
-
can([
|
|
64
|
-
'viewSubscriptionApproval'
|
|
65
|
-
], 'Subscription');
|
|
66
|
-
cannot('read', [
|
|
67
|
-
'Vacancy',
|
|
68
|
-
'Applicant'
|
|
39
|
+
...getDocumentsFields('offerLetter'),
|
|
69
40
|
]);
|
|
41
|
+
can(['manage'], ['Activity', 'ActivityTask']);
|
|
42
|
+
cannot(['create', 'delete'], ['Activity', 'ActivityTask']);
|
|
43
|
+
can(['viewSubscriptionApproval'], 'Subscription');
|
|
44
|
+
cannot('read', ['Vacancy', 'Applicant']);
|
|
70
45
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const defineRoleAbilitiesCustomerSuccessExecutive = async (can, cannot)=>{
|
|
1
|
+
export const defineRoleAbilitiesCustomerSuccessExecutive = async (can, cannot) => {
|
|
2
2
|
can('manage', [
|
|
3
3
|
'Subscription',
|
|
4
4
|
'Cycle',
|
|
@@ -14,47 +14,17 @@ export const defineRoleAbilitiesCustomerSuccessExecutive = async (can, cannot)=>
|
|
|
14
14
|
'Token',
|
|
15
15
|
'PaymentLink',
|
|
16
16
|
'Activity',
|
|
17
|
-
'ActivityTask'
|
|
17
|
+
'ActivityTask',
|
|
18
18
|
]);
|
|
19
19
|
can('read', 'PlatformConfig');
|
|
20
|
-
can([
|
|
21
|
-
'create',
|
|
22
|
-
'read',
|
|
23
|
-
'update'
|
|
24
|
-
], [
|
|
25
|
-
'Invoice',
|
|
26
|
-
'Transaction',
|
|
27
|
-
'Refund'
|
|
28
|
-
]);
|
|
20
|
+
can(['create', 'read', 'update'], ['Invoice', 'Transaction', 'Refund']);
|
|
29
21
|
can('connectHostToStripe', 'Host');
|
|
30
|
-
cannot('update', 'Vehicle', [
|
|
31
|
-
'pricing',
|
|
32
|
-
'basePrice'
|
|
33
|
-
]);
|
|
22
|
+
cannot('update', 'Vehicle', ['pricing', 'basePrice']);
|
|
34
23
|
can('readPricingInput', 'Vehicle');
|
|
35
|
-
can('markInvoice', 'Invoice', [
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
]);
|
|
39
|
-
cannot([
|
|
40
|
-
|
|
41
|
-
'reverse',
|
|
42
|
-
'deletePayoutChargeLine'
|
|
43
|
-
], 'Payout');
|
|
44
|
-
cannot([
|
|
45
|
-
'create',
|
|
46
|
-
'update',
|
|
47
|
-
'delete'
|
|
48
|
-
], 'Coupon');
|
|
49
|
-
can([
|
|
50
|
-
'viewSubscriptionApproval'
|
|
51
|
-
], 'Subscription');
|
|
52
|
-
cannot([
|
|
53
|
-
'update',
|
|
54
|
-
'delete'
|
|
55
|
-
], 'Inquiry');
|
|
56
|
-
cannot('read', [
|
|
57
|
-
'Vacancy',
|
|
58
|
-
'Applicant'
|
|
59
|
-
]);
|
|
24
|
+
can('markInvoice', 'Invoice', ['totalRefunded', 'paid']);
|
|
25
|
+
cannot(['release', 'reverse', 'deletePayoutChargeLine'], 'Payout');
|
|
26
|
+
cannot(['create', 'update', 'delete'], 'Coupon');
|
|
27
|
+
can(['viewSubscriptionApproval'], 'Subscription');
|
|
28
|
+
cannot(['update', 'delete'], 'Inquiry');
|
|
29
|
+
cannot('read', ['Vacancy', 'Applicant']);
|
|
60
30
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getDocumentsFields } from '../../utils.js';
|
|
2
|
-
export const defineRoleAbilitiesDataAnalyst = async (can, cannot)=>{
|
|
2
|
+
export const defineRoleAbilitiesDataAnalyst = async (can, cannot) => {
|
|
3
3
|
can('read', [
|
|
4
4
|
'Subscription',
|
|
5
5
|
'Cycle',
|
|
@@ -11,20 +11,17 @@ export const defineRoleAbilitiesDataAnalyst = 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', [
|
|
27
|
-
'Vacancy',
|
|
28
|
-
'Applicant'
|
|
29
|
-
]);
|
|
26
|
+
cannot('read', ['Vacancy', 'Applicant']);
|
|
30
27
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getDocumentsFields } from '../../utils.js';
|
|
2
|
-
export const defineRoleAbilitiesDesigner = async (can, cannot)=>{
|
|
2
|
+
export const defineRoleAbilitiesDesigner = async (can, cannot) => {
|
|
3
3
|
can('read', [
|
|
4
4
|
'Subscription',
|
|
5
5
|
'Cycle',
|
|
@@ -11,20 +11,17 @@ export const defineRoleAbilitiesDesigner = 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', [
|
|
27
|
-
'Vacancy',
|
|
28
|
-
'Applicant'
|
|
29
|
-
]);
|
|
26
|
+
cannot('read', ['Vacancy', 'Applicant']);
|
|
30
27
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getDocumentsFields } from '../../utils.js';
|
|
2
|
-
export const defineRoleAbilitiesEngineer = async (can, cannot)=>{
|
|
2
|
+
export const defineRoleAbilitiesEngineer = async (can, cannot) => {
|
|
3
3
|
can('read', [
|
|
4
4
|
'Subscription',
|
|
5
5
|
'Cycle',
|
|
@@ -12,20 +12,17 @@ export const defineRoleAbilitiesEngineer = async (can, cannot)=>{
|
|
|
12
12
|
'Coupon',
|
|
13
13
|
'Discount',
|
|
14
14
|
'PlatformConfig',
|
|
15
|
-
'Log'
|
|
15
|
+
'Log',
|
|
16
16
|
]);
|
|
17
17
|
cannot('read', 'User', [
|
|
18
18
|
...getDocumentsFields('identification'),
|
|
19
19
|
...getDocumentsFields('drivingHistory'),
|
|
20
20
|
...getDocumentsFields('financial'),
|
|
21
|
-
...getDocumentsFields('offerLetter')
|
|
21
|
+
...getDocumentsFields('offerLetter'),
|
|
22
22
|
]);
|
|
23
23
|
cannot('create', 'Business');
|
|
24
24
|
cannot('read', 'Business', 'paymentMethods');
|
|
25
25
|
cannot('read', 'User', 'paymentMethods');
|
|
26
26
|
cannot('read', 'Invoice');
|
|
27
|
-
cannot('read', [
|
|
28
|
-
'Vacancy',
|
|
29
|
-
'Applicant'
|
|
30
|
-
]);
|
|
27
|
+
cannot('read', ['Vacancy', 'Applicant']);
|
|
31
28
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const defineRoleAbilitiesFinanceExecutive = async (can, cannot)=>{
|
|
1
|
+
export const defineRoleAbilitiesFinanceExecutive = async (can, cannot) => {
|
|
2
2
|
can('read', [
|
|
3
3
|
'User',
|
|
4
4
|
'Subscription',
|
|
@@ -14,19 +14,12 @@ export const defineRoleAbilitiesFinanceExecutive = async (can, cannot)=>{
|
|
|
14
14
|
'Invoice',
|
|
15
15
|
'Transaction',
|
|
16
16
|
'Refund',
|
|
17
|
-
'PaymentLink'
|
|
18
|
-
]);
|
|
19
|
-
can('manage', [
|
|
20
|
-
'OffPlatformTransaction',
|
|
21
|
-
'Payout',
|
|
22
|
-
'Reports'
|
|
17
|
+
'PaymentLink',
|
|
23
18
|
]);
|
|
19
|
+
can('manage', ['OffPlatformTransaction', 'Payout', 'Reports']);
|
|
24
20
|
can('create', 'Host');
|
|
25
21
|
cannot('cancelInvoice', 'Invoice');
|
|
26
22
|
cannot('markInvoice', 'Invoice');
|
|
27
23
|
can('readPricingInput', 'Vehicle');
|
|
28
|
-
cannot('read', [
|
|
29
|
-
'Vacancy',
|
|
30
|
-
'Applicant'
|
|
31
|
-
]);
|
|
24
|
+
cannot('read', ['Vacancy', 'Applicant']);
|
|
32
25
|
};
|
|
@@ -1,19 +1,10 @@
|
|
|
1
|
-
export const defineRoleAbilitiesHeadOfBusinessDevelopment = async (can, cannot)=>{
|
|
1
|
+
export const defineRoleAbilitiesHeadOfBusinessDevelopment = async (can, cannot) => {
|
|
2
2
|
can('manage', 'all');
|
|
3
|
-
cannot([
|
|
4
|
-
|
|
5
|
-
'update'
|
|
6
|
-
], 'Payout');
|
|
7
|
-
cannot([
|
|
8
|
-
'release',
|
|
9
|
-
'reverse',
|
|
10
|
-
'deletePayoutChargeLine'
|
|
11
|
-
], 'Payout');
|
|
3
|
+
cannot(['create', 'update'], 'Payout');
|
|
4
|
+
cannot(['release', 'reverse', 'deletePayoutChargeLine'], 'Payout');
|
|
12
5
|
cannot('cancelInvoice', 'Invoice');
|
|
13
6
|
cannot('markInvoice', 'Invoice');
|
|
14
|
-
cannot('manage', [
|
|
15
|
-
'Vacancy',
|
|
16
|
-
'Applicant'
|
|
17
|
-
]);
|
|
7
|
+
cannot('manage', ['Vacancy', 'Applicant']);
|
|
18
8
|
can('updateSubscriptionUser', 'Subscription');
|
|
9
|
+
can('manageAdmin', 'Reports');
|
|
19
10
|
};
|
|
@@ -1,19 +1,9 @@
|
|
|
1
|
-
export const defineRoleAbilitiesHeadOfDataAnalytics = async (can, cannot)=>{
|
|
1
|
+
export const defineRoleAbilitiesHeadOfDataAnalytics = async (can, cannot) => {
|
|
2
2
|
can('manage', 'all');
|
|
3
|
-
cannot([
|
|
4
|
-
|
|
5
|
-
'update'
|
|
6
|
-
], 'Payout');
|
|
7
|
-
cannot([
|
|
8
|
-
'release',
|
|
9
|
-
'reverse',
|
|
10
|
-
'deletePayoutChargeLine'
|
|
11
|
-
], 'Payout');
|
|
3
|
+
cannot(['create', 'update'], 'Payout');
|
|
4
|
+
cannot(['release', 'reverse', 'deletePayoutChargeLine'], 'Payout');
|
|
12
5
|
cannot('cancelInvoice', 'Invoice');
|
|
13
6
|
cannot('markInvoice', 'Invoice');
|
|
14
7
|
cannot('update', 'Host', 'accountManagerId');
|
|
15
|
-
cannot('manage', [
|
|
16
|
-
'Vacancy',
|
|
17
|
-
'Applicant'
|
|
18
|
-
]);
|
|
8
|
+
cannot('manage', ['Vacancy', 'Applicant']);
|
|
19
9
|
};
|
|
@@ -1,22 +1,12 @@
|
|
|
1
1
|
import { OWNER_ROLES } from '../../constants.js';
|
|
2
|
-
export const defineRoleAbilitiesHeadOfEngineering = async (can, cannot)=>{
|
|
2
|
+
export const defineRoleAbilitiesHeadOfEngineering = async (can, cannot) => {
|
|
3
3
|
can('manage', 'all');
|
|
4
|
-
cannot([
|
|
5
|
-
'create',
|
|
6
|
-
'update',
|
|
7
|
-
'delete'
|
|
8
|
-
], 'User', undefined, {
|
|
4
|
+
cannot(['create', 'update', 'delete'], 'User', undefined, {
|
|
9
5
|
groups: {
|
|
10
|
-
hasSome: [
|
|
11
|
-
|
|
12
|
-
]
|
|
13
|
-
}
|
|
6
|
+
hasSome: [...OWNER_ROLES],
|
|
7
|
+
},
|
|
14
8
|
});
|
|
15
|
-
cannot('update', 'Host', [
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
cannot('manage', [
|
|
19
|
-
'Vacancy',
|
|
20
|
-
'Applicant'
|
|
21
|
-
]);
|
|
9
|
+
cannot('update', 'Host', ['accountManagerId']);
|
|
10
|
+
cannot('manage', ['Vacancy', 'Applicant']);
|
|
11
|
+
can('manageAdmin', 'Reports');
|
|
22
12
|
};
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
export const defineRoleAbilitiesHeadOfFinance = async (can, cannot)=>{
|
|
1
|
+
export const defineRoleAbilitiesHeadOfFinance = async (can, cannot) => {
|
|
2
2
|
can('manage', 'all');
|
|
3
|
-
cannot('update', 'Host', [
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
cannot('manage', [
|
|
7
|
-
'Vacancy',
|
|
8
|
-
'Applicant'
|
|
9
|
-
]);
|
|
3
|
+
cannot('update', 'Host', ['accountManagerId']);
|
|
4
|
+
cannot('manage', ['Vacancy', 'Applicant']);
|
|
5
|
+
can('manageAdmin', 'Reports');
|
|
10
6
|
};
|
|
@@ -1,18 +1,11 @@
|
|
|
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([
|
|
5
|
-
'create',
|
|
6
|
-
'update',
|
|
7
|
-
'delete'
|
|
8
|
-
], 'User', undefined, {
|
|
4
|
+
cannot(['create', 'update', 'delete'], 'User', undefined, {
|
|
9
5
|
groups: {
|
|
10
|
-
hasSome: [
|
|
11
|
-
|
|
12
|
-
]
|
|
13
|
-
}
|
|
6
|
+
hasSome: [...OWNER_ROLES],
|
|
7
|
+
},
|
|
14
8
|
});
|
|
15
|
-
cannot('update', 'Host', [
|
|
16
|
-
|
|
17
|
-
]);
|
|
9
|
+
cannot('update', 'Host', ['accountManagerId']);
|
|
10
|
+
can('manageAdmin', 'Reports');
|
|
18
11
|
};
|
|
@@ -1,21 +1,10 @@
|
|
|
1
|
-
export const defineRoleAbilitiesHeadOfMarketing = async (can, cannot)=>{
|
|
1
|
+
export const defineRoleAbilitiesHeadOfMarketing = async (can, cannot) => {
|
|
2
2
|
can('manage', 'all');
|
|
3
|
-
cannot([
|
|
4
|
-
|
|
5
|
-
'update'
|
|
6
|
-
], 'Payout');
|
|
7
|
-
cannot([
|
|
8
|
-
'release',
|
|
9
|
-
'reverse',
|
|
10
|
-
'deletePayoutChargeLine'
|
|
11
|
-
], 'Payout');
|
|
3
|
+
cannot(['create', 'update'], 'Payout');
|
|
4
|
+
cannot(['release', 'reverse', 'deletePayoutChargeLine'], 'Payout');
|
|
12
5
|
cannot('cancelInvoice', 'Invoice');
|
|
13
6
|
cannot('markInvoice', 'Invoice');
|
|
14
|
-
cannot('update', 'Host', [
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
cannot('manage', [
|
|
18
|
-
'Vacancy',
|
|
19
|
-
'Applicant'
|
|
20
|
-
]);
|
|
7
|
+
cannot('update', 'Host', ['accountManagerId']);
|
|
8
|
+
cannot('manage', ['Vacancy', 'Applicant']);
|
|
9
|
+
can('manageAdmin', 'Reports');
|
|
21
10
|
};
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
export const defineRoleAbilitiesHeadOfOperations = async (can, cannot)=>{
|
|
1
|
+
export const defineRoleAbilitiesHeadOfOperations = async (can, cannot) => {
|
|
2
2
|
can('manage', 'all');
|
|
3
|
-
cannot('update', 'Host', [
|
|
4
|
-
|
|
5
|
-
]);
|
|
6
|
-
cannot('manage', [
|
|
7
|
-
'Vacancy',
|
|
8
|
-
'Applicant'
|
|
9
|
-
]);
|
|
3
|
+
cannot('update', 'Host', ['accountManagerId']);
|
|
4
|
+
cannot('manage', ['Vacancy', 'Applicant']);
|
|
10
5
|
can('updateSubscriptionUser', 'Subscription');
|
|
6
|
+
can('manageAdmin', 'Reports');
|
|
11
7
|
};
|
|
@@ -1,22 +1,12 @@
|
|
|
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([
|
|
5
|
-
'create',
|
|
6
|
-
'update',
|
|
7
|
-
'delete'
|
|
8
|
-
], 'User', undefined, {
|
|
4
|
+
cannot(['create', 'update', 'delete'], 'User', undefined, {
|
|
9
5
|
groups: {
|
|
10
|
-
hasSome: [
|
|
11
|
-
|
|
12
|
-
]
|
|
13
|
-
}
|
|
6
|
+
hasSome: [...OWNER_ROLES],
|
|
7
|
+
},
|
|
14
8
|
});
|
|
15
|
-
cannot('update', 'Host', [
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
cannot('manage', [
|
|
19
|
-
'Vacancy',
|
|
20
|
-
'Applicant'
|
|
21
|
-
]);
|
|
9
|
+
cannot('update', 'Host', ['accountManagerId']);
|
|
10
|
+
cannot('manage', ['Vacancy', 'Applicant']);
|
|
11
|
+
can('manageAdmin', 'Reports');
|
|
22
12
|
};
|
|
@@ -1,21 +1,10 @@
|
|
|
1
|
-
export const defineRoleAbilitiesHeadOfSales = async (can, cannot)=>{
|
|
1
|
+
export const defineRoleAbilitiesHeadOfSales = async (can, cannot) => {
|
|
2
2
|
can('manage', 'all');
|
|
3
|
-
cannot([
|
|
4
|
-
|
|
5
|
-
'update'
|
|
6
|
-
], 'Payout');
|
|
7
|
-
cannot([
|
|
8
|
-
'release',
|
|
9
|
-
'reverse',
|
|
10
|
-
'deletePayoutChargeLine'
|
|
11
|
-
], 'Payout');
|
|
3
|
+
cannot(['create', 'update'], 'Payout');
|
|
4
|
+
cannot(['release', 'reverse', 'deletePayoutChargeLine'], 'Payout');
|
|
12
5
|
cannot('cancelInvoice', 'Invoice');
|
|
13
6
|
cannot('markInvoice', 'Invoice');
|
|
14
|
-
cannot('update', 'Host', [
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
cannot('manage', [
|
|
18
|
-
'Vacancy',
|
|
19
|
-
'Applicant'
|
|
20
|
-
]);
|
|
7
|
+
cannot('update', 'Host', ['accountManagerId']);
|
|
8
|
+
cannot('manage', ['Vacancy', 'Applicant']);
|
|
9
|
+
can('manageAdmin', 'Reports');
|
|
21
10
|
};
|
|
@@ -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,22 +17,15 @@ export const defineRoleAbilitiesHumanResourceExecutive = async (can, cannot)=>{
|
|
|
17
17
|
'Discount',
|
|
18
18
|
'PlatformConfig',
|
|
19
19
|
'Vacancy',
|
|
20
|
-
'Applicant'
|
|
21
|
-
]);
|
|
22
|
-
cannot('read', [
|
|
23
|
-
'User'
|
|
24
|
-
], [
|
|
25
|
-
'documents'
|
|
20
|
+
'Applicant',
|
|
26
21
|
]);
|
|
22
|
+
cannot('read', ['User'], ['documents']);
|
|
27
23
|
cannot('create', 'Business');
|
|
28
24
|
cannot('read', 'User', [
|
|
29
25
|
...getDocumentsFields('identification'),
|
|
30
26
|
...getDocumentsFields('drivingHistory'),
|
|
31
27
|
...getDocumentsFields('financial'),
|
|
32
|
-
...getDocumentsFields('offerLetter')
|
|
33
|
-
]);
|
|
34
|
-
can('manage', [
|
|
35
|
-
'Vacancy',
|
|
36
|
-
'Applicant'
|
|
28
|
+
...getDocumentsFields('offerLetter'),
|
|
37
29
|
]);
|
|
30
|
+
can('manage', ['Vacancy', 'Applicant']);
|
|
38
31
|
};
|
|
@@ -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,10 +25,7 @@ export const defineRoleAbilitiesMarketingExecutive = async (can, cannot)=>{
|
|
|
25
25
|
...getDocumentsFields('identification'),
|
|
26
26
|
...getDocumentsFields('drivingHistory'),
|
|
27
27
|
...getDocumentsFields('financial'),
|
|
28
|
-
...getDocumentsFields('offerLetter')
|
|
29
|
-
]);
|
|
30
|
-
cannot('read', [
|
|
31
|
-
'Vacancy',
|
|
32
|
-
'Applicant'
|
|
28
|
+
...getDocumentsFields('offerLetter'),
|
|
33
29
|
]);
|
|
30
|
+
cannot('read', ['Vacancy', 'Applicant']);
|
|
34
31
|
};
|
|
@@ -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,20 +11,17 @@ 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', [
|
|
27
|
-
'Vacancy',
|
|
28
|
-
'Applicant'
|
|
29
|
-
]);
|
|
26
|
+
cannot('read', ['Vacancy', 'Applicant']);
|
|
30
27
|
};
|
|
@@ -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,26 +9,16 @@ export const defineRoleAbilitiesSalesExecutive = async (can, cannot)=>{
|
|
|
9
9
|
'Host',
|
|
10
10
|
'Discount',
|
|
11
11
|
'PlatformConfig',
|
|
12
|
-
'PaymentLink'
|
|
12
|
+
'PaymentLink',
|
|
13
13
|
]);
|
|
14
|
-
can([
|
|
15
|
-
|
|
16
|
-
'update'
|
|
17
|
-
], [
|
|
18
|
-
'Invoice',
|
|
19
|
-
'Transaction',
|
|
20
|
-
'Refund'
|
|
21
|
-
]);
|
|
22
|
-
can([
|
|
23
|
-
'read',
|
|
24
|
-
'update'
|
|
25
|
-
], 'User');
|
|
14
|
+
can(['read', 'update'], ['Invoice', 'Transaction', 'Refund']);
|
|
15
|
+
can(['read', 'update'], 'User');
|
|
26
16
|
cannot('update', 'User', 'status');
|
|
27
17
|
cannot('update', 'User', [
|
|
28
18
|
...getDocumentsFields('identification'),
|
|
29
19
|
...getDocumentsFields('drivingHistory'),
|
|
30
20
|
...getDocumentsFields('financial'),
|
|
31
|
-
...getDocumentsFields('offerLetter')
|
|
21
|
+
...getDocumentsFields('offerLetter'),
|
|
32
22
|
]);
|
|
33
23
|
can('manage', 'Business');
|
|
34
24
|
can('manage', 'Inquiry');
|
|
@@ -39,23 +29,17 @@ export const defineRoleAbilitiesSalesExecutive = async (can, cannot)=>{
|
|
|
39
29
|
'endedAt',
|
|
40
30
|
'plan',
|
|
41
31
|
'mileagePackage',
|
|
42
|
-
'payerType'
|
|
32
|
+
'payerType',
|
|
43
33
|
]);
|
|
44
34
|
can('read', 'SubscriptionReservation');
|
|
45
|
-
cannot('update', 'Subscription', [
|
|
46
|
-
'status',
|
|
47
|
-
'started'
|
|
48
|
-
]);
|
|
35
|
+
cannot('update', 'Subscription', ['status', 'started']);
|
|
49
36
|
cannot('update', 'Vehicle', getPricingFields());
|
|
50
37
|
can('testPricingInput', 'Vehicle');
|
|
51
38
|
can('readPricingInput', 'Vehicle');
|
|
52
39
|
cannot('cancelInvoice', 'Invoice');
|
|
53
40
|
cannot('markInvoice', 'Invoice');
|
|
54
41
|
cannot('delete', 'Quotation');
|
|
55
|
-
cannot('read', [
|
|
56
|
-
'Vacancy',
|
|
57
|
-
'Applicant'
|
|
58
|
-
]);
|
|
42
|
+
cannot('read', ['Vacancy', 'Applicant']);
|
|
59
43
|
can('read', 'Activity');
|
|
60
44
|
can('read', 'ActivityTask');
|
|
61
45
|
};
|