-
Notifications
You must be signed in to change notification settings - Fork 2.9k
/
Permissions.js
102 lines (88 loc) · 2.42 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
import _ from 'underscore';
import * as Environment from './Environment/Environment';
import CONST from '../CONST';
/**
* @private
* @param {Array<String>} betas
* @returns {Boolean}
*/
function canUseAllBetas(betas) {
return Environment.isDevelopment() || _.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 canUseFreePlan(betas) {
return _.contains(betas, CONST.BETAS.FREE_PLAN) || canUseAllBetas(betas);
}
/**
* @param {Array<String>} betas
* @returns {Boolean}
*/
function canUseDefaultRooms(betas) {
return _.contains(betas, CONST.BETAS.DEFAULT_ROOMS) || canUseAllBetas(betas);
}
/**
* @param {Array<String>} betas
* @returns {Boolean}
*/
function canUseInternationalization(betas) {
return _.contains(betas, CONST.BETAS.INTERNATIONALIZATION) || canUseAllBetas(betas);
}
/**
* @param {Array<String>} betas
* @returns {Boolean}
*/
function canUseIOUSend(betas) {
return _.contains(betas, CONST.BETAS.IOU_SEND) || canUseAllBetas(betas);
}
/**
* @param {Array<String>} betas
* @returns {Boolean}
*/
function canUseWallet(betas) {
return _.contains(betas, CONST.BETAS.BETA_EXPENSIFY_WALLET) || 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) || _.contains(betas, CONST.BETAS.ALL);
}
export default {
canUseChronos,
canUseIOU,
canUsePayWithExpensify,
canUseFreePlan,
canUseDefaultRooms,
canUseInternationalization,
canUseIOUSend,
canUseWallet,
canUsePolicyRooms,
};