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"))} :
|
{Setting.getLabel(i18next.t("user:Is admin"), i18next.t("user:Is admin - Tooltip"))} :
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={(Setting.isMobile()) ? 22 : 2} >
|
<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);
|
this.updateUserField("isAdmin", checked);
|
||||||
}} />
|
}} />
|
||||||
</Col>
|
</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"))} :
|
{Setting.getLabel(i18next.t("user:Is global admin"), i18next.t("user:Is global admin - Tooltip"))} :
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={(Setting.isMobile()) ? 22 : 2} >
|
<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);
|
this.updateUserField("isGlobalAdmin", checked);
|
||||||
}} />
|
}} />
|
||||||
</Col>
|
</Col>
|
||||||
|
@ -41,8 +41,9 @@ class UserListPage extends BaseListPage {
|
|||||||
|
|
||||||
newUser() {
|
newUser() {
|
||||||
const randomName = Setting.getRandomName();
|
const randomName = Setting.getRandomName();
|
||||||
|
const owner = (this.state.organizationName !== undefined) ? this.state.organizationName : this.props.account.owner;
|
||||||
return {
|
return {
|
||||||
owner: "built-in", // this.props.account.username,
|
owner: owner,
|
||||||
name: `user_${randomName}`,
|
name: `user_${randomName}`,
|
||||||
createdTime: moment().format(),
|
createdTime: moment().format(),
|
||||||
type: "normal-user",
|
type: "normal-user",
|
||||||
@ -56,8 +57,8 @@ class UserListPage extends BaseListPage {
|
|||||||
affiliation: "Example Inc.",
|
affiliation: "Example Inc.",
|
||||||
tag: "staff",
|
tag: "staff",
|
||||||
region: "",
|
region: "",
|
||||||
isAdmin: false,
|
isAdmin: (owner === "built-in"),
|
||||||
isGlobalAdmin: false,
|
isGlobalAdmin: (owner === "built-in"),
|
||||||
IsForbidden: false,
|
IsForbidden: false,
|
||||||
isDeleted: false,
|
isDeleted: false,
|
||||||
properties: {},
|
properties: {},
|
||||||
@ -326,6 +327,7 @@ class UserListPage extends BaseListPage {
|
|||||||
width: "190px",
|
width: "190px",
|
||||||
fixed: (Setting.isMobile()) ? "false" : "right",
|
fixed: (Setting.isMobile()) ? "false" : "right",
|
||||||
render: (text, record, index) => {
|
render: (text, record, index) => {
|
||||||
|
const disabled = (record.owner === this.props.account.owner && record.name === this.props.account.name);
|
||||||
return (
|
return (
|
||||||
<div>
|
<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>
|
<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} ?`}
|
title={`Sure to delete user: ${record.name} ?`}
|
||||||
onConfirm={() => this.deleteUser(index)}
|
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>
|
</Popconfirm>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user