mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-04 05:10:19 +08:00
Fix admin UI issues
This commit is contained in:
@ -499,7 +499,7 @@ class UserEditPage extends React.Component {
|
||||
{Setting.getLabel(i18next.t("user:Is admin"), i18next.t("user:Is admin - Tooltip"))} :
|
||||
</Col>
|
||||
<Col span={(Setting.isMobile()) ? 22 : 2} >
|
||||
<Switch checked={this.state.user.isAdmin} onChange={checked => {
|
||||
<Switch disabled={this.state.user.owner === "built-in"} checked={this.state.user.isAdmin} onChange={checked => {
|
||||
this.updateUserField("isAdmin", checked);
|
||||
}} />
|
||||
</Col>
|
||||
@ -512,7 +512,7 @@ class UserEditPage extends React.Component {
|
||||
{Setting.getLabel(i18next.t("user:Is global admin"), i18next.t("user:Is global admin - Tooltip"))} :
|
||||
</Col>
|
||||
<Col span={(Setting.isMobile()) ? 22 : 2} >
|
||||
<Switch checked={this.state.user.isGlobalAdmin} onChange={checked => {
|
||||
<Switch disabled={this.state.user.owner === "built-in"} checked={this.state.user.isGlobalAdmin} onChange={checked => {
|
||||
this.updateUserField("isGlobalAdmin", checked);
|
||||
}} />
|
||||
</Col>
|
||||
|
@ -41,8 +41,9 @@ class UserListPage extends BaseListPage {
|
||||
|
||||
newUser() {
|
||||
const randomName = Setting.getRandomName();
|
||||
const owner = (this.state.organizationName !== undefined) ? this.state.organizationName : this.props.account.owner;
|
||||
return {
|
||||
owner: "built-in", // this.props.account.username,
|
||||
owner: owner,
|
||||
name: `user_${randomName}`,
|
||||
createdTime: moment().format(),
|
||||
type: "normal-user",
|
||||
@ -56,8 +57,8 @@ class UserListPage extends BaseListPage {
|
||||
affiliation: "Example Inc.",
|
||||
tag: "staff",
|
||||
region: "",
|
||||
isAdmin: false,
|
||||
isGlobalAdmin: false,
|
||||
isAdmin: (owner === "built-in"),
|
||||
isGlobalAdmin: (owner === "built-in"),
|
||||
IsForbidden: false,
|
||||
isDeleted: false,
|
||||
properties: {},
|
||||
@ -326,6 +327,7 @@ class UserListPage extends BaseListPage {
|
||||
width: "190px",
|
||||
fixed: (Setting.isMobile()) ? "false" : "right",
|
||||
render: (text, record, index) => {
|
||||
const disabled = (record.owner === this.props.account.owner && record.name === this.props.account.name);
|
||||
return (
|
||||
<div>
|
||||
<Button style={{marginTop: "10px", marginBottom: "10px", marginRight: "10px"}} type="primary" onClick={() => this.props.history.push(`/users/${record.owner}/${record.name}`)}>{i18next.t("general:Edit")}</Button>
|
||||
@ -333,7 +335,7 @@ class UserListPage extends BaseListPage {
|
||||
title={`Sure to delete user: ${record.name} ?`}
|
||||
onConfirm={() => this.deleteUser(index)}
|
||||
>
|
||||
<Button style={{marginBottom: "10px"}} type="danger">{i18next.t("general:Delete")}</Button>
|
||||
<Button disabled={disabled} style={{marginBottom: "10px"}} type="danger">{i18next.t("general:Delete")}</Button>
|
||||
</Popconfirm>
|
||||
</div>
|
||||
);
|
||||
|
Reference in New Issue
Block a user