fix: remove isGlobalAdmin field in user (#2235)

* refactor: remove isGlobalAdmin field in user

* fix: upload xlsx

* fix: remove field in account table
This commit is contained in:
Yaodong Yu
2023-08-19 12:23:15 +08:00
committed by GitHub
parent a07216d0e1
commit e5a189e0f4
28 changed files with 212 additions and 763 deletions

View File

@ -81,7 +81,6 @@ class OrganizationListPage extends BaseListPage {
{name: "Properties", visible: false, viewRule: "Admin", modifyRule: "Admin"},
{name: "Is online", visible: true, viewRule: "Admin", modifyRule: "Admin"},
{name: "Is admin", visible: true, viewRule: "Admin", modifyRule: "Admin"},
{name: "Is global admin", visible: true, viewRule: "Admin", modifyRule: "Admin"},
{name: "Is forbidden", visible: true, viewRule: "Admin", modifyRule: "Admin"},
{name: "Is deleted", visible: true, viewRule: "Admin", modifyRule: "Admin"},
{Name: "Multi-factor authentication", Visible: true, ViewRule: "Self", ModifyRule: "Self"},

View File

@ -620,7 +620,7 @@ export function isAdminUser(account) {
if (account === undefined || account === null) {
return false;
}
return account.owner === "built-in" || account.isGlobalAdmin === true;
return account.owner === "built-in";
}
export function isLocalAdminUser(account) {

View File

@ -842,19 +842,6 @@ class UserEditPage extends React.Component {
</Col>
</Row>
);
} else if (accountItem.name === "Is global admin") {
return (
<Row style={{marginTop: "20px"}} >
<Col style={{marginTop: "5px"}} span={(Setting.isMobile()) ? 22 : 2}>
{Setting.getLabel(i18next.t("user:Is global admin"), i18next.t("user:Is global admin - Tooltip"))} :
</Col>
<Col span={(Setting.isMobile()) ? 22 : 2} >
<Switch disabled={disabled} checked={this.state.user.isGlobalAdmin} onChange={checked => {
this.updateUserField("isGlobalAdmin", checked);
}} />
</Col>
</Row>
);
} else if (accountItem.name === "Is forbidden") {
return (
<Row style={{marginTop: "20px"}} >

View File

@ -81,7 +81,6 @@ class UserListPage extends BaseListPage {
tag: "staff",
region: "",
isAdmin: (owner === "built-in"),
isGlobalAdmin: (owner === "built-in"),
IsForbidden: false,
score: this.state.organization.initScore,
isDeleted: false,
@ -354,18 +353,6 @@ class UserListPage extends BaseListPage {
);
},
},
{
title: i18next.t("user:Is global admin"),
dataIndex: "isGlobalAdmin",
key: "isGlobalAdmin",
width: "140px",
sorter: true,
render: (text, record, index) => {
return (
<Switch disabled checkedChildren="ON" unCheckedChildren="OFF" checked={text} />
);
},
},
{
title: i18next.t("user:Is forbidden"),
dataIndex: "isForbidden",

View File

@ -79,7 +79,6 @@ const userTemplate = {
"ranking": 10,
"isOnline": false,
"isAdmin": true,
"isGlobalAdmin": false,
"isForbidden": false,
"isDeleted": false,
"signupApplication": "app-casnode",

View File

@ -188,7 +188,7 @@ class OAuthWidget extends React.Component {
</a>
)
) : (
<Button disabled={!providerItem.canUnlink && !account.isGlobalAdmin} style={{marginLeft: "20px", width: linkButtonWidth}} onClick={() => this.unlinkUser(provider.type, linkedValue)}>{i18next.t("user:Unlink")}</Button>
<Button disabled={!providerItem.canUnlink && !Setting.isAdminUser(account)} style={{marginLeft: "20px", width: linkButtonWidth}} onClick={() => this.unlinkUser(provider.type, linkedValue)}>{i18next.t("user:Unlink")}</Button>
)
}
</Col>

View File

@ -100,7 +100,6 @@ class AccountTable extends React.Component {
{name: "Properties", label: i18next.t("user:Properties")},
{name: "Is online", label: i18next.t("user:Is online")},
{name: "Is admin", label: i18next.t("user:Is admin")},
{name: "Is global admin", label: i18next.t("user:Is global admin")},
{name: "Is forbidden", label: i18next.t("user:Is forbidden")},
{name: "Is deleted", label: i18next.t("user:Is deleted")},
{name: "Multi-factor authentication", label: i18next.t("user:Multi-factor authentication")},
@ -179,7 +178,7 @@ class AccountTable extends React.Component {
}
let options;
if (record.viewRule === "Admin" || record.name === "Is admin" || record.name === "Is global admin") {
if (record.viewRule === "Admin" || record.name === "Is admin") {
options = [
{id: "Admin", name: "Admin"},
{id: "Immutable", name: "Immutable"},

View File

@ -100,7 +100,7 @@ class SyncerTableColumnTable extends React.Component {
{
["Name", "CreatedTime", "UpdatedTime", "Id", "Type", "Password", "PasswordSalt", "DisplayName", "FirstName", "LastName", "Avatar", "PermanentAvatar",
"Email", "EmailVerified", "Phone", "Location", "Address", "Affiliation", "Title", "IdCardType", "IdCard", "Homepage", "Bio", "Tag", "Region",
"Language", "Gender", "Birthday", "Education", "Score", "Ranking", "IsDefaultAvatar", "IsOnline", "IsAdmin", "IsGlobalAdmin", "IsForbidden", "IsDeleted", "CreatedIp"]
"Language", "Gender", "Birthday", "Education", "Score", "Ranking", "IsDefaultAvatar", "IsOnline", "IsAdmin", "IsForbidden", "IsDeleted", "CreatedIp"]
.map((item, index) => <Option key={index} value={item}>{item}</Option>)
}
</Select>