@atlaskit/teams-client 4.32.1 → 4.32.3
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/CHANGELOG.md +16 -0
- package/dist/cjs/common/utils/permissions/constants.js +53 -19
- package/dist/es2019/common/utils/permissions/constants.js +56 -19
- package/dist/esm/common/utils/permissions/constants.js +53 -19
- package/dist/types/common/utils/permissions/constants.d.ts +6 -0
- package/dist/types-ts4.5/common/utils/permissions/constants.d.ts +6 -0
- package/package.json +12 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/teams-client
|
|
2
2
|
|
|
3
|
+
## 4.32.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`238ba9dc63a10`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/238ba9dc63a10) -
|
|
8
|
+
Fix ARCHIVE_TEAM/UNARCHIVE_TEAM permission logic for ORG_ADMIN_MANAGED, EXTERNAL and
|
|
9
|
+
OPEN/MEMBER_INVITE teams, and stop fg() mock state leaking between test describe blocks.
|
|
10
|
+
|
|
11
|
+
## 4.32.2
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [`7fb5bfbafb83e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7fb5bfbafb83e) -
|
|
16
|
+
Enrol people-and-teams packages into the React Compiler with platform gating via
|
|
17
|
+
isReactCompilerActivePlatform
|
|
18
|
+
|
|
3
19
|
## 4.32.1
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -27,16 +27,20 @@ var allPermissions = exports.allPermissions = function allPermissions(defaultPer
|
|
|
27
27
|
DELETE_TEAM: defaultPermission,
|
|
28
28
|
EDIT_TEAM_SETTINGS: defaultPermission,
|
|
29
29
|
EDIT_TEAM_MEMBERSHIP: defaultPermission,
|
|
30
|
-
EDIT_TEAM_TYPE: defaultPermission && isOrgAdmin,
|
|
30
|
+
EDIT_TEAM_TYPE: defaultPermission && (isOrgAdmin || (0, _platformFeatureFlags.fg)('ptc-enable-team-type-permission-enabled')),
|
|
31
31
|
REMOVE_AGENT_FROM_TEAM: defaultPermission,
|
|
32
32
|
ADD_AGENT_TO_TEAM: defaultPermission,
|
|
33
|
-
ARCHIVE_TEAM: defaultPermission && isMember,
|
|
33
|
+
ARCHIVE_TEAM: defaultPermission && (isMember || (0, _platformFeatureFlags.fg)('ptc-enable-team-type-permission-enabled')),
|
|
34
34
|
UNARCHIVE_TEAM: false,
|
|
35
35
|
CAN_EDIT_HIERARCHY: defaultPermission,
|
|
36
36
|
CAN_CHANGE_MEMBERSHIP_SETTINGS: defaultPermission
|
|
37
37
|
};
|
|
38
38
|
};
|
|
39
39
|
var vanityActions = exports.vanityActions = ['EDIT_DESCRIPTION', 'EDIT_TEAM_NAME', 'EDIT_PROFILE_HEADER', 'EDIT_TEAM_LINK'];
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* This is really just required so we don't show things like "Request to join team" if the team is open
|
|
43
|
+
*/
|
|
40
44
|
var openPermissions = exports.openPermissions = function openPermissions(permission) {
|
|
41
45
|
return {
|
|
42
46
|
JOIN_TEAM: permission === 'FULL_READ' || permission === 'FULL_WRITE',
|
|
@@ -46,6 +50,10 @@ var openPermissions = exports.openPermissions = function openPermissions(permiss
|
|
|
46
50
|
REJECT_JOIN_REQUEST: false
|
|
47
51
|
};
|
|
48
52
|
};
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* This is really just required so we don't show things like "Join team" if the team is member invite and it should say "Request to join team"
|
|
56
|
+
*/
|
|
49
57
|
var inviteOnlyPermissions = exports.inviteOnlyPermissions = function inviteOnlyPermissions(permission) {
|
|
50
58
|
return {
|
|
51
59
|
REQUEST_TO_JOIN: permission === 'FULL_READ',
|
|
@@ -70,19 +78,20 @@ var SCIMSyncTeamPermissions = exports.SCIMSyncTeamPermissions = function SCIMSyn
|
|
|
70
78
|
var getDisbandedTeamPermissionMap = function getDisbandedTeamPermissionMap(settings, permission, isMember, isOrgAdmin) {
|
|
71
79
|
// Base permission map - all actions disabled for disbanded teams
|
|
72
80
|
var basePermissions = allPermissions(false, false, false);
|
|
81
|
+
var canUnarchive;
|
|
73
82
|
|
|
74
|
-
//
|
|
75
|
-
var canUnarchive = false;
|
|
83
|
+
// On fg('ptc-enable-team-type-permission-enabled') clean up delete this code block
|
|
76
84
|
if (settings === 'EXTERNAL' || settings === 'ORG_ADMIN_MANAGED') {
|
|
77
85
|
// For EXTERNAL and ORG_ADMIN_MANAGED teams, only org admins can unarchive
|
|
78
86
|
canUnarchive = isOrgAdmin;
|
|
79
|
-
} else
|
|
80
|
-
// For OPEN and MEMBER_INVITE teams, members with FULL_WRITE can unarchive
|
|
87
|
+
} else {
|
|
88
|
+
// For OPEN and MEMBER_INVITE teams, members with FULL_WRITE (or org admins) can unarchive
|
|
81
89
|
canUnarchive = (isMember || isOrgAdmin) && permission === 'FULL_WRITE';
|
|
82
90
|
}
|
|
83
91
|
return _objectSpread(_objectSpread({}, basePermissions), {}, {
|
|
84
92
|
CAN_EDIT_HIERARCHY: false,
|
|
85
|
-
UNARCHIVE_TEAM: canUnarchive,
|
|
93
|
+
UNARCHIVE_TEAM: canUnarchive || permission === 'FULL_WRITE' && (0, _platformFeatureFlags.fg)('ptc-enable-team-type-permission-enabled'),
|
|
94
|
+
// With 'ptc-enable-team-type-permission-enabled' DELETE_TEAM perm is _wrong_ here and handled in the hook
|
|
86
95
|
DELETE_TEAM: canUnarchive
|
|
87
96
|
});
|
|
88
97
|
};
|
|
@@ -91,16 +100,36 @@ var getDisbandedTeamPermissionMap = function getDisbandedTeamPermissionMap(setti
|
|
|
91
100
|
* Returns permission map for active teams based on team settings
|
|
92
101
|
*/
|
|
93
102
|
var getActiveTeamPermissionMap = function getActiveTeamPermissionMap(settings, permission, isMember, isOrgAdmin, source) {
|
|
103
|
+
var basePermissions = allPermissions(permission === 'FULL_WRITE', isMember, isOrgAdmin);
|
|
94
104
|
if (settings === 'OPEN') {
|
|
95
|
-
return _objectSpread(_objectSpread(_objectSpread({},
|
|
96
|
-
|
|
105
|
+
return _objectSpread(_objectSpread(_objectSpread({}, basePermissions), openPermissions(permission)), {}, {
|
|
106
|
+
// Delete this row on enable_edit_team_name_external_type_teams cleanup
|
|
107
|
+
ARCHIVE_TEAM: permission === 'FULL_WRITE' && (isMember || isOrgAdmin) || basePermissions.ARCHIVE_TEAM && (0, _platformFeatureFlags.fg)('ptc-enable-team-type-permission-enabled')
|
|
97
108
|
});
|
|
98
109
|
}
|
|
99
110
|
if (settings === 'MEMBER_INVITE') {
|
|
100
|
-
return _objectSpread(_objectSpread(_objectSpread({},
|
|
101
|
-
|
|
111
|
+
return _objectSpread(_objectSpread(_objectSpread({}, basePermissions), inviteOnlyPermissions(permission)), {}, {
|
|
112
|
+
// Delete this row on enable_edit_team_name_external_type_teams cleanup
|
|
113
|
+
ARCHIVE_TEAM: permission === 'FULL_WRITE' && (isMember || isOrgAdmin) || basePermissions.ARCHIVE_TEAM && (0, _platformFeatureFlags.fg)('ptc-enable-team-type-permission-enabled')
|
|
102
114
|
});
|
|
103
115
|
} else if (settings === 'EXTERNAL') {
|
|
116
|
+
if ((0, _platformFeatureFlags.fg)('enable_edit_team_name_external_type_teams')) {
|
|
117
|
+
// All membership based actions are disabled for Externally synced teams
|
|
118
|
+
var base = allPermissions(false, isMember, isOrgAdmin);
|
|
119
|
+
var actionsMembersCanPerform = {
|
|
120
|
+
// Org admins should not be able to edit hierarchies of HRIS synced teams
|
|
121
|
+
CAN_EDIT_HIERARCHY: source === 'ATLASSIAN_GROUP' && basePermissions.CAN_EDIT_HIERARCHY,
|
|
122
|
+
ADD_AGENT_TO_TEAM: basePermissions.ADD_AGENT_TO_TEAM,
|
|
123
|
+
REMOVE_AGENT_FROM_TEAM: basePermissions.REMOVE_AGENT_FROM_TEAM,
|
|
124
|
+
ARCHIVE_TEAM: basePermissions.ARCHIVE_TEAM,
|
|
125
|
+
EDIT_TEAM_TYPE: basePermissions.EDIT_TEAM_TYPE,
|
|
126
|
+
EDIT_DESCRIPTION: basePermissions.EDIT_DESCRIPTION,
|
|
127
|
+
EDIT_TEAM_SETTINGS: basePermissions.EDIT_TEAM_SETTINGS,
|
|
128
|
+
EDIT_TEAM_LINK: basePermissions.EDIT_TEAM_LINK,
|
|
129
|
+
EDIT_TEAM_NAME: basePermissions.EDIT_TEAM_NAME && source === 'ATLASSIAN_GROUP' && (0, _platformFeatureFlags.fg)('enable_edit_team_name_external_type_teams')
|
|
130
|
+
};
|
|
131
|
+
return _objectSpread(_objectSpread({}, base), actionsMembersCanPerform);
|
|
132
|
+
}
|
|
104
133
|
return _objectSpread(_objectSpread(_objectSpread({}, allPermissions(false, isMember, isOrgAdmin)), SCIMSyncTeamPermissions(isMember, isOrgAdmin, source)), {}, {
|
|
105
134
|
ADD_AGENT_TO_TEAM: isMember || isOrgAdmin,
|
|
106
135
|
REMOVE_AGENT_FROM_TEAM: isMember || isOrgAdmin,
|
|
@@ -109,15 +138,20 @@ var getActiveTeamPermissionMap = function getActiveTeamPermissionMap(settings, p
|
|
|
109
138
|
});
|
|
110
139
|
} else if (settings === 'ORG_ADMIN_MANAGED') {
|
|
111
140
|
// NOTE: Only org admins will received FULL_WRITE permission
|
|
112
|
-
return _objectSpread(_objectSpread({},
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
CAN_EDIT_HIERARCHY: permission === 'FULL_WRITE',
|
|
118
|
-
EDIT_TEAM_TYPE: permission === 'FULL_WRITE',
|
|
141
|
+
return _objectSpread(_objectSpread({}, basePermissions), {}, {
|
|
142
|
+
// Delete all there rows on enable_edit_team_name_external_type_teams cleanup
|
|
143
|
+
EDIT_TEAM_LINK: isMember || permission === 'FULL_WRITE' || basePermissions.EDIT_TEAM_LINK && (0, _platformFeatureFlags.fg)('ptc-enable-team-type-permission-enabled'),
|
|
144
|
+
ADD_AGENT_TO_TEAM: isMember || permission === 'FULL_WRITE' || basePermissions.ADD_AGENT_TO_TEAM && (0, _platformFeatureFlags.fg)('ptc-enable-team-type-permission-enabled'),
|
|
145
|
+
REMOVE_AGENT_FROM_TEAM: isMember || permission === 'FULL_WRITE' || basePermissions.REMOVE_AGENT_FROM_TEAM && (0, _platformFeatureFlags.fg)('ptc-enable-team-type-permission-enabled'),
|
|
146
|
+
CAN_EDIT_HIERARCHY: permission === 'FULL_WRITE' || basePermissions.CAN_EDIT_HIERARCHY && (0, _platformFeatureFlags.fg)('ptc-enable-team-type-permission-enabled'),
|
|
147
|
+
EDIT_TEAM_TYPE: permission === 'FULL_WRITE' || basePermissions.EDIT_TEAM_TYPE && (0, _platformFeatureFlags.fg)('ptc-enable-team-type-permission-enabled'),
|
|
119
148
|
// ORG_ADMIN_MANAGED teams should not provide options to edit membership settings
|
|
120
|
-
EDIT_TEAM_MEMBERSHIP: false
|
|
149
|
+
EDIT_TEAM_MEMBERSHIP: false || basePermissions.EDIT_TEAM_MEMBERSHIP && (0, _platformFeatureFlags.fg)('ptc-enable-team-type-permission-enabled'),
|
|
150
|
+
// There is no "invite" flow in org_admin_managed teams
|
|
151
|
+
REQUEST_TO_JOIN: (0, _platformFeatureFlags.fg)('ptc-enable-team-type-permission-enabled') ? false : basePermissions.REQUEST_TO_JOIN,
|
|
152
|
+
CANCEL_JOIN_REQUEST: (0, _platformFeatureFlags.fg)('ptc-enable-team-type-permission-enabled') ? false : basePermissions.CANCEL_JOIN_REQUEST,
|
|
153
|
+
APPROVE_JOIN_REQUEST: (0, _platformFeatureFlags.fg)('ptc-enable-team-type-permission-enabled') ? false : basePermissions.APPROVE_JOIN_REQUEST,
|
|
154
|
+
REJECT_JOIN_REQUEST: (0, _platformFeatureFlags.fg)('ptc-enable-team-type-permission-enabled') ? false : basePermissions.REJECT_JOIN_REQUEST
|
|
121
155
|
});
|
|
122
156
|
}
|
|
123
157
|
return allPermissions(false, false, false);
|
|
@@ -16,15 +16,19 @@ export const allPermissions = (defaultPermission, isMember, isOrgAdmin) => ({
|
|
|
16
16
|
DELETE_TEAM: defaultPermission,
|
|
17
17
|
EDIT_TEAM_SETTINGS: defaultPermission,
|
|
18
18
|
EDIT_TEAM_MEMBERSHIP: defaultPermission,
|
|
19
|
-
EDIT_TEAM_TYPE: defaultPermission && isOrgAdmin,
|
|
19
|
+
EDIT_TEAM_TYPE: defaultPermission && (isOrgAdmin || fg('ptc-enable-team-type-permission-enabled')),
|
|
20
20
|
REMOVE_AGENT_FROM_TEAM: defaultPermission,
|
|
21
21
|
ADD_AGENT_TO_TEAM: defaultPermission,
|
|
22
|
-
ARCHIVE_TEAM: defaultPermission && isMember,
|
|
22
|
+
ARCHIVE_TEAM: defaultPermission && (isMember || fg('ptc-enable-team-type-permission-enabled')),
|
|
23
23
|
UNARCHIVE_TEAM: false,
|
|
24
24
|
CAN_EDIT_HIERARCHY: defaultPermission,
|
|
25
25
|
CAN_CHANGE_MEMBERSHIP_SETTINGS: defaultPermission
|
|
26
26
|
});
|
|
27
27
|
export const vanityActions = ['EDIT_DESCRIPTION', 'EDIT_TEAM_NAME', 'EDIT_PROFILE_HEADER', 'EDIT_TEAM_LINK'];
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* This is really just required so we don't show things like "Request to join team" if the team is open
|
|
31
|
+
*/
|
|
28
32
|
export const openPermissions = permission => ({
|
|
29
33
|
JOIN_TEAM: permission === 'FULL_READ' || permission === 'FULL_WRITE',
|
|
30
34
|
REQUEST_TO_JOIN: false,
|
|
@@ -32,6 +36,10 @@ export const openPermissions = permission => ({
|
|
|
32
36
|
APPROVE_JOIN_REQUEST: false,
|
|
33
37
|
REJECT_JOIN_REQUEST: false
|
|
34
38
|
});
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* This is really just required so we don't show things like "Join team" if the team is member invite and it should say "Request to join team"
|
|
42
|
+
*/
|
|
35
43
|
export const inviteOnlyPermissions = permission => ({
|
|
36
44
|
REQUEST_TO_JOIN: permission === 'FULL_READ',
|
|
37
45
|
CANCEL_JOIN_REQUEST: permission === 'FULL_READ'
|
|
@@ -52,20 +60,21 @@ export const SCIMSyncTeamPermissions = (isMember, isOrgAdmin, source) => ({
|
|
|
52
60
|
const getDisbandedTeamPermissionMap = (settings, permission, isMember, isOrgAdmin) => {
|
|
53
61
|
// Base permission map - all actions disabled for disbanded teams
|
|
54
62
|
const basePermissions = allPermissions(false, false, false);
|
|
63
|
+
let canUnarchive;
|
|
55
64
|
|
|
56
|
-
//
|
|
57
|
-
let canUnarchive = false;
|
|
65
|
+
// On fg('ptc-enable-team-type-permission-enabled') clean up delete this code block
|
|
58
66
|
if (settings === 'EXTERNAL' || settings === 'ORG_ADMIN_MANAGED') {
|
|
59
67
|
// For EXTERNAL and ORG_ADMIN_MANAGED teams, only org admins can unarchive
|
|
60
68
|
canUnarchive = isOrgAdmin;
|
|
61
|
-
} else
|
|
62
|
-
// For OPEN and MEMBER_INVITE teams, members with FULL_WRITE can unarchive
|
|
69
|
+
} else {
|
|
70
|
+
// For OPEN and MEMBER_INVITE teams, members with FULL_WRITE (or org admins) can unarchive
|
|
63
71
|
canUnarchive = (isMember || isOrgAdmin) && permission === 'FULL_WRITE';
|
|
64
72
|
}
|
|
65
73
|
return {
|
|
66
74
|
...basePermissions,
|
|
67
75
|
CAN_EDIT_HIERARCHY: false,
|
|
68
|
-
UNARCHIVE_TEAM: canUnarchive,
|
|
76
|
+
UNARCHIVE_TEAM: canUnarchive || permission === 'FULL_WRITE' && fg('ptc-enable-team-type-permission-enabled'),
|
|
77
|
+
// With 'ptc-enable-team-type-permission-enabled' DELETE_TEAM perm is _wrong_ here and handled in the hook
|
|
69
78
|
DELETE_TEAM: canUnarchive
|
|
70
79
|
};
|
|
71
80
|
};
|
|
@@ -74,20 +83,43 @@ const getDisbandedTeamPermissionMap = (settings, permission, isMember, isOrgAdmi
|
|
|
74
83
|
* Returns permission map for active teams based on team settings
|
|
75
84
|
*/
|
|
76
85
|
const getActiveTeamPermissionMap = (settings, permission, isMember, isOrgAdmin, source) => {
|
|
86
|
+
const basePermissions = allPermissions(permission === 'FULL_WRITE', isMember, isOrgAdmin);
|
|
77
87
|
if (settings === 'OPEN') {
|
|
78
88
|
return {
|
|
79
|
-
...
|
|
89
|
+
...basePermissions,
|
|
80
90
|
...openPermissions(permission),
|
|
81
|
-
|
|
91
|
+
// Delete this row on enable_edit_team_name_external_type_teams cleanup
|
|
92
|
+
ARCHIVE_TEAM: permission === 'FULL_WRITE' && (isMember || isOrgAdmin) || basePermissions.ARCHIVE_TEAM && fg('ptc-enable-team-type-permission-enabled')
|
|
82
93
|
};
|
|
83
94
|
}
|
|
84
95
|
if (settings === 'MEMBER_INVITE') {
|
|
85
96
|
return {
|
|
86
|
-
...
|
|
97
|
+
...basePermissions,
|
|
87
98
|
...inviteOnlyPermissions(permission),
|
|
88
|
-
|
|
99
|
+
// Delete this row on enable_edit_team_name_external_type_teams cleanup
|
|
100
|
+
ARCHIVE_TEAM: permission === 'FULL_WRITE' && (isMember || isOrgAdmin) || basePermissions.ARCHIVE_TEAM && fg('ptc-enable-team-type-permission-enabled')
|
|
89
101
|
};
|
|
90
102
|
} else if (settings === 'EXTERNAL') {
|
|
103
|
+
if (fg('enable_edit_team_name_external_type_teams')) {
|
|
104
|
+
// All membership based actions are disabled for Externally synced teams
|
|
105
|
+
const base = allPermissions(false, isMember, isOrgAdmin);
|
|
106
|
+
const actionsMembersCanPerform = {
|
|
107
|
+
// Org admins should not be able to edit hierarchies of HRIS synced teams
|
|
108
|
+
CAN_EDIT_HIERARCHY: source === 'ATLASSIAN_GROUP' && basePermissions.CAN_EDIT_HIERARCHY,
|
|
109
|
+
ADD_AGENT_TO_TEAM: basePermissions.ADD_AGENT_TO_TEAM,
|
|
110
|
+
REMOVE_AGENT_FROM_TEAM: basePermissions.REMOVE_AGENT_FROM_TEAM,
|
|
111
|
+
ARCHIVE_TEAM: basePermissions.ARCHIVE_TEAM,
|
|
112
|
+
EDIT_TEAM_TYPE: basePermissions.EDIT_TEAM_TYPE,
|
|
113
|
+
EDIT_DESCRIPTION: basePermissions.EDIT_DESCRIPTION,
|
|
114
|
+
EDIT_TEAM_SETTINGS: basePermissions.EDIT_TEAM_SETTINGS,
|
|
115
|
+
EDIT_TEAM_LINK: basePermissions.EDIT_TEAM_LINK,
|
|
116
|
+
EDIT_TEAM_NAME: basePermissions.EDIT_TEAM_NAME && source === 'ATLASSIAN_GROUP' && fg('enable_edit_team_name_external_type_teams')
|
|
117
|
+
};
|
|
118
|
+
return {
|
|
119
|
+
...base,
|
|
120
|
+
...actionsMembersCanPerform
|
|
121
|
+
};
|
|
122
|
+
}
|
|
91
123
|
return {
|
|
92
124
|
...allPermissions(false, isMember, isOrgAdmin),
|
|
93
125
|
...SCIMSyncTeamPermissions(isMember, isOrgAdmin, source),
|
|
@@ -99,15 +131,20 @@ const getActiveTeamPermissionMap = (settings, permission, isMember, isOrgAdmin,
|
|
|
99
131
|
} else if (settings === 'ORG_ADMIN_MANAGED') {
|
|
100
132
|
// NOTE: Only org admins will received FULL_WRITE permission
|
|
101
133
|
return {
|
|
102
|
-
...
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
CAN_EDIT_HIERARCHY: permission === 'FULL_WRITE',
|
|
108
|
-
EDIT_TEAM_TYPE: permission === 'FULL_WRITE',
|
|
134
|
+
...basePermissions,
|
|
135
|
+
// Delete all there rows on enable_edit_team_name_external_type_teams cleanup
|
|
136
|
+
EDIT_TEAM_LINK: isMember || permission === 'FULL_WRITE' || basePermissions.EDIT_TEAM_LINK && fg('ptc-enable-team-type-permission-enabled'),
|
|
137
|
+
ADD_AGENT_TO_TEAM: isMember || permission === 'FULL_WRITE' || basePermissions.ADD_AGENT_TO_TEAM && fg('ptc-enable-team-type-permission-enabled'),
|
|
138
|
+
REMOVE_AGENT_FROM_TEAM: isMember || permission === 'FULL_WRITE' || basePermissions.REMOVE_AGENT_FROM_TEAM && fg('ptc-enable-team-type-permission-enabled'),
|
|
139
|
+
CAN_EDIT_HIERARCHY: permission === 'FULL_WRITE' || basePermissions.CAN_EDIT_HIERARCHY && fg('ptc-enable-team-type-permission-enabled'),
|
|
140
|
+
EDIT_TEAM_TYPE: permission === 'FULL_WRITE' || basePermissions.EDIT_TEAM_TYPE && fg('ptc-enable-team-type-permission-enabled'),
|
|
109
141
|
// ORG_ADMIN_MANAGED teams should not provide options to edit membership settings
|
|
110
|
-
EDIT_TEAM_MEMBERSHIP: false
|
|
142
|
+
EDIT_TEAM_MEMBERSHIP: false || basePermissions.EDIT_TEAM_MEMBERSHIP && fg('ptc-enable-team-type-permission-enabled'),
|
|
143
|
+
// There is no "invite" flow in org_admin_managed teams
|
|
144
|
+
REQUEST_TO_JOIN: fg('ptc-enable-team-type-permission-enabled') ? false : basePermissions.REQUEST_TO_JOIN,
|
|
145
|
+
CANCEL_JOIN_REQUEST: fg('ptc-enable-team-type-permission-enabled') ? false : basePermissions.CANCEL_JOIN_REQUEST,
|
|
146
|
+
APPROVE_JOIN_REQUEST: fg('ptc-enable-team-type-permission-enabled') ? false : basePermissions.APPROVE_JOIN_REQUEST,
|
|
147
|
+
REJECT_JOIN_REQUEST: fg('ptc-enable-team-type-permission-enabled') ? false : basePermissions.REJECT_JOIN_REQUEST
|
|
111
148
|
};
|
|
112
149
|
}
|
|
113
150
|
return allPermissions(false, false, false);
|
|
@@ -20,16 +20,20 @@ export var allPermissions = function allPermissions(defaultPermission, isMember,
|
|
|
20
20
|
DELETE_TEAM: defaultPermission,
|
|
21
21
|
EDIT_TEAM_SETTINGS: defaultPermission,
|
|
22
22
|
EDIT_TEAM_MEMBERSHIP: defaultPermission,
|
|
23
|
-
EDIT_TEAM_TYPE: defaultPermission && isOrgAdmin,
|
|
23
|
+
EDIT_TEAM_TYPE: defaultPermission && (isOrgAdmin || fg('ptc-enable-team-type-permission-enabled')),
|
|
24
24
|
REMOVE_AGENT_FROM_TEAM: defaultPermission,
|
|
25
25
|
ADD_AGENT_TO_TEAM: defaultPermission,
|
|
26
|
-
ARCHIVE_TEAM: defaultPermission && isMember,
|
|
26
|
+
ARCHIVE_TEAM: defaultPermission && (isMember || fg('ptc-enable-team-type-permission-enabled')),
|
|
27
27
|
UNARCHIVE_TEAM: false,
|
|
28
28
|
CAN_EDIT_HIERARCHY: defaultPermission,
|
|
29
29
|
CAN_CHANGE_MEMBERSHIP_SETTINGS: defaultPermission
|
|
30
30
|
};
|
|
31
31
|
};
|
|
32
32
|
export var vanityActions = ['EDIT_DESCRIPTION', 'EDIT_TEAM_NAME', 'EDIT_PROFILE_HEADER', 'EDIT_TEAM_LINK'];
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* This is really just required so we don't show things like "Request to join team" if the team is open
|
|
36
|
+
*/
|
|
33
37
|
export var openPermissions = function openPermissions(permission) {
|
|
34
38
|
return {
|
|
35
39
|
JOIN_TEAM: permission === 'FULL_READ' || permission === 'FULL_WRITE',
|
|
@@ -39,6 +43,10 @@ export var openPermissions = function openPermissions(permission) {
|
|
|
39
43
|
REJECT_JOIN_REQUEST: false
|
|
40
44
|
};
|
|
41
45
|
};
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* This is really just required so we don't show things like "Join team" if the team is member invite and it should say "Request to join team"
|
|
49
|
+
*/
|
|
42
50
|
export var inviteOnlyPermissions = function inviteOnlyPermissions(permission) {
|
|
43
51
|
return {
|
|
44
52
|
REQUEST_TO_JOIN: permission === 'FULL_READ',
|
|
@@ -63,19 +71,20 @@ export var SCIMSyncTeamPermissions = function SCIMSyncTeamPermissions(isMember,
|
|
|
63
71
|
var getDisbandedTeamPermissionMap = function getDisbandedTeamPermissionMap(settings, permission, isMember, isOrgAdmin) {
|
|
64
72
|
// Base permission map - all actions disabled for disbanded teams
|
|
65
73
|
var basePermissions = allPermissions(false, false, false);
|
|
74
|
+
var canUnarchive;
|
|
66
75
|
|
|
67
|
-
//
|
|
68
|
-
var canUnarchive = false;
|
|
76
|
+
// On fg('ptc-enable-team-type-permission-enabled') clean up delete this code block
|
|
69
77
|
if (settings === 'EXTERNAL' || settings === 'ORG_ADMIN_MANAGED') {
|
|
70
78
|
// For EXTERNAL and ORG_ADMIN_MANAGED teams, only org admins can unarchive
|
|
71
79
|
canUnarchive = isOrgAdmin;
|
|
72
|
-
} else
|
|
73
|
-
// For OPEN and MEMBER_INVITE teams, members with FULL_WRITE can unarchive
|
|
80
|
+
} else {
|
|
81
|
+
// For OPEN and MEMBER_INVITE teams, members with FULL_WRITE (or org admins) can unarchive
|
|
74
82
|
canUnarchive = (isMember || isOrgAdmin) && permission === 'FULL_WRITE';
|
|
75
83
|
}
|
|
76
84
|
return _objectSpread(_objectSpread({}, basePermissions), {}, {
|
|
77
85
|
CAN_EDIT_HIERARCHY: false,
|
|
78
|
-
UNARCHIVE_TEAM: canUnarchive,
|
|
86
|
+
UNARCHIVE_TEAM: canUnarchive || permission === 'FULL_WRITE' && fg('ptc-enable-team-type-permission-enabled'),
|
|
87
|
+
// With 'ptc-enable-team-type-permission-enabled' DELETE_TEAM perm is _wrong_ here and handled in the hook
|
|
79
88
|
DELETE_TEAM: canUnarchive
|
|
80
89
|
});
|
|
81
90
|
};
|
|
@@ -84,16 +93,36 @@ var getDisbandedTeamPermissionMap = function getDisbandedTeamPermissionMap(setti
|
|
|
84
93
|
* Returns permission map for active teams based on team settings
|
|
85
94
|
*/
|
|
86
95
|
var getActiveTeamPermissionMap = function getActiveTeamPermissionMap(settings, permission, isMember, isOrgAdmin, source) {
|
|
96
|
+
var basePermissions = allPermissions(permission === 'FULL_WRITE', isMember, isOrgAdmin);
|
|
87
97
|
if (settings === 'OPEN') {
|
|
88
|
-
return _objectSpread(_objectSpread(_objectSpread({},
|
|
89
|
-
|
|
98
|
+
return _objectSpread(_objectSpread(_objectSpread({}, basePermissions), openPermissions(permission)), {}, {
|
|
99
|
+
// Delete this row on enable_edit_team_name_external_type_teams cleanup
|
|
100
|
+
ARCHIVE_TEAM: permission === 'FULL_WRITE' && (isMember || isOrgAdmin) || basePermissions.ARCHIVE_TEAM && fg('ptc-enable-team-type-permission-enabled')
|
|
90
101
|
});
|
|
91
102
|
}
|
|
92
103
|
if (settings === 'MEMBER_INVITE') {
|
|
93
|
-
return _objectSpread(_objectSpread(_objectSpread({},
|
|
94
|
-
|
|
104
|
+
return _objectSpread(_objectSpread(_objectSpread({}, basePermissions), inviteOnlyPermissions(permission)), {}, {
|
|
105
|
+
// Delete this row on enable_edit_team_name_external_type_teams cleanup
|
|
106
|
+
ARCHIVE_TEAM: permission === 'FULL_WRITE' && (isMember || isOrgAdmin) || basePermissions.ARCHIVE_TEAM && fg('ptc-enable-team-type-permission-enabled')
|
|
95
107
|
});
|
|
96
108
|
} else if (settings === 'EXTERNAL') {
|
|
109
|
+
if (fg('enable_edit_team_name_external_type_teams')) {
|
|
110
|
+
// All membership based actions are disabled for Externally synced teams
|
|
111
|
+
var base = allPermissions(false, isMember, isOrgAdmin);
|
|
112
|
+
var actionsMembersCanPerform = {
|
|
113
|
+
// Org admins should not be able to edit hierarchies of HRIS synced teams
|
|
114
|
+
CAN_EDIT_HIERARCHY: source === 'ATLASSIAN_GROUP' && basePermissions.CAN_EDIT_HIERARCHY,
|
|
115
|
+
ADD_AGENT_TO_TEAM: basePermissions.ADD_AGENT_TO_TEAM,
|
|
116
|
+
REMOVE_AGENT_FROM_TEAM: basePermissions.REMOVE_AGENT_FROM_TEAM,
|
|
117
|
+
ARCHIVE_TEAM: basePermissions.ARCHIVE_TEAM,
|
|
118
|
+
EDIT_TEAM_TYPE: basePermissions.EDIT_TEAM_TYPE,
|
|
119
|
+
EDIT_DESCRIPTION: basePermissions.EDIT_DESCRIPTION,
|
|
120
|
+
EDIT_TEAM_SETTINGS: basePermissions.EDIT_TEAM_SETTINGS,
|
|
121
|
+
EDIT_TEAM_LINK: basePermissions.EDIT_TEAM_LINK,
|
|
122
|
+
EDIT_TEAM_NAME: basePermissions.EDIT_TEAM_NAME && source === 'ATLASSIAN_GROUP' && fg('enable_edit_team_name_external_type_teams')
|
|
123
|
+
};
|
|
124
|
+
return _objectSpread(_objectSpread({}, base), actionsMembersCanPerform);
|
|
125
|
+
}
|
|
97
126
|
return _objectSpread(_objectSpread(_objectSpread({}, allPermissions(false, isMember, isOrgAdmin)), SCIMSyncTeamPermissions(isMember, isOrgAdmin, source)), {}, {
|
|
98
127
|
ADD_AGENT_TO_TEAM: isMember || isOrgAdmin,
|
|
99
128
|
REMOVE_AGENT_FROM_TEAM: isMember || isOrgAdmin,
|
|
@@ -102,15 +131,20 @@ var getActiveTeamPermissionMap = function getActiveTeamPermissionMap(settings, p
|
|
|
102
131
|
});
|
|
103
132
|
} else if (settings === 'ORG_ADMIN_MANAGED') {
|
|
104
133
|
// NOTE: Only org admins will received FULL_WRITE permission
|
|
105
|
-
return _objectSpread(_objectSpread({},
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
CAN_EDIT_HIERARCHY: permission === 'FULL_WRITE',
|
|
111
|
-
EDIT_TEAM_TYPE: permission === 'FULL_WRITE',
|
|
134
|
+
return _objectSpread(_objectSpread({}, basePermissions), {}, {
|
|
135
|
+
// Delete all there rows on enable_edit_team_name_external_type_teams cleanup
|
|
136
|
+
EDIT_TEAM_LINK: isMember || permission === 'FULL_WRITE' || basePermissions.EDIT_TEAM_LINK && fg('ptc-enable-team-type-permission-enabled'),
|
|
137
|
+
ADD_AGENT_TO_TEAM: isMember || permission === 'FULL_WRITE' || basePermissions.ADD_AGENT_TO_TEAM && fg('ptc-enable-team-type-permission-enabled'),
|
|
138
|
+
REMOVE_AGENT_FROM_TEAM: isMember || permission === 'FULL_WRITE' || basePermissions.REMOVE_AGENT_FROM_TEAM && fg('ptc-enable-team-type-permission-enabled'),
|
|
139
|
+
CAN_EDIT_HIERARCHY: permission === 'FULL_WRITE' || basePermissions.CAN_EDIT_HIERARCHY && fg('ptc-enable-team-type-permission-enabled'),
|
|
140
|
+
EDIT_TEAM_TYPE: permission === 'FULL_WRITE' || basePermissions.EDIT_TEAM_TYPE && fg('ptc-enable-team-type-permission-enabled'),
|
|
112
141
|
// ORG_ADMIN_MANAGED teams should not provide options to edit membership settings
|
|
113
|
-
EDIT_TEAM_MEMBERSHIP: false
|
|
142
|
+
EDIT_TEAM_MEMBERSHIP: false || basePermissions.EDIT_TEAM_MEMBERSHIP && fg('ptc-enable-team-type-permission-enabled'),
|
|
143
|
+
// There is no "invite" flow in org_admin_managed teams
|
|
144
|
+
REQUEST_TO_JOIN: fg('ptc-enable-team-type-permission-enabled') ? false : basePermissions.REQUEST_TO_JOIN,
|
|
145
|
+
CANCEL_JOIN_REQUEST: fg('ptc-enable-team-type-permission-enabled') ? false : basePermissions.CANCEL_JOIN_REQUEST,
|
|
146
|
+
APPROVE_JOIN_REQUEST: fg('ptc-enable-team-type-permission-enabled') ? false : basePermissions.APPROVE_JOIN_REQUEST,
|
|
147
|
+
REJECT_JOIN_REQUEST: fg('ptc-enable-team-type-permission-enabled') ? false : basePermissions.REJECT_JOIN_REQUEST
|
|
114
148
|
});
|
|
115
149
|
}
|
|
116
150
|
return allPermissions(false, false, false);
|
|
@@ -3,6 +3,9 @@ import { type TeamAction } from './types';
|
|
|
3
3
|
export type PermissionMap = Required<Record<TeamAction, boolean>>;
|
|
4
4
|
export declare const allPermissions: (defaultPermission: boolean, isMember: boolean, isOrgAdmin: boolean) => PermissionMap;
|
|
5
5
|
export declare const vanityActions: TeamAction[];
|
|
6
|
+
/**
|
|
7
|
+
* This is really just required so we don't show things like "Request to join team" if the team is open
|
|
8
|
+
*/
|
|
6
9
|
export declare const openPermissions: (permission: TeamPermission | undefined) => {
|
|
7
10
|
JOIN_TEAM: boolean;
|
|
8
11
|
REQUEST_TO_JOIN: boolean;
|
|
@@ -10,6 +13,9 @@ export declare const openPermissions: (permission: TeamPermission | undefined) =
|
|
|
10
13
|
APPROVE_JOIN_REQUEST: boolean;
|
|
11
14
|
REJECT_JOIN_REQUEST: boolean;
|
|
12
15
|
};
|
|
16
|
+
/**
|
|
17
|
+
* This is really just required so we don't show things like "Join team" if the team is member invite and it should say "Request to join team"
|
|
18
|
+
*/
|
|
13
19
|
export declare const inviteOnlyPermissions: (permission: TeamPermission | undefined) => {
|
|
14
20
|
REQUEST_TO_JOIN: boolean;
|
|
15
21
|
CANCEL_JOIN_REQUEST: boolean;
|
|
@@ -3,6 +3,9 @@ import { type TeamAction } from './types';
|
|
|
3
3
|
export type PermissionMap = Required<Record<TeamAction, boolean>>;
|
|
4
4
|
export declare const allPermissions: (defaultPermission: boolean, isMember: boolean, isOrgAdmin: boolean) => PermissionMap;
|
|
5
5
|
export declare const vanityActions: TeamAction[];
|
|
6
|
+
/**
|
|
7
|
+
* This is really just required so we don't show things like "Request to join team" if the team is open
|
|
8
|
+
*/
|
|
6
9
|
export declare const openPermissions: (permission: TeamPermission | undefined) => {
|
|
7
10
|
JOIN_TEAM: boolean;
|
|
8
11
|
REQUEST_TO_JOIN: boolean;
|
|
@@ -10,6 +13,9 @@ export declare const openPermissions: (permission: TeamPermission | undefined) =
|
|
|
10
13
|
APPROVE_JOIN_REQUEST: boolean;
|
|
11
14
|
REJECT_JOIN_REQUEST: boolean;
|
|
12
15
|
};
|
|
16
|
+
/**
|
|
17
|
+
* This is really just required so we don't show things like "Join team" if the team is member invite and it should say "Request to join team"
|
|
18
|
+
*/
|
|
13
19
|
export declare const inviteOnlyPermissions: (permission: TeamPermission | undefined) => {
|
|
14
20
|
REQUEST_TO_JOIN: boolean;
|
|
15
21
|
CANCEL_JOIN_REQUEST: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/teams-client",
|
|
3
|
-
"version": "4.32.
|
|
3
|
+
"version": "4.32.3",
|
|
4
4
|
"description": "A client to retrieve team related data",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -8,6 +8,13 @@
|
|
|
8
8
|
"registry": "https://registry.npmjs.org/"
|
|
9
9
|
},
|
|
10
10
|
"atlassian": {
|
|
11
|
+
"react-compiler": {
|
|
12
|
+
"enabled": true,
|
|
13
|
+
"gating": {
|
|
14
|
+
"source": "@atlassian/react-compiler-gating",
|
|
15
|
+
"importSpecifierName": "isReactCompilerActivePlatform"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
11
18
|
"team": "People and Teams Collective"
|
|
12
19
|
},
|
|
13
20
|
"repository": "https://bitbucket.org/atlassian/atlassian-frontend-monorepo",
|
|
@@ -49,6 +56,7 @@
|
|
|
49
56
|
"@atlaskit/feature-gate-js-client": "^5.5.0",
|
|
50
57
|
"@atlassian/codegen": "^0.1.0",
|
|
51
58
|
"@atlassian/ptc-test-utils": "^0.12.0",
|
|
59
|
+
"@atlassian/react-compiler-gating": "workspace:^",
|
|
52
60
|
"@testing-library/react": "^16.3.0",
|
|
53
61
|
"@types/faker": "^4.1.8",
|
|
54
62
|
"react-dom": "^18.2.0",
|
|
@@ -96,6 +104,9 @@
|
|
|
96
104
|
},
|
|
97
105
|
"teams-app_client_fix-invalid-ari": {
|
|
98
106
|
"type": "boolean"
|
|
107
|
+
},
|
|
108
|
+
"ptc-enable-team-type-permission-enabled": {
|
|
109
|
+
"type": "boolean"
|
|
99
110
|
}
|
|
100
111
|
}
|
|
101
112
|
}
|