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"`
Email string `xorm:"varchar(100)" json:"email"`
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"`
}

View File

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

View File

@ -13,7 +13,7 @@
// limitations under the License.
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 OrganizationBackend from "./backend/OrganizationBackend";
import * as Setting from "./Setting";
@ -188,6 +188,26 @@ class UserEditPage extends React.Component {
}} />
</Col>
</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>
)
}

View File

@ -14,7 +14,7 @@
import React from "react";
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 * as Setting from "./Setting";
import * as UserBackend from "./backend/UserBackend";
@ -131,13 +131,13 @@ class UserListPage extends React.Component {
width: '150px',
sorter: (a, b) => a.passwordType.localeCompare(b.passwordType),
},
{
title: 'Password',
dataIndex: 'password',
key: 'password',
width: '150px',
sorter: (a, b) => a.password.localeCompare(b.password),
},
// {
// title: 'Password',
// dataIndex: 'password',
// key: 'password',
// width: '150px',
// sorter: (a, b) => a.password.localeCompare(b.password),
// },
{
title: 'Display Name',
dataIndex: 'displayName',
@ -179,6 +179,25 @@ class UserListPage extends React.Component {
width: '120px',
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',
dataIndex: '',