-
Notifications
You must be signed in to change notification settings - Fork 185
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Feedback: - Search the User on authentication failure * Improvement - WIP: - Order log by DESC * Review: - Use ObjectManager instead of UserRepository - Remove previously created function and use findByName instead * Improvement logs security - WIP: - Add a tab for the current user with his security logs * Improvement logs security: - add list of logs from current user * Review : - Change function name - Remove useless finder's property - Initialize the default sort in UI
- Loading branch information
Showing
15 changed files
with
225 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
src/main/core/Resources/modules/account/security/components/list.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import React from 'react' | ||
import {PropTypes as T} from 'prop-types' | ||
|
||
import {trans} from '#/main/app/intl/translation' | ||
import {ListData} from '#/main/app/content/list/containers/data' | ||
|
||
const SecurityLogList = (props) => | ||
<ListData | ||
name={props.name} | ||
fetch={{ | ||
url: props.url, | ||
autoload: true | ||
}} | ||
definition={[ | ||
{ | ||
name: 'doer', | ||
type: 'user', | ||
label: trans('user'), | ||
displayed: true | ||
}, { | ||
name: 'date', | ||
label: trans('date'), | ||
type: 'date', | ||
options: {time: true}, | ||
displayed: true | ||
}, { | ||
name: 'details', | ||
type: 'string', | ||
label: trans('details'), | ||
displayed: true | ||
}, { | ||
name: 'target', | ||
type: 'user', | ||
label: trans('target'), | ||
displayed: false | ||
}, { | ||
name: 'event', | ||
type: 'translation', | ||
label: trans('event'), | ||
displayed: false, | ||
options: { | ||
domain: 'security' | ||
} | ||
} | ||
]} | ||
/> | ||
|
||
SecurityLogList.propTypes = { | ||
name: T.string.isRequired, | ||
url: T.oneOfType([T.string, T.array]), | ||
definition: T.array | ||
} | ||
|
||
SecurityLogList.defaultProps = { | ||
url: ['apiv2_logs_security_list_current'], | ||
definition: [] | ||
} | ||
|
||
export { | ||
SecurityLogList | ||
} |
49 changes: 49 additions & 0 deletions
49
src/main/core/Resources/modules/account/security/components/main.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import React from 'react' | ||
import {PropTypes as T} from 'prop-types' | ||
|
||
import {trans} from '#/main/app/intl/translation' | ||
import {LINK_BUTTON} from '#/main/app/buttons' | ||
import {showBreadcrumb} from '#/main/app/layout/utils' | ||
|
||
import {UserPage} from '#/main/core/user/components/page' | ||
import {User as UserTypes} from '#/main/core/user/prop-types' | ||
import {selectors} from '#/main/core/account/security/store/selectors' | ||
import {SecurityLogList} from '#/main/core/account/security/components/list' | ||
|
||
const SecurityMain = (props) => | ||
<UserPage | ||
showBreadcrumb={showBreadcrumb()} | ||
breadcrumb={[ | ||
{ | ||
type: LINK_BUTTON, | ||
label: trans('my_account'), | ||
target: '/account' | ||
}, { | ||
type: LINK_BUTTON, | ||
label: trans('security'), | ||
target: '/account/security' | ||
} | ||
]} | ||
title={trans('security')} | ||
user={props.currentUser} | ||
> | ||
<div style={{ | ||
marginTop: 60 // TODO : manage spacing correctly | ||
}}> | ||
<SecurityLogList | ||
name={selectors.STORE_NAME} | ||
url={['apiv2_logs_security_list_current']} | ||
/> | ||
</div> | ||
|
||
</UserPage> | ||
|
||
SecurityMain.propTypes = { | ||
currentUser: T.shape( | ||
UserTypes.propTypes | ||
).isRequired | ||
} | ||
|
||
export { | ||
SecurityMain | ||
} |
19 changes: 19 additions & 0 deletions
19
src/main/core/Resources/modules/account/security/containers/main.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import {connect} from 'react-redux' | ||
|
||
import {withReducer} from '#/main/app/store/components/withReducer' | ||
import {selectors as securitySelectors} from '#/main/app/security/store' | ||
|
||
import {reducer, selectors} from '#/main/core/account/security/store' | ||
import {SecurityMain as SecurityMainComponent} from '#/main/core/account/security/components/main' | ||
|
||
const SecurityMain = withReducer(selectors.STORE_NAME, reducer)( | ||
connect( | ||
(state) => ({ | ||
currentUser: securitySelectors.currentUser(state) | ||
}) | ||
)(SecurityMainComponent) | ||
) | ||
|
||
export { | ||
SecurityMain | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import {trans} from '#/main/app/intl/translation' | ||
|
||
import {SecurityMain} from '#/main/core/account/security/containers/main' | ||
|
||
export default { | ||
name: 'security', | ||
icon: 'fa fa-fw fa-shield', | ||
label: trans('security'), | ||
component: SecurityMain | ||
} |
7 changes: 7 additions & 0 deletions
7
src/main/core/Resources/modules/account/security/store/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import {reducer} from '#/main/core/account/security/store/reducer' | ||
import {selectors} from '#/main/core/account/security/store/selectors' | ||
|
||
export { | ||
reducer, | ||
selectors | ||
} |
11 changes: 11 additions & 0 deletions
11
src/main/core/Resources/modules/account/security/store/reducer.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import {makeListReducer} from '#/main/app/content/list/store' | ||
|
||
import {selectors} from '#/main/core/account/security/store/selectors' | ||
|
||
const reducer = makeListReducer(selectors.STORE_NAME, { | ||
sortBy: {property: 'date', direction: -1} | ||
}) | ||
|
||
export { | ||
reducer | ||
} |
6 changes: 6 additions & 0 deletions
6
src/main/core/Resources/modules/account/security/store/selectors.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
const STORE_NAME = 'accountSecurity' | ||
|
||
export const selectors = { | ||
STORE_NAME | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters