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(
|
public static Type MODIFY_USER_PASSWORD = new Type(
|
||||||
"eiam:event:account:update_password", "修改密码", ORG_ACCOUNT_RESOURCE, List.of(ADMIN));
|
"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),
|
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' }),
|
title: intl.formatMessage({ id: 'pages.account.user_list.user.columns.option' }),
|
||||||
valueType: 'option',
|
valueType: 'option',
|
||||||
width: 110,
|
width: 120,
|
||||||
align: 'center',
|
align: 'center',
|
||||||
fixed: 'right',
|
fixed: 'right',
|
||||||
render: (_text: any, row: AccountAPI.ListUser) => {
|
render: (_text: any, row: AccountAPI.ListUser) => {
|
||||||
return [
|
return (
|
||||||
...[
|
<Space>
|
||||||
(row.status === 'locked' ||
|
{/*锁定*/}
|
||||||
|
{(row.status === 'locked' ||
|
||||||
row.status === 'expired_locked' ||
|
row.status === 'expired_locked' ||
|
||||||
row.status === 'password_expired_locked') && (
|
row.status === 'password_expired_locked') && (
|
||||||
<a
|
<a
|
||||||
|
@ -285,8 +286,9 @@ export default (props: UserListProps) => {
|
||||||
>
|
>
|
||||||
{intl.formatMessage({ id: 'pages.account.user_list.user.columns.option.unlock' })}
|
{intl.formatMessage({ id: 'pages.account.user_list.user.columns.option.unlock' })}
|
||||||
</a>
|
</a>
|
||||||
),
|
)}
|
||||||
row.status === 'enabled' ? (
|
{/*启用*/}
|
||||||
|
{row.status === 'enabled' && (
|
||||||
<Popconfirm
|
<Popconfirm
|
||||||
title={intl.formatMessage({
|
title={intl.formatMessage({
|
||||||
id: 'pages.account.user_list.user.columns.option.disable.popconfirm',
|
id: 'pages.account.user_list.user.columns.option.disable.popconfirm',
|
||||||
|
@ -315,7 +317,9 @@ export default (props: UserListProps) => {
|
||||||
{intl.formatMessage({ id: 'app.disable' })}
|
{intl.formatMessage({ id: 'app.disable' })}
|
||||||
</a>
|
</a>
|
||||||
</Popconfirm>
|
</Popconfirm>
|
||||||
) : (
|
)}
|
||||||
|
{/*禁用*/}
|
||||||
|
{row.status === 'disabled' && (
|
||||||
<Popconfirm
|
<Popconfirm
|
||||||
title={intl.formatMessage({
|
title={intl.formatMessage({
|
||||||
id: 'pages.account.user_list.user.columns.option.enable.popconfirm',
|
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>
|
<a key="enabled">{intl.formatMessage({ id: 'app.enable' })}</a>
|
||||||
</Popconfirm>
|
</Popconfirm>
|
||||||
),
|
)}
|
||||||
],
|
{/*更新*/}
|
||||||
<a
|
<a
|
||||||
key={'update'}
|
key={'update'}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setId(row.id);
|
|
||||||
setUpdateUserVisible(true);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{intl.formatMessage({ id: 'app.update' })}
|
|
||||||
</a>,
|
|
||||||
<TableDropdown
|
|
||||||
key={'dropdown'}
|
|
||||||
onSelect={(key) => {
|
|
||||||
if (key === 'reset-password') {
|
|
||||||
setId(row.id);
|
setId(row.id);
|
||||||
setResetPasswordVisible(true);
|
setUpdateUserVisible(true);
|
||||||
}
|
}}
|
||||||
}}
|
>
|
||||||
menus={[
|
{intl.formatMessage({ id: 'app.update' })}
|
||||||
{
|
</a>
|
||||||
key: 'delete',
|
{/*更多*/}
|
||||||
name: (
|
<TableDropdown
|
||||||
<Popconfirm
|
key={'dropdown'}
|
||||||
title={intl.formatMessage({
|
onSelect={(key) => {
|
||||||
id: 'pages.account.user_list.user.columns.option.delete.popconfirm',
|
if (key === 'reset-password') {
|
||||||
})}
|
setId(row.id);
|
||||||
placement="bottomRight"
|
setResetPasswordVisible(true);
|
||||||
icon={
|
}
|
||||||
<QuestionCircleOutlined
|
}}
|
||||||
style={{
|
menus={[
|
||||||
color: 'red',
|
{
|
||||||
}}
|
key: 'delete',
|
||||||
/>
|
name: (
|
||||||
}
|
<Popconfirm
|
||||||
onConfirm={async () => {
|
title={intl.formatMessage({
|
||||||
const { success } = await removeUser(row.id);
|
id: 'pages.account.user_list.user.columns.option.delete.popconfirm',
|
||||||
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>
|
placement="bottomRight"
|
||||||
</Popconfirm>
|
icon={
|
||||||
),
|
<QuestionCircleOutlined
|
||||||
},
|
style={{
|
||||||
{
|
color: 'red',
|
||||||
key: 'reset-password',
|
}}
|
||||||
name: intl.formatMessage({
|
/>
|
||||||
id: 'pages.account.user_list.user.columns.option.reset_password',
|
}
|
||||||
}),
|
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.columns.option.reset_password': '重置密码',
|
||||||
'pages.account.user_list.user.table_alert_option_render': '您确定要批量删除选中用户吗?',
|
'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.title':
|
||||||
'若不勾选,则只会搜索当前直属节点的账户,不包含下级节点账户。',
|
'若不勾选,则只会搜索当前直属节点的账户,不包含下级节点账户。',
|
||||||
'pages.account.user_list.user.toolbar.tooltip.text': '包含节点下全部账户',
|
'pages.account.user_list.user.toolbar.tooltip.text': '包含节点下全部账户',
|
||||||
|
|
|
@ -226,23 +226,6 @@ public class UserController {
|
||||||
return ApiRestResult.<Boolean> builder().result(result).build();
|
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();
|
.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