mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-04 05:10:19 +08:00
Add User.isGlobalAdmin
This commit is contained in:
@ -194,34 +194,37 @@ class App extends Component {
|
||||
</Link>
|
||||
</Menu.Item>
|
||||
);
|
||||
res.push(
|
||||
<Menu.Item key="1">
|
||||
<Link to="/organizations">
|
||||
Organizations
|
||||
</Link>
|
||||
</Menu.Item>
|
||||
);
|
||||
res.push(
|
||||
<Menu.Item key="2">
|
||||
<Link to="/users">
|
||||
Users
|
||||
</Link>
|
||||
</Menu.Item>
|
||||
);
|
||||
res.push(
|
||||
<Menu.Item key="3">
|
||||
<Link to="/providers">
|
||||
Providers
|
||||
</Link>
|
||||
</Menu.Item>
|
||||
);
|
||||
res.push(
|
||||
<Menu.Item key="4">
|
||||
<Link to="/applications">
|
||||
Applications
|
||||
</Link>
|
||||
</Menu.Item>
|
||||
);
|
||||
|
||||
if (Setting.isAdminUser(this.state.account)) {
|
||||
res.push(
|
||||
<Menu.Item key="1">
|
||||
<Link to="/organizations">
|
||||
Organizations
|
||||
</Link>
|
||||
</Menu.Item>
|
||||
);
|
||||
res.push(
|
||||
<Menu.Item key="2">
|
||||
<Link to="/users">
|
||||
Users
|
||||
</Link>
|
||||
</Menu.Item>
|
||||
);
|
||||
res.push(
|
||||
<Menu.Item key="3">
|
||||
<Link to="/providers">
|
||||
Providers
|
||||
</Link>
|
||||
</Menu.Item>
|
||||
);
|
||||
res.push(
|
||||
<Menu.Item key="4">
|
||||
<Link to="/applications">
|
||||
Applications
|
||||
</Link>
|
||||
</Menu.Item>
|
||||
);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ export function showMessage(type, text) {
|
||||
}
|
||||
|
||||
export function isAdminUser(account) {
|
||||
return account.owner === "built-in";
|
||||
return account.owner === "built-in" || account.isGlobalAdmin === true;
|
||||
}
|
||||
|
||||
export function deepCopy(obj) {
|
||||
|
@ -216,16 +216,32 @@ class UserEditPage extends React.Component {
|
||||
<Input value={this.state.user.github} disabled={true} />
|
||||
</Col>
|
||||
</Row>
|
||||
<Row style={{marginTop: '20px'}} >
|
||||
<Col style={{marginTop: '5px'}} span={2}>
|
||||
Is Admin:
|
||||
</Col>
|
||||
<Col span={1} >
|
||||
<Switch checked={this.state.user.isAdmin} onChange={checked => {
|
||||
this.updateUserField('isAdmin', checked);
|
||||
}} />
|
||||
</Col>
|
||||
</Row>
|
||||
{
|
||||
!Setting.isAdminUser(this.props.account) ? null : (
|
||||
<React.Fragment>
|
||||
<Row style={{marginTop: '20px'}} >
|
||||
<Col style={{marginTop: '5px'}} span={2}>
|
||||
Is Admin:
|
||||
</Col>
|
||||
<Col span={1} >
|
||||
<Switch checked={this.state.user.isAdmin} onChange={checked => {
|
||||
this.updateUserField('isAdmin', checked);
|
||||
}} />
|
||||
</Col>
|
||||
</Row>
|
||||
<Row style={{marginTop: '20px'}} >
|
||||
<Col style={{marginTop: '5px'}} span={2}>
|
||||
Is Global Admin:
|
||||
</Col>
|
||||
<Col span={1} >
|
||||
<Switch checked={this.state.user.isGlobalAdmin} onChange={checked => {
|
||||
this.updateUserField('isGlobalAdmin', checked);
|
||||
}} />
|
||||
</Col>
|
||||
</Row>
|
||||
</React.Fragment>
|
||||
)
|
||||
}
|
||||
</Card>
|
||||
)
|
||||
}
|
||||
|
@ -208,6 +208,18 @@ class UserListPage extends React.Component {
|
||||
)
|
||||
}
|
||||
},
|
||||
{
|
||||
title: 'Is Global Admin',
|
||||
dataIndex: 'isGlobalAdmin',
|
||||
key: 'isGlobalAdmin',
|
||||
width: '120px',
|
||||
sorter: (a, b) => a.isGlobalAdmin.localeCompare(b.isGlobalAdmin),
|
||||
render: (text, record, index) => {
|
||||
return (
|
||||
<Switch disabled checkedChildren="ON" unCheckedChildren="OFF" checked={text} />
|
||||
)
|
||||
}
|
||||
},
|
||||
{
|
||||
title: 'Action',
|
||||
dataIndex: '',
|
||||
|
Reference in New Issue
Block a user