mirror of https://gitee.com/topiam/eiam
✨ 新增控制台解锁用户功能
parent
299643b7f4
commit
a8b6bda920
|
@ -107,6 +107,11 @@ public class AccountEventType {
|
|||
public static Type MODIFY_USER_PASSWORD = new Type(
|
||||
"eiam:event:account:update_password", "修改密码", ORG_ACCOUNT_RESOURCE, List.of(ADMIN));
|
||||
|
||||
/**
|
||||
* 解锁用户
|
||||
*/
|
||||
public static Type UNLOCK_USER = new Type(
|
||||
"eiam:event:account:unlock_user", "解锁用户", ORG_ACCOUNT_RESOURCE, List.of(ADMIN));
|
||||
/**
|
||||
* 创建用户组
|
||||
*/
|
||||
|
|
|
@ -114,7 +114,10 @@ public enum EventType {
|
|||
* 修改密码
|
||||
*/
|
||||
MODIFY_USER_PASSWORD(AccountEventType.MODIFY_USER_PASSWORD),
|
||||
|
||||
/**
|
||||
* 解锁用户
|
||||
*/
|
||||
UNLOCK_USER(AccountEventType.UNLOCK_USER),
|
||||
/**
|
||||
* 修改账户信息
|
||||
*/
|
||||
|
|
|
@ -247,13 +247,14 @@ export default (props: UserListProps) => {
|
|||
{
|
||||
title: intl.formatMessage({ id: 'pages.account.user_list.user.columns.option' }),
|
||||
valueType: 'option',
|
||||
width: 110,
|
||||
width: 120,
|
||||
align: 'center',
|
||||
fixed: 'right',
|
||||
render: (_text: any, row: AccountAPI.ListUser) => {
|
||||
return [
|
||||
...[
|
||||
(row.status === 'locked' ||
|
||||
return (
|
||||
<Space>
|
||||
{/*锁定*/}
|
||||
{(row.status === 'locked' ||
|
||||
row.status === 'expired_locked' ||
|
||||
row.status === 'password_expired_locked') && (
|
||||
<a
|
||||
|
@ -285,8 +286,9 @@ export default (props: UserListProps) => {
|
|||
>
|
||||
{intl.formatMessage({ id: 'pages.account.user_list.user.columns.option.unlock' })}
|
||||
</a>
|
||||
),
|
||||
row.status === 'enabled' ? (
|
||||
)}
|
||||
{/*启用*/}
|
||||
{row.status === 'enabled' && (
|
||||
<Popconfirm
|
||||
title={intl.formatMessage({
|
||||
id: 'pages.account.user_list.user.columns.option.disable.popconfirm',
|
||||
|
@ -315,7 +317,9 @@ export default (props: UserListProps) => {
|
|||
{intl.formatMessage({ id: 'app.disable' })}
|
||||
</a>
|
||||
</Popconfirm>
|
||||
) : (
|
||||
)}
|
||||
{/*禁用*/}
|
||||
{row.status === 'disabled' && (
|
||||
<Popconfirm
|
||||
title={intl.formatMessage({
|
||||
id: 'pages.account.user_list.user.columns.option.enable.popconfirm',
|
||||
|
@ -336,70 +340,72 @@ export default (props: UserListProps) => {
|
|||
>
|
||||
<a key="enabled">{intl.formatMessage({ id: 'app.enable' })}</a>
|
||||
</Popconfirm>
|
||||
),
|
||||
],
|
||||
<a
|
||||
key={'update'}
|
||||
onClick={() => {
|
||||
setId(row.id);
|
||||
setUpdateUserVisible(true);
|
||||
}}
|
||||
>
|
||||
{intl.formatMessage({ id: 'app.update' })}
|
||||
</a>,
|
||||
<TableDropdown
|
||||
key={'dropdown'}
|
||||
onSelect={(key) => {
|
||||
if (key === 'reset-password') {
|
||||
)}
|
||||
{/*更新*/}
|
||||
<a
|
||||
key={'update'}
|
||||
onClick={() => {
|
||||
setId(row.id);
|
||||
setResetPasswordVisible(true);
|
||||
}
|
||||
}}
|
||||
menus={[
|
||||
{
|
||||
key: 'delete',
|
||||
name: (
|
||||
<Popconfirm
|
||||
title={intl.formatMessage({
|
||||
id: 'pages.account.user_list.user.columns.option.delete.popconfirm',
|
||||
})}
|
||||
placement="bottomRight"
|
||||
icon={
|
||||
<QuestionCircleOutlined
|
||||
style={{
|
||||
color: 'red',
|
||||
}}
|
||||
/>
|
||||
}
|
||||
onConfirm={async () => {
|
||||
const { success } = await removeUser(row.id);
|
||||
if (success) {
|
||||
message.success(intl.formatMessage({ id: 'app.operation_success' }));
|
||||
actionRef.current?.reload();
|
||||
return;
|
||||
}
|
||||
}}
|
||||
okText={intl.formatMessage({ id: 'app.yes' })}
|
||||
cancelText={intl.formatMessage({ id: 'app.no' })}
|
||||
key="delete"
|
||||
>
|
||||
<a target="_blank" key="remove" style={{ color: 'red' }}>
|
||||
{intl.formatMessage({
|
||||
id: 'pages.account.user_list.user.columns.option.delete',
|
||||
setUpdateUserVisible(true);
|
||||
}}
|
||||
>
|
||||
{intl.formatMessage({ id: 'app.update' })}
|
||||
</a>
|
||||
{/*更多*/}
|
||||
<TableDropdown
|
||||
key={'dropdown'}
|
||||
onSelect={(key) => {
|
||||
if (key === 'reset-password') {
|
||||
setId(row.id);
|
||||
setResetPasswordVisible(true);
|
||||
}
|
||||
}}
|
||||
menus={[
|
||||
{
|
||||
key: 'delete',
|
||||
name: (
|
||||
<Popconfirm
|
||||
title={intl.formatMessage({
|
||||
id: 'pages.account.user_list.user.columns.option.delete.popconfirm',
|
||||
})}
|
||||
</a>
|
||||
</Popconfirm>
|
||||
),
|
||||
},
|
||||
{
|
||||
key: 'reset-password',
|
||||
name: intl.formatMessage({
|
||||
id: 'pages.account.user_list.user.columns.option.reset_password',
|
||||
}),
|
||||
},
|
||||
]}
|
||||
/>,
|
||||
];
|
||||
placement="bottomRight"
|
||||
icon={
|
||||
<QuestionCircleOutlined
|
||||
style={{
|
||||
color: 'red',
|
||||
}}
|
||||
/>
|
||||
}
|
||||
onConfirm={async () => {
|
||||
const { success } = await removeUser(row.id);
|
||||
if (success) {
|
||||
message.success(intl.formatMessage({ id: 'app.operation_success' }));
|
||||
actionRef.current?.reload();
|
||||
return;
|
||||
}
|
||||
}}
|
||||
okText={intl.formatMessage({ id: 'app.yes' })}
|
||||
cancelText={intl.formatMessage({ id: 'app.no' })}
|
||||
key="delete"
|
||||
>
|
||||
<a target="_blank" key="remove" style={{ color: 'red' }}>
|
||||
{intl.formatMessage({
|
||||
id: 'pages.account.user_list.user.columns.option.delete',
|
||||
})}
|
||||
</a>
|
||||
</Popconfirm>
|
||||
),
|
||||
},
|
||||
{
|
||||
key: 'reset-password',
|
||||
name: intl.formatMessage({
|
||||
id: 'pages.account.user_list.user.columns.option.reset_password',
|
||||
}),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
</Space>
|
||||
);
|
||||
},
|
||||
},
|
||||
];
|
||||
|
|
|
@ -47,6 +47,9 @@ export default {
|
|||
'删除后该用户无法使用,确定删除此用户?',
|
||||
'pages.account.user_list.user.columns.option.reset_password': '重置密码',
|
||||
'pages.account.user_list.user.table_alert_option_render': '您确定要批量删除选中用户吗?',
|
||||
'pages.account.user_list.user.columns.option.unlock': '解锁',
|
||||
'pages.account.user_list.user.columns.option.unlock_title': '确定解锁该用户吗?',
|
||||
'pages.account.user_list.user.columns.option.unlock_content': '解锁后用户将恢复正常使用',
|
||||
'pages.account.user_list.user.toolbar.tooltip.title':
|
||||
'若不勾选,则只会搜索当前直属节点的账户,不包含下级节点账户。',
|
||||
'pages.account.user_list.user.toolbar.tooltip.text': '包含节点下全部账户',
|
||||
|
|
|
@ -226,23 +226,6 @@ public class UserController {
|
|||
return ApiRestResult.<Boolean> builder().result(result).build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户离职
|
||||
*
|
||||
* @param id {@link String}
|
||||
* @return {@link Boolean}
|
||||
*/
|
||||
@Lock
|
||||
@Preview
|
||||
@Operation(summary = "用户离职")
|
||||
@Audit(type = EventType.USER_RESIGN)
|
||||
@DeleteMapping(value = "/resign/{id}")
|
||||
@PreAuthorize(value = "authenticated and @sae.hasAuthority(T(cn.topiam.employee.support.security.userdetails.UserType).ADMIN)")
|
||||
public ApiRestResult<Boolean> userResign(@PathVariable(value = "id") String id) {
|
||||
return ApiRestResult.<Boolean> builder()
|
||||
.result(userService.changeUserStatus(Long.valueOf(id), UserStatus.LOCKED)).build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置用户密码
|
||||
*
|
||||
|
@ -260,6 +243,23 @@ public class UserController {
|
|||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 解锁用户
|
||||
*
|
||||
* @param id {@link String}
|
||||
* @return {@link Boolean}
|
||||
*/
|
||||
@Lock
|
||||
@Preview
|
||||
@Operation(summary = "解锁用户")
|
||||
@Audit(type = EventType.UNLOCK_USER)
|
||||
@PutMapping(value = "/unlock/{id}")
|
||||
@PreAuthorize(value = "authenticated and @sae.hasAuthority(T(cn.topiam.employee.support.security.userdetails.UserType).ADMIN)")
|
||||
public ApiRestResult<Boolean> unlockUser(@PathVariable(value = "id") String id) {
|
||||
Boolean result = userService.changeUserStatus(Long.valueOf(id), UserStatus.ENABLE);
|
||||
return ApiRestResult.<Boolean> builder().result(result).build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 参数有效性验证
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue