mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-28 16:17:02 +00:00
update inactive user (#6019)
* update inactive user * is_active del RepoAPITokens * update del_repo_api_token * add inactive_user * [user admin] add confirmation to 'set user inactive' * system admin - users * system admin - organizations - org - member * org admin - users --------- Co-authored-by: llj <lingjun.li1@gmail.com>
This commit is contained in:
@@ -200,7 +200,8 @@ class Item extends Component {
|
||||
isSetQuotaDialogOpen: false,
|
||||
isDeleteUserDialogOpen: false,
|
||||
isResetUserPasswordDialogOpen: false,
|
||||
isRevokeAdminDialogOpen: false
|
||||
isRevokeAdminDialogOpen: false,
|
||||
isConfirmInactiveDialogOpen: false
|
||||
};
|
||||
}
|
||||
|
||||
@@ -246,6 +247,10 @@ class Item extends Component {
|
||||
this.setState({isRevokeAdminDialogOpen: !this.state.isRevokeAdminDialogOpen});
|
||||
};
|
||||
|
||||
toggleConfirmInactiveDialog= () => {
|
||||
this.setState({isConfirmInactiveDialogOpen: !this.state.isConfirmInactiveDialogOpen});
|
||||
};
|
||||
|
||||
onUserSelected = () => {
|
||||
this.props.onUserSelected(this.props.item);
|
||||
};
|
||||
@@ -258,6 +263,10 @@ class Item extends Component {
|
||||
this.props.updateUser(this.props.item.email, 'is_active', isActive);
|
||||
};
|
||||
|
||||
setUserInactive = () => {
|
||||
this.props.updateUser(this.props.item.email, 'is_active', false);
|
||||
};
|
||||
|
||||
updateRole = (roleOption) => {
|
||||
this.props.updateUser(this.props.item.email, 'role', roleOption.value);
|
||||
};
|
||||
@@ -386,13 +395,15 @@ class Item extends Component {
|
||||
isSetQuotaDialogOpen,
|
||||
isDeleteUserDialogOpen,
|
||||
isResetUserPasswordDialogOpen,
|
||||
isRevokeAdminDialogOpen
|
||||
isRevokeAdminDialogOpen,
|
||||
isConfirmInactiveDialogOpen
|
||||
} = this.state;
|
||||
|
||||
const itemName = '<span class="op-target">' + Utils.HTMLescape(item.name) + '</span>';
|
||||
const deleteDialogMsg = gettext('Are you sure you want to delete {placeholder} ?').replace('{placeholder}', itemName);
|
||||
const resetPasswordDialogMsg = gettext('Are you sure you want to reset the password of {placeholder} ?').replace('{placeholder}', itemName);
|
||||
const revokeAdminDialogMsg = gettext('Are you sure you want to revoke the admin permission of {placeholder} ?').replace('{placeholder}', itemName);
|
||||
const confirmSetUserInactiveMsg = gettext('Are you sure you want to set {user_placeholder} inactive?').replace('{user_placeholder}', itemName);
|
||||
|
||||
// for 'user status'
|
||||
const curStatus = item.is_active ? 'active' : 'inactive';
|
||||
@@ -473,6 +484,7 @@ class Item extends Component {
|
||||
options={this.statusOptions}
|
||||
selectOption={this.updateStatus}
|
||||
toggleItemFreezed={this.props.toggleItemFreezed}
|
||||
operationBeforeSelect={item.is_active ? this.toggleConfirmInactiveDialog : undefined}
|
||||
/>
|
||||
</td>
|
||||
{isPro &&
|
||||
@@ -567,6 +579,15 @@ class Item extends Component {
|
||||
toggleDialog={this.toggleRevokeAdminDialog}
|
||||
/>
|
||||
}
|
||||
{isConfirmInactiveDialogOpen &&
|
||||
<CommonOperationConfirmationDialog
|
||||
title={gettext('Set user inactive')}
|
||||
message={confirmSetUserInactiveMsg}
|
||||
executeOperation={this.setUserInactive}
|
||||
confirmBtnText={gettext('Set')}
|
||||
toggleDialog={this.toggleConfirmInactiveDialog}
|
||||
/>
|
||||
}
|
||||
</Fragment>
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user