Add user's Affiliation and IsAdmin.

This commit is contained in:
Yang Luo 2021-02-14 13:43:55 +08:00
parent 4b66c24bb6
commit 40587f35e3
4 changed files with 53 additions and 12 deletions

View File

@ -31,6 +31,8 @@ type User struct {
Avatar string `xorm:"varchar(100)" json:"avatar"` Avatar string `xorm:"varchar(100)" json:"avatar"`
Email string `xorm:"varchar(100)" json:"email"` Email string `xorm:"varchar(100)" json:"email"`
Phone string `xorm:"varchar(100)" json:"phone"` Phone string `xorm:"varchar(100)" json:"phone"`
Affiliation string `xorm:"varchar(100)" json:"affiliation"`
IsAdmin bool `json:"isAdmin"`
Github string `xorm:"varchar(100)" json:"github"` Github string `xorm:"varchar(100)" json:"github"`
} }

View File

@ -157,9 +157,9 @@ class ApplicationEditPage extends React.Component {
Enable Password: Enable Password:
</Col> </Col>
<Col span={1} > <Col span={1} >
{ <Switch checked={this.state.application.enablePassword} onChange={checked => {
<Switch checked={this.state.application.enablePassword} onChange={(checked => {this.updateApplicationField('enablePassword', checked);})} /> this.updateApplicationField('enablePassword', checked);
} }} />
</Col> </Col>
</Row> </Row>
<Row style={{marginTop: '20px'}} > <Row style={{marginTop: '20px'}} >

View File

@ -13,7 +13,7 @@
// limitations under the License. // limitations under the License.
import React from "react"; import React from "react";
import {Button, Card, Col, Input, Row, Select} from 'antd'; import {Button, Card, Col, Input, Row, Select, Switch} from 'antd';
import * as UserBackend from "./backend/UserBackend"; import * as UserBackend from "./backend/UserBackend";
import * as OrganizationBackend from "./backend/OrganizationBackend"; import * as OrganizationBackend from "./backend/OrganizationBackend";
import * as Setting from "./Setting"; import * as Setting from "./Setting";
@ -188,6 +188,26 @@ class UserEditPage extends React.Component {
}} /> }} />
</Col> </Col>
</Row> </Row>
<Row style={{marginTop: '20px'}} >
<Col style={{marginTop: '5px'}} span={2}>
Affiliation:
</Col>
<Col span={22} >
<Input value={this.state.user.affiliation} onChange={e => {
this.updateUserField('affiliation', e.target.value);
}} />
</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>
</Card> </Card>
) )
} }

View File

@ -14,7 +14,7 @@
import React from "react"; import React from "react";
import {Link} from "react-router-dom"; import {Link} from "react-router-dom";
import {Button, Col, Popconfirm, Row, Table} from 'antd'; import {Button, Col, Popconfirm, Row, Switch, Table} from 'antd';
import moment from "moment"; import moment from "moment";
import * as Setting from "./Setting"; import * as Setting from "./Setting";
import * as UserBackend from "./backend/UserBackend"; import * as UserBackend from "./backend/UserBackend";
@ -131,13 +131,13 @@ class UserListPage extends React.Component {
width: '150px', width: '150px',
sorter: (a, b) => a.passwordType.localeCompare(b.passwordType), sorter: (a, b) => a.passwordType.localeCompare(b.passwordType),
}, },
{ // {
title: 'Password', // title: 'Password',
dataIndex: 'password', // dataIndex: 'password',
key: 'password', // key: 'password',
width: '150px', // width: '150px',
sorter: (a, b) => a.password.localeCompare(b.password), // sorter: (a, b) => a.password.localeCompare(b.password),
}, // },
{ {
title: 'Display Name', title: 'Display Name',
dataIndex: 'displayName', dataIndex: 'displayName',
@ -179,6 +179,25 @@ class UserListPage extends React.Component {
width: '120px', width: '120px',
sorter: (a, b) => a.phone.localeCompare(b.phone), sorter: (a, b) => a.phone.localeCompare(b.phone),
}, },
{
title: 'Affiliation',
dataIndex: 'affiliation',
key: 'affiliation',
width: '120px',
sorter: (a, b) => a.affiliation.localeCompare(b.affiliation),
},
{
title: 'Is Admin',
dataIndex: 'isAdmin',
key: 'isAdmin',
width: '120px',
sorter: (a, b) => a.isAdmin.localeCompare(b.isAdmin),
render: (text, record, index) => {
return (
<Switch disabled checkedChildren="ON" unCheckedChildren="OFF" checked={text} />
)
}
},
{ {
title: 'Action', title: 'Action',
dataIndex: '', dataIndex: '',