diff --git a/web/src/UserEditPage.js b/web/src/UserEditPage.js index 5795756a..7c6c2f3b 100644 --- a/web/src/UserEditPage.js +++ b/web/src/UserEditPage.js @@ -499,7 +499,7 @@ class UserEditPage extends React.Component { {Setting.getLabel(i18next.t("user:Is admin"), i18next.t("user:Is admin - Tooltip"))} : - { + { this.updateUserField("isAdmin", checked); }} /> @@ -512,7 +512,7 @@ class UserEditPage extends React.Component { {Setting.getLabel(i18next.t("user:Is global admin"), i18next.t("user:Is global admin - Tooltip"))} : - { + { this.updateUserField("isGlobalAdmin", checked); }} /> diff --git a/web/src/UserListPage.js b/web/src/UserListPage.js index e5c41532..fad819f8 100644 --- a/web/src/UserListPage.js +++ b/web/src/UserListPage.js @@ -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 (
@@ -333,7 +335,7 @@ class UserListPage extends BaseListPage { title={`Sure to delete user: ${record.name} ?`} onConfirm={() => this.deleteUser(index)} > - +
);