-
Notifications
You must be signed in to change notification settings - Fork 2.9k
/
Permissions.js
126 lines (112 loc) · 2.89 KB
/
Permissions.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
import _ from 'underscore';
import CONST from '../CONST';
/**
* @private
* @param {Array<String>} betas
* @returns {Boolean}
*/
function canUseAllBetas(betas) {
return _.contains(betas, CONST.BETAS.ALL);
}
/**
* @param {Array<String>} betas
* @returns {Boolean}
*/
function canUseChronos(betas) {
return _.contains(betas, CONST.BETAS.CHRONOS_IN_CASH) || canUseAllBetas(betas);
}
/**
* @param {Array<String>} betas
* @returns {Boolean}
*/
function canUseIOU(betas) {
return _.contains(betas, CONST.BETAS.IOU) || canUseAllBetas(betas);
}
/**
* @param {Array<String>} betas
* @returns {Boolean}
*/
function canUsePayWithExpensify(betas) {
return _.contains(betas, CONST.BETAS.PAY_WITH_EXPENSIFY) || canUseAllBetas(betas);
}
/**
* @param {Array<String>} betas
* @returns {Boolean}
*/
function canUseDefaultRooms(betas) {
return _.contains(betas, CONST.BETAS.DEFAULT_ROOMS) || canUseAllBetas(betas);
}
/**
* IOU Send feature is temporarily disabled.
*
* @returns {Boolean}
*/
function canUseIOUSend() {
return false;
}
/**
* @param {Array<String>} betas
* @returns {Boolean}
*/
function canUseWallet(betas) {
return _.contains(betas, CONST.BETAS.BETA_EXPENSIFY_WALLET) || canUseAllBetas(betas);
}
/**
* @param {Array<String>} betas
* @returns {Boolean}
*/
function canUseCommentLinking(betas) {
return _.contains(betas, CONST.BETAS.BETA_COMMENT_LINKING) || canUseAllBetas(betas);
}
/**
* We're requiring you to be added to the policy rooms beta on dev,
* since contributors have been reporting a number of false issues related to the feature being under development.
* See https://expensify.slack.com/archives/C01GTK53T8Q/p1641921996319400?thread_ts=1641598356.166900&cid=C01GTK53T8Q
* @param {Array<String>} betas
* @returns {Boolean}
*/
function canUsePolicyRooms(betas) {
return _.contains(betas, CONST.BETAS.POLICY_ROOMS) || canUseAllBetas(betas);
}
/**
* @param {Array<String>} betas
* @returns {Boolean}
*/
function canUsePolicyExpenseChat(betas) {
return _.contains(betas, CONST.BETAS.POLICY_EXPENSE_CHAT) || canUseAllBetas(betas);
}
/**
* @param {Array<String>} betas
* @returns {Boolean}
*/
function canUsePasswordlessLogins(betas) {
return _.contains(betas, CONST.BETAS.PASSWORDLESS) || canUseAllBetas(betas);
}
/**
* @param {Array<String>} betas
* @returns {Boolean}
*/
function canUseTasks(betas) {
return _.contains(betas, CONST.BETAS.TASKS) || canUseAllBetas(betas);
}
/**
* @param {Array<String>} betas
* @returns {Boolean}
*/
function canUseScanReceipts(betas) {
return _.contains(betas, CONST.BETAS.SCAN_RECEIPTS) || canUseAllBetas(betas);
}
export default {
canUseChronos,
canUseIOU,
canUsePayWithExpensify,
canUseDefaultRooms,
canUseIOUSend,
canUseWallet,
canUseCommentLinking,
canUsePolicyRooms,
canUsePolicyExpenseChat,
canUsePasswordlessLogins,
canUseTasks,
canUseScanReceipts,
};