2019-08-31 04:07:25 +05:00
|
|
|
import { bindActionCreators } from 'redux';
|
|
|
|
import { connect } from 'react-redux';
|
|
|
|
|
2022-08-04 13:31:14 +02:00
|
|
|
import selectors from '../selectors';
|
|
|
|
import entryActions from '../entry-actions';
|
2019-08-31 04:07:25 +05:00
|
|
|
import UsersModal from '../components/UsersModal';
|
|
|
|
|
2020-03-25 00:15:47 +05:00
|
|
|
const mapStateToProps = (state) => {
|
2024-02-01 00:31:15 +01:00
|
|
|
const oidcConfig = selectors.selectOidcConfig(state);
|
2022-08-04 13:31:14 +02:00
|
|
|
const users = selectors.selectUsersExceptCurrent(state);
|
2019-08-31 04:07:25 +05:00
|
|
|
|
|
|
|
return {
|
2021-06-24 01:05:22 +05:00
|
|
|
items: users,
|
2024-02-01 00:31:15 +01:00
|
|
|
canAdd: !oidcConfig || !oidcConfig.isEnforced,
|
2019-08-31 04:07:25 +05:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2020-03-25 00:15:47 +05:00
|
|
|
const mapDispatchToProps = (dispatch) =>
|
2020-02-03 18:42:31 +05:00
|
|
|
bindActionCreators(
|
|
|
|
{
|
2022-08-04 13:31:14 +02:00
|
|
|
onUpdate: entryActions.updateUser,
|
|
|
|
onUsernameUpdate: entryActions.updateUserUsername,
|
|
|
|
onUsernameUpdateMessageDismiss: entryActions.clearUserUsernameUpdateError,
|
|
|
|
onEmailUpdate: entryActions.updateUserEmail,
|
|
|
|
onEmailUpdateMessageDismiss: entryActions.clearUserEmailUpdateError,
|
|
|
|
onPasswordUpdate: entryActions.updateUserPassword,
|
|
|
|
onPasswordUpdateMessageDismiss: entryActions.clearUserPasswordUpdateError,
|
|
|
|
onDelete: entryActions.deleteUser,
|
|
|
|
onClose: entryActions.closeModal,
|
2020-02-03 18:42:31 +05:00
|
|
|
},
|
|
|
|
dispatch,
|
|
|
|
);
|
2019-08-31 04:07:25 +05:00
|
|
|
|
2020-02-03 18:42:31 +05:00
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(UsersModal);
|