@frontegg/redux-store 6.136.0-alpha.6 → 6.136.0-alpha.8
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/auth/Security/SecurityCenterState/index.d.ts +5 -2
- package/auth/Security/SecurityCenterState/index.js +14 -1
- package/auth/Security/SecurityCenterState/interfaces.d.ts +2 -1
- package/auth/Security/SecurityCenterState/saga.d.ts +15 -1
- package/auth/Security/SecurityCenterState/saga.js +103 -2
- package/auth/Security/SecurityCenterState/types.d.ts +13 -1
- package/auth/Security/SecurityCenterState/types.js +1 -0
- package/auth/index.d.ts +1 -0
- package/auth/reducer.d.ts +1 -0
- package/index.js +1 -1
- package/node/auth/Security/SecurityCenterState/index.js +14 -1
- package/node/auth/Security/SecurityCenterState/saga.js +104 -0
- package/node/auth/Security/SecurityCenterState/types.js +1 -0
- package/node/index.js +1 -1
- package/package.json +2 -2
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { WithCallback } from '../../../interfaces';
|
|
2
2
|
import { SecurityCenterState } from './interfaces';
|
|
3
3
|
import { SecurityCenterStateIndicator } from './types';
|
|
4
|
+
import { ISearchUserQueryParamsV3 } from '@frontegg/rest-api';
|
|
4
5
|
declare const securityCenterState: SecurityCenterState;
|
|
5
6
|
declare const reducers: {
|
|
6
7
|
setSecurityCenterState: {
|
|
@@ -128,6 +129,7 @@ declare const actions: {
|
|
|
128
129
|
}], {
|
|
129
130
|
callback?: import("../../../interfaces").CallbackMethod<boolean> | undefined;
|
|
130
131
|
}, string, never, never>;
|
|
132
|
+
loadBreachedPasswordUsers: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[ISearchUserQueryParamsV3], ISearchUserQueryParamsV3, string, never, never>;
|
|
131
133
|
};
|
|
132
134
|
/**
|
|
133
135
|
* To be used for actions types after dispatch, and should contains
|
|
@@ -136,11 +138,12 @@ declare const actions: {
|
|
|
136
138
|
declare type DispatchedActions = {
|
|
137
139
|
setSecurityCenterState: (state: Partial<SecurityCenterState>) => void;
|
|
138
140
|
resetSecurityCenterState: () => void;
|
|
141
|
+
setSecurityCenterStateLoader: (payload: SecurityCenterStateIndicator) => void;
|
|
142
|
+
setSecurityCenterStateError: (payload: SecurityCenterStateIndicator) => void;
|
|
139
143
|
loadRecommendations: () => void;
|
|
140
144
|
loadInsights: () => void;
|
|
141
145
|
sendResetBreachedPasswordEmails: (payload: WithCallback) => void;
|
|
142
|
-
|
|
143
|
-
setSecurityCenterStateError: (payload: SecurityCenterStateIndicator) => void;
|
|
146
|
+
loadBreachedPasswordUsers: (payload: ISearchUserQueryParamsV3) => void;
|
|
144
147
|
};
|
|
145
148
|
export declare type SecurityCenterActions = DispatchedActions;
|
|
146
149
|
export { securityCenterState, reducers as securityCenterReducers, actions as securityCenterActions };
|
|
@@ -6,7 +6,17 @@ const securityCenterState = {
|
|
|
6
6
|
errors: {},
|
|
7
7
|
recommendations: undefined,
|
|
8
8
|
insights: undefined,
|
|
9
|
-
score: 0
|
|
9
|
+
score: 0,
|
|
10
|
+
breachedPasswordUsersTable: {
|
|
11
|
+
users: [],
|
|
12
|
+
usersPageOffset: 0,
|
|
13
|
+
totalUsersItems: 0,
|
|
14
|
+
totalUsersPages: 0,
|
|
15
|
+
queryParams: {
|
|
16
|
+
_offset: 0,
|
|
17
|
+
_limit: 10
|
|
18
|
+
}
|
|
19
|
+
}
|
|
10
20
|
};
|
|
11
21
|
const reducers = {
|
|
12
22
|
setSecurityCenterState: typeReducerForKey('securityCenterState'),
|
|
@@ -21,6 +31,9 @@ const actions = {
|
|
|
21
31
|
loadInsights: createAction(`${authStoreName}/loadInsights`),
|
|
22
32
|
sendResetBreachedPasswordEmails: createAction(`${authStoreName}/sendResetBreachedPasswordEmails`, payload => ({
|
|
23
33
|
payload
|
|
34
|
+
})),
|
|
35
|
+
loadBreachedPasswordUsers: createAction(`${authStoreName}/loadBreachedPasswordUsers`, payload => ({
|
|
36
|
+
payload
|
|
24
37
|
}))
|
|
25
38
|
};
|
|
26
39
|
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { Insight, Recommendation } from '@frontegg/rest-api';
|
|
2
2
|
import { ErrorsIndicatorState, LoaderIndicatorState } from '../../../interfaces';
|
|
3
|
-
import { SecurityCenterStateKeys } from './types';
|
|
3
|
+
import { ISecurityCenterTable, SecurityCenterStateKeys } from './types';
|
|
4
4
|
export interface SecurityCenterState {
|
|
5
5
|
loaders: LoaderIndicatorState<SecurityCenterStateKeys>;
|
|
6
6
|
errors: ErrorsIndicatorState<SecurityCenterStateKeys>;
|
|
7
7
|
recommendations?: Recommendation[];
|
|
8
8
|
insights?: Insight[];
|
|
9
9
|
score: number;
|
|
10
|
+
breachedPasswordUsersTable: ISecurityCenterTable;
|
|
10
11
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { GetRecommendationsResponse, GetInsightsResponse } from '@frontegg/rest-api';
|
|
1
|
+
import { GetRecommendationsResponse, GetInsightsResponse, ISearchUserQueryParamsV3, FronteggPaginationWrapper, IRole, GetUserRolesResponse, IBaseGetUserResponse } from '@frontegg/rest-api';
|
|
2
|
+
import { ISecurityCenterTable, TUser } from './types';
|
|
2
3
|
import { PayloadAction, WithCallback } from '../../../index';
|
|
3
4
|
/**
|
|
4
5
|
* This function is used to wrap sagas of the security page.
|
|
@@ -40,6 +41,19 @@ export declare function sendResetBreachedPasswordEmails({ payload: { callback }
|
|
|
40
41
|
payload: import("./types").SecurityCenterStateIndicator;
|
|
41
42
|
type: string;
|
|
42
43
|
}> | import("redux-saga/effects").CallEffect<void>, void, unknown>;
|
|
44
|
+
/**
|
|
45
|
+
* This function gets users as we got from getUsersV3,
|
|
46
|
+
* and returns the combined object of those users with their roles.
|
|
47
|
+
* @param users - array of users
|
|
48
|
+
*/
|
|
49
|
+
export declare function getUsersWithRoles(users: IBaseGetUserResponse[]): Generator<import("redux-saga/effects").CallEffect<IRole[]> | import("redux-saga/effects").CallEffect<GetUserRolesResponse[]>, TUser[], IRole[] & GetUserRolesResponse[]>;
|
|
50
|
+
export declare function loadBreachedPasswordUsers({ payload }: PayloadAction<ISearchUserQueryParamsV3>): Generator<import("redux-saga/effects").SelectEffect | import("redux-saga/effects").PutEffect<{
|
|
51
|
+
payload: import("./types").SecurityCenterStateIndicator;
|
|
52
|
+
type: string;
|
|
53
|
+
}> | import("redux-saga/effects").PutEffect<{
|
|
54
|
+
payload: Partial<import("./interfaces").SecurityCenterState>;
|
|
55
|
+
type: string;
|
|
56
|
+
}> | Generator<import("redux-saga/effects").CallEffect<IRole[]> | import("redux-saga/effects").CallEffect<GetUserRolesResponse[]>, TUser[], IRole[] & GetUserRolesResponse[]> | import("redux-saga/effects").CallEffect<FronteggPaginationWrapper<IBaseGetUserResponse>>, void, ISecurityCenterTable & FronteggPaginationWrapper<IBaseGetUserResponse> & TUser[]>;
|
|
43
57
|
export declare function securityCenterSagas(): Generator<import("redux-saga/effects").ForkEffect<never>, void, unknown>;
|
|
44
58
|
export declare function loadRecommendationsMock(): Generator<import("redux-saga/effects").PutEffect<{
|
|
45
59
|
payload: import("./types").SecurityCenterStateIndicator;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import { call, delay, put, takeEvery, select } from 'redux-saga/effects';
|
|
2
3
|
import { actions } from '../../reducer';
|
|
3
4
|
import { errorHandler } from '../../../utils';
|
|
4
|
-
import { api } from '@frontegg/rest-api';
|
|
5
|
+
import { api, GetUsersFilterPreset } from '@frontegg/rest-api';
|
|
5
6
|
import { SecurityCenterStateKeys } from './types';
|
|
6
7
|
import { getFeatureFlags } from '../../../index';
|
|
7
8
|
import { securityCenterInsightsMock, securityCenterRecommendationsMock } from '../../dummy';
|
|
@@ -108,10 +109,110 @@ export function* sendResetBreachedPasswordEmails({
|
|
|
108
109
|
}));
|
|
109
110
|
}
|
|
110
111
|
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* This function gets users as we got from getUsersV3,
|
|
115
|
+
* and returns the combined object of those users with their roles.
|
|
116
|
+
* @param users - array of users
|
|
117
|
+
*/
|
|
118
|
+
export function* getUsersWithRoles(users) {
|
|
119
|
+
const usersIds = users.map(user => user.id);
|
|
120
|
+
const allRoles = yield call(api.roles.getRoles);
|
|
121
|
+
const usersRoles = yield call(api.users.getUsersRoles, {
|
|
122
|
+
ids: usersIds
|
|
123
|
+
});
|
|
124
|
+
const usersWithRoles = users.map(user => {
|
|
125
|
+
var _usersRoles$find, _ref;
|
|
126
|
+
const userRolesIds = usersRoles == null ? void 0 : (_usersRoles$find = usersRoles.find(role => role.userId === user.id)) == null ? void 0 : _usersRoles$find.roleIds;
|
|
127
|
+
return _extends({}, user, {
|
|
128
|
+
roles: (_ref = userRolesIds == null ? void 0 : userRolesIds.map(roleId => {
|
|
129
|
+
var _allRoles$find;
|
|
130
|
+
return (_allRoles$find = allRoles == null ? void 0 : allRoles.find(role => role.id === roleId)) != null ? _allRoles$find : [];
|
|
131
|
+
})) != null ? _ref : []
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
return usersWithRoles;
|
|
135
|
+
}
|
|
136
|
+
export function* loadBreachedPasswordUsers({
|
|
137
|
+
payload
|
|
138
|
+
}) {
|
|
139
|
+
var _select, _ref2, _payload$_offset, _breachedPasswordUser, _ref3, _payload$_limit, _breachedPasswordUser2;
|
|
140
|
+
const key = SecurityCenterStateKeys.BREACHED_PASSWORD_USERS_TABLE;
|
|
141
|
+
yield put(actions.setSecurityCenterStateError({
|
|
142
|
+
key,
|
|
143
|
+
value: false
|
|
144
|
+
}));
|
|
145
|
+
yield put(actions.setSecurityCenterStateLoader({
|
|
146
|
+
key,
|
|
147
|
+
value: true
|
|
148
|
+
}));
|
|
149
|
+
const breachedPasswordUsersTable = yield (_select = select(state => {
|
|
150
|
+
var _state$auth$securityC;
|
|
151
|
+
return (_state$auth$securityC = state.auth.securityCenterState) == null ? void 0 : _state$auth$securityC.breachedPasswordUsersTable;
|
|
152
|
+
})) != null ? _select : {};
|
|
153
|
+
const _offset = (_ref2 = (_payload$_offset = payload == null ? void 0 : payload._offset) != null ? _payload$_offset : breachedPasswordUsersTable == null ? void 0 : (_breachedPasswordUser = breachedPasswordUsersTable.queryParams) == null ? void 0 : _breachedPasswordUser._offset) != null ? _ref2 : 0;
|
|
154
|
+
const _limit = (_ref3 = (_payload$_limit = payload == null ? void 0 : payload._limit) != null ? _payload$_limit : breachedPasswordUsersTable == null ? void 0 : (_breachedPasswordUser2 = breachedPasswordUsersTable.queryParams) == null ? void 0 : _breachedPasswordUser2._limit) != null ? _ref3 : 10;
|
|
155
|
+
const {
|
|
156
|
+
_email
|
|
157
|
+
} = payload;
|
|
158
|
+
const breachedPasswordUsersQueryParams = _extends({
|
|
159
|
+
_offset,
|
|
160
|
+
_limit,
|
|
161
|
+
_includeSubTenants: false,
|
|
162
|
+
_preset: GetUsersFilterPreset.BREACHED_PASSWORDS
|
|
163
|
+
}, !!_email && {
|
|
164
|
+
_email
|
|
165
|
+
});
|
|
166
|
+
try {
|
|
167
|
+
const {
|
|
168
|
+
items: usersItems,
|
|
169
|
+
_metadata: {
|
|
170
|
+
totalItems,
|
|
171
|
+
totalPages
|
|
172
|
+
}
|
|
173
|
+
} = yield call(api.users.getUsersV3, breachedPasswordUsersQueryParams);
|
|
174
|
+
const breachedPasswordUsersTableStateObj = {
|
|
175
|
+
totalUsersItems: totalItems,
|
|
176
|
+
totalUsersPages: totalPages,
|
|
177
|
+
usersPageOffset: _offset,
|
|
178
|
+
queryParams: _extends({
|
|
179
|
+
_offset,
|
|
180
|
+
_limit
|
|
181
|
+
}, !!_email && {
|
|
182
|
+
_email
|
|
183
|
+
})
|
|
184
|
+
};
|
|
185
|
+
if (usersItems.length) {
|
|
186
|
+
const usersWithRoles = yield getUsersWithRoles(usersItems);
|
|
187
|
+
yield put(actions.setSecurityCenterState({
|
|
188
|
+
breachedPasswordUsersTable: _extends({
|
|
189
|
+
users: usersWithRoles
|
|
190
|
+
}, breachedPasswordUsersTableStateObj)
|
|
191
|
+
}));
|
|
192
|
+
} else {
|
|
193
|
+
yield put(actions.setSecurityCenterState({
|
|
194
|
+
breachedPasswordUsersTable: _extends({
|
|
195
|
+
users: []
|
|
196
|
+
}, breachedPasswordUsersTableStateObj)
|
|
197
|
+
}));
|
|
198
|
+
}
|
|
199
|
+
} catch (e) {
|
|
200
|
+
yield put(actions.setSecurityCenterStateError({
|
|
201
|
+
key,
|
|
202
|
+
value: errorHandler(e)
|
|
203
|
+
}));
|
|
204
|
+
} finally {
|
|
205
|
+
yield put(actions.setSecurityCenterStateLoader({
|
|
206
|
+
key,
|
|
207
|
+
value: false
|
|
208
|
+
}));
|
|
209
|
+
}
|
|
210
|
+
}
|
|
111
211
|
export function* securityCenterSagas() {
|
|
112
212
|
yield takeEvery(actions.loadRecommendations, loadRecommendations);
|
|
113
213
|
yield takeEvery(actions.loadInsights, loadInsights);
|
|
114
214
|
yield takeEvery(actions.sendResetBreachedPasswordEmails, sendResetBreachedPasswordEmails);
|
|
215
|
+
yield takeEvery(actions.loadBreachedPasswordUsers, loadBreachedPasswordUsers);
|
|
115
216
|
}
|
|
116
217
|
|
|
117
218
|
//MOCK SAGAS
|
|
@@ -1,9 +1,21 @@
|
|
|
1
|
+
import { IRole, ISearchUserQueryParamsV3, IUsersV3Data } from '@frontegg/rest-api';
|
|
1
2
|
export declare enum SecurityCenterStateKeys {
|
|
2
3
|
RECOMMENDATIONS = "recommendations",
|
|
3
4
|
INSIGHTS = "insights",
|
|
4
|
-
SEND_BULK_RESET_BREACHED_PASSWORD_EMAILS = "sendBulkResetBreachedPasswordEmails"
|
|
5
|
+
SEND_BULK_RESET_BREACHED_PASSWORD_EMAILS = "sendBulkResetBreachedPasswordEmails",
|
|
6
|
+
BREACHED_PASSWORD_USERS_TABLE = "breachedPasswordUsersTable"
|
|
5
7
|
}
|
|
6
8
|
export declare type SecurityCenterStateIndicator = {
|
|
7
9
|
key: SecurityCenterStateKeys;
|
|
8
10
|
value: boolean | string;
|
|
9
11
|
};
|
|
12
|
+
export declare type TUser = IUsersV3Data & {
|
|
13
|
+
roles?: IRole[];
|
|
14
|
+
};
|
|
15
|
+
export interface ISecurityCenterTable {
|
|
16
|
+
users?: TUser[];
|
|
17
|
+
totalUsersItems?: number;
|
|
18
|
+
totalUsersPages?: number;
|
|
19
|
+
usersPageOffset?: number;
|
|
20
|
+
queryParams?: ISearchUserQueryParamsV3;
|
|
21
|
+
}
|
|
@@ -3,4 +3,5 @@ export let SecurityCenterStateKeys;
|
|
|
3
3
|
SecurityCenterStateKeys["RECOMMENDATIONS"] = "recommendations";
|
|
4
4
|
SecurityCenterStateKeys["INSIGHTS"] = "insights";
|
|
5
5
|
SecurityCenterStateKeys["SEND_BULK_RESET_BREACHED_PASSWORD_EMAILS"] = "sendBulkResetBreachedPasswordEmails";
|
|
6
|
+
SecurityCenterStateKeys["BREACHED_PASSWORD_USERS_TABLE"] = "breachedPasswordUsersTable";
|
|
6
7
|
})(SecurityCenterStateKeys || (SecurityCenterStateKeys = {}));
|
package/auth/index.d.ts
CHANGED
|
@@ -77,6 +77,7 @@ declare const _default: {
|
|
|
77
77
|
}], {
|
|
78
78
|
callback?: import("..").CallbackMethod<boolean> | undefined;
|
|
79
79
|
}, string, never, never>;
|
|
80
|
+
loadBreachedPasswordUsers: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("@frontegg/rest-api").ISearchUserQueryParamsV3], import("@frontegg/rest-api").ISearchUserQueryParamsV3, string, never, never>;
|
|
80
81
|
loadAccounts: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("..").WithCallback<import("@frontegg/rest-api").SearchSubTenantsParams & {
|
|
81
82
|
_links?: import("@frontegg/rest-api").FronteggPaginationLinks | undefined;
|
|
82
83
|
} & import("./MSP/AllAccountsState").TUserJwtPayload, boolean>], import("..").WithCallback<import("@frontegg/rest-api").SearchSubTenantsParams & {
|
package/auth/reducer.d.ts
CHANGED
|
@@ -37,6 +37,7 @@ declare const actions: {
|
|
|
37
37
|
}], {
|
|
38
38
|
callback?: import("..").CallbackMethod<boolean> | undefined;
|
|
39
39
|
}, string, never, never>;
|
|
40
|
+
loadBreachedPasswordUsers: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("@frontegg/rest-api").ISearchUserQueryParamsV3], import("@frontegg/rest-api").ISearchUserQueryParamsV3, string, never, never>;
|
|
40
41
|
loadAccounts: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("..").WithCallback<import("@frontegg/rest-api").SearchSubTenantsParams & {
|
|
41
42
|
_links?: import("@frontegg/rest-api").FronteggPaginationLinks | undefined;
|
|
42
43
|
} & import("./MSP/AllAccountsState").TUserJwtPayload, boolean>], import("..").WithCallback<import("@frontegg/rest-api").SearchSubTenantsParams & {
|
package/index.js
CHANGED
|
@@ -12,7 +12,17 @@ const securityCenterState = {
|
|
|
12
12
|
errors: {},
|
|
13
13
|
recommendations: undefined,
|
|
14
14
|
insights: undefined,
|
|
15
|
-
score: 0
|
|
15
|
+
score: 0,
|
|
16
|
+
breachedPasswordUsersTable: {
|
|
17
|
+
users: [],
|
|
18
|
+
usersPageOffset: 0,
|
|
19
|
+
totalUsersItems: 0,
|
|
20
|
+
totalUsersPages: 0,
|
|
21
|
+
queryParams: {
|
|
22
|
+
_offset: 0,
|
|
23
|
+
_limit: 10
|
|
24
|
+
}
|
|
25
|
+
}
|
|
16
26
|
};
|
|
17
27
|
exports.securityCenterState = securityCenterState;
|
|
18
28
|
const reducers = {
|
|
@@ -29,6 +39,9 @@ const actions = {
|
|
|
29
39
|
loadInsights: (0, _toolkit.createAction)(`${_constants.authStoreName}/loadInsights`),
|
|
30
40
|
sendResetBreachedPasswordEmails: (0, _toolkit.createAction)(`${_constants.authStoreName}/sendResetBreachedPasswordEmails`, payload => ({
|
|
31
41
|
payload
|
|
42
|
+
})),
|
|
43
|
+
loadBreachedPasswordUsers: (0, _toolkit.createAction)(`${_constants.authStoreName}/loadBreachedPasswordUsers`, payload => ({
|
|
44
|
+
payload
|
|
32
45
|
}))
|
|
33
46
|
};
|
|
34
47
|
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
7
|
+
exports.getUsersWithRoles = getUsersWithRoles;
|
|
8
|
+
exports.loadBreachedPasswordUsers = loadBreachedPasswordUsers;
|
|
6
9
|
exports.loadInsights = loadInsights;
|
|
7
10
|
exports.loadInsightsMock = loadInsightsMock;
|
|
8
11
|
exports.loadRecommendations = loadRecommendations;
|
|
@@ -11,6 +14,7 @@ exports.securityCenterSagaWrapper = securityCenterSagaWrapper;
|
|
|
11
14
|
exports.securityCenterSagas = securityCenterSagas;
|
|
12
15
|
exports.securityCenterSagasMock = securityCenterSagasMock;
|
|
13
16
|
exports.sendResetBreachedPasswordEmails = sendResetBreachedPasswordEmails;
|
|
17
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
14
18
|
var _effects = require("redux-saga/effects");
|
|
15
19
|
var _reducer = require("../../reducer");
|
|
16
20
|
var _utils = require("../../../utils");
|
|
@@ -120,10 +124,110 @@ function* sendResetBreachedPasswordEmails({
|
|
|
120
124
|
}));
|
|
121
125
|
}
|
|
122
126
|
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* This function gets users as we got from getUsersV3,
|
|
130
|
+
* and returns the combined object of those users with their roles.
|
|
131
|
+
* @param users - array of users
|
|
132
|
+
*/
|
|
133
|
+
function* getUsersWithRoles(users) {
|
|
134
|
+
const usersIds = users.map(user => user.id);
|
|
135
|
+
const allRoles = yield (0, _effects.call)(_restApi.api.roles.getRoles);
|
|
136
|
+
const usersRoles = yield (0, _effects.call)(_restApi.api.users.getUsersRoles, {
|
|
137
|
+
ids: usersIds
|
|
138
|
+
});
|
|
139
|
+
const usersWithRoles = users.map(user => {
|
|
140
|
+
var _usersRoles$find, _ref;
|
|
141
|
+
const userRolesIds = usersRoles == null ? void 0 : (_usersRoles$find = usersRoles.find(role => role.userId === user.id)) == null ? void 0 : _usersRoles$find.roleIds;
|
|
142
|
+
return (0, _extends2.default)({}, user, {
|
|
143
|
+
roles: (_ref = userRolesIds == null ? void 0 : userRolesIds.map(roleId => {
|
|
144
|
+
var _allRoles$find;
|
|
145
|
+
return (_allRoles$find = allRoles == null ? void 0 : allRoles.find(role => role.id === roleId)) != null ? _allRoles$find : [];
|
|
146
|
+
})) != null ? _ref : []
|
|
147
|
+
});
|
|
148
|
+
});
|
|
149
|
+
return usersWithRoles;
|
|
150
|
+
}
|
|
151
|
+
function* loadBreachedPasswordUsers({
|
|
152
|
+
payload
|
|
153
|
+
}) {
|
|
154
|
+
var _select, _ref2, _payload$_offset, _breachedPasswordUser, _ref3, _payload$_limit, _breachedPasswordUser2;
|
|
155
|
+
const key = _types.SecurityCenterStateKeys.BREACHED_PASSWORD_USERS_TABLE;
|
|
156
|
+
yield (0, _effects.put)(_reducer.actions.setSecurityCenterStateError({
|
|
157
|
+
key,
|
|
158
|
+
value: false
|
|
159
|
+
}));
|
|
160
|
+
yield (0, _effects.put)(_reducer.actions.setSecurityCenterStateLoader({
|
|
161
|
+
key,
|
|
162
|
+
value: true
|
|
163
|
+
}));
|
|
164
|
+
const breachedPasswordUsersTable = yield (_select = (0, _effects.select)(state => {
|
|
165
|
+
var _state$auth$securityC;
|
|
166
|
+
return (_state$auth$securityC = state.auth.securityCenterState) == null ? void 0 : _state$auth$securityC.breachedPasswordUsersTable;
|
|
167
|
+
})) != null ? _select : {};
|
|
168
|
+
const _offset = (_ref2 = (_payload$_offset = payload == null ? void 0 : payload._offset) != null ? _payload$_offset : breachedPasswordUsersTable == null ? void 0 : (_breachedPasswordUser = breachedPasswordUsersTable.queryParams) == null ? void 0 : _breachedPasswordUser._offset) != null ? _ref2 : 0;
|
|
169
|
+
const _limit = (_ref3 = (_payload$_limit = payload == null ? void 0 : payload._limit) != null ? _payload$_limit : breachedPasswordUsersTable == null ? void 0 : (_breachedPasswordUser2 = breachedPasswordUsersTable.queryParams) == null ? void 0 : _breachedPasswordUser2._limit) != null ? _ref3 : 10;
|
|
170
|
+
const {
|
|
171
|
+
_email
|
|
172
|
+
} = payload;
|
|
173
|
+
const breachedPasswordUsersQueryParams = (0, _extends2.default)({
|
|
174
|
+
_offset,
|
|
175
|
+
_limit,
|
|
176
|
+
_includeSubTenants: false,
|
|
177
|
+
_preset: _restApi.GetUsersFilterPreset.BREACHED_PASSWORDS
|
|
178
|
+
}, !!_email && {
|
|
179
|
+
_email
|
|
180
|
+
});
|
|
181
|
+
try {
|
|
182
|
+
const {
|
|
183
|
+
items: usersItems,
|
|
184
|
+
_metadata: {
|
|
185
|
+
totalItems,
|
|
186
|
+
totalPages
|
|
187
|
+
}
|
|
188
|
+
} = yield (0, _effects.call)(_restApi.api.users.getUsersV3, breachedPasswordUsersQueryParams);
|
|
189
|
+
const breachedPasswordUsersTableStateObj = {
|
|
190
|
+
totalUsersItems: totalItems,
|
|
191
|
+
totalUsersPages: totalPages,
|
|
192
|
+
usersPageOffset: _offset,
|
|
193
|
+
queryParams: (0, _extends2.default)({
|
|
194
|
+
_offset,
|
|
195
|
+
_limit
|
|
196
|
+
}, !!_email && {
|
|
197
|
+
_email
|
|
198
|
+
})
|
|
199
|
+
};
|
|
200
|
+
if (usersItems.length) {
|
|
201
|
+
const usersWithRoles = yield getUsersWithRoles(usersItems);
|
|
202
|
+
yield (0, _effects.put)(_reducer.actions.setSecurityCenterState({
|
|
203
|
+
breachedPasswordUsersTable: (0, _extends2.default)({
|
|
204
|
+
users: usersWithRoles
|
|
205
|
+
}, breachedPasswordUsersTableStateObj)
|
|
206
|
+
}));
|
|
207
|
+
} else {
|
|
208
|
+
yield (0, _effects.put)(_reducer.actions.setSecurityCenterState({
|
|
209
|
+
breachedPasswordUsersTable: (0, _extends2.default)({
|
|
210
|
+
users: []
|
|
211
|
+
}, breachedPasswordUsersTableStateObj)
|
|
212
|
+
}));
|
|
213
|
+
}
|
|
214
|
+
} catch (e) {
|
|
215
|
+
yield (0, _effects.put)(_reducer.actions.setSecurityCenterStateError({
|
|
216
|
+
key,
|
|
217
|
+
value: (0, _utils.errorHandler)(e)
|
|
218
|
+
}));
|
|
219
|
+
} finally {
|
|
220
|
+
yield (0, _effects.put)(_reducer.actions.setSecurityCenterStateLoader({
|
|
221
|
+
key,
|
|
222
|
+
value: false
|
|
223
|
+
}));
|
|
224
|
+
}
|
|
225
|
+
}
|
|
123
226
|
function* securityCenterSagas() {
|
|
124
227
|
yield (0, _effects.takeEvery)(_reducer.actions.loadRecommendations, loadRecommendations);
|
|
125
228
|
yield (0, _effects.takeEvery)(_reducer.actions.loadInsights, loadInsights);
|
|
126
229
|
yield (0, _effects.takeEvery)(_reducer.actions.sendResetBreachedPasswordEmails, sendResetBreachedPasswordEmails);
|
|
230
|
+
yield (0, _effects.takeEvery)(_reducer.actions.loadBreachedPasswordUsers, loadBreachedPasswordUsers);
|
|
127
231
|
}
|
|
128
232
|
|
|
129
233
|
//MOCK SAGAS
|
|
@@ -10,4 +10,5 @@ exports.SecurityCenterStateKeys = SecurityCenterStateKeys;
|
|
|
10
10
|
SecurityCenterStateKeys["RECOMMENDATIONS"] = "recommendations";
|
|
11
11
|
SecurityCenterStateKeys["INSIGHTS"] = "insights";
|
|
12
12
|
SecurityCenterStateKeys["SEND_BULK_RESET_BREACHED_PASSWORD_EMAILS"] = "sendBulkResetBreachedPasswordEmails";
|
|
13
|
+
SecurityCenterStateKeys["BREACHED_PASSWORD_USERS_TABLE"] = "breachedPasswordUsersTable";
|
|
13
14
|
})(SecurityCenterStateKeys || (exports.SecurityCenterStateKeys = SecurityCenterStateKeys = {}));
|
package/node/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontegg/redux-store",
|
|
3
|
-
"version": "6.136.0-alpha.
|
|
3
|
+
"version": "6.136.0-alpha.8",
|
|
4
4
|
"main": "./node/index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Frontegg LTD",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@babel/runtime": "^7.18.6",
|
|
9
|
-
"@frontegg/rest-api": "3.1.
|
|
9
|
+
"@frontegg/rest-api": "3.1.13",
|
|
10
10
|
"@reduxjs/toolkit": "1.8.5",
|
|
11
11
|
"fast-deep-equal": "3.1.3",
|
|
12
12
|
"redux-saga": "^1.2.1",
|