mirror of
https://github.com/casdoor/casdoor.git
synced 2025-05-24 08:20:31 +08:00
Add User's IsForbidden.
This commit is contained in:
parent
79f1c62ff7
commit
82f4f542ed
@ -99,6 +99,7 @@ func (c *ApiController) Signup() {
|
|||||||
Affiliation: form.Affiliation,
|
Affiliation: form.Affiliation,
|
||||||
IsAdmin: false,
|
IsAdmin: false,
|
||||||
IsGlobalAdmin: false,
|
IsGlobalAdmin: false,
|
||||||
|
IsForbidden: false,
|
||||||
}
|
}
|
||||||
object.AddUser(user)
|
object.AddUser(user)
|
||||||
|
|
||||||
|
@ -65,6 +65,10 @@ func CheckUserLogin(organization string, username string, password string) (*Use
|
|||||||
return nil, "password incorrect"
|
return nil, "password incorrect"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if user.IsForbidden {
|
||||||
|
return nil, "the user is forbidden to sign in, please contact the administrator"
|
||||||
|
}
|
||||||
|
|
||||||
return user, ""
|
return user, ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,6 +45,7 @@ func initBuiltInUser() {
|
|||||||
Tag: "staff",
|
Tag: "staff",
|
||||||
IsAdmin: true,
|
IsAdmin: true,
|
||||||
IsGlobalAdmin: true,
|
IsGlobalAdmin: true,
|
||||||
|
IsForbidden: false,
|
||||||
}
|
}
|
||||||
AddUser(user)
|
AddUser(user)
|
||||||
}
|
}
|
||||||
|
@ -40,6 +40,7 @@ type User struct {
|
|||||||
Tag string `xorm:"varchar(100)" json:"tag"`
|
Tag string `xorm:"varchar(100)" json:"tag"`
|
||||||
IsAdmin bool `json:"isAdmin"`
|
IsAdmin bool `json:"isAdmin"`
|
||||||
IsGlobalAdmin bool `json:"isGlobalAdmin"`
|
IsGlobalAdmin bool `json:"isGlobalAdmin"`
|
||||||
|
IsForbidden bool `json:"isForbidden"`
|
||||||
|
|
||||||
Github string `xorm:"varchar(100)" json:"github"`
|
Github string `xorm:"varchar(100)" json:"github"`
|
||||||
Google string `xorm:"varchar(100)" json:"google"`
|
Google string `xorm:"varchar(100)" json:"google"`
|
||||||
|
@ -364,6 +364,16 @@ class UserEditPage extends React.Component {
|
|||||||
}} />
|
}} />
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
|
<Row style={{marginTop: '20px'}} >
|
||||||
|
<Col style={{marginTop: '5px'}} span={2}>
|
||||||
|
{i18next.t("user:Is forbidden")}:
|
||||||
|
</Col>
|
||||||
|
<Col span={1} >
|
||||||
|
<Switch checked={this.state.user.isForbidden} onChange={checked => {
|
||||||
|
this.updateUserField('isForbidden', checked);
|
||||||
|
}} />
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -211,7 +211,7 @@ class UserListPage extends React.Component {
|
|||||||
dataIndex: 'isAdmin',
|
dataIndex: 'isAdmin',
|
||||||
key: 'isAdmin',
|
key: 'isAdmin',
|
||||||
width: '120px',
|
width: '120px',
|
||||||
sorter: (a, b) => a.isAdmin.localeCompare(b.isAdmin),
|
sorter: (a, b) => a.isAdmin - b.isAdmin,
|
||||||
render: (text, record, index) => {
|
render: (text, record, index) => {
|
||||||
return (
|
return (
|
||||||
<Switch disabled checkedChildren="ON" unCheckedChildren="OFF" checked={text} />
|
<Switch disabled checkedChildren="ON" unCheckedChildren="OFF" checked={text} />
|
||||||
@ -223,7 +223,19 @@ class UserListPage extends React.Component {
|
|||||||
dataIndex: 'isGlobalAdmin',
|
dataIndex: 'isGlobalAdmin',
|
||||||
key: 'isGlobalAdmin',
|
key: 'isGlobalAdmin',
|
||||||
width: '120px',
|
width: '120px',
|
||||||
sorter: (a, b) => a.isGlobalAdmin.localeCompare(b.isGlobalAdmin),
|
sorter: (a, b) => a.isGlobalAdmin - b.isGlobalAdmin,
|
||||||
|
render: (text, record, index) => {
|
||||||
|
return (
|
||||||
|
<Switch disabled checkedChildren="ON" unCheckedChildren="OFF" checked={text} />
|
||||||
|
)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: i18next.t("user:Is forbidden"),
|
||||||
|
dataIndex: 'isForbidden',
|
||||||
|
key: 'isForbidden',
|
||||||
|
width: '120px',
|
||||||
|
sorter: (a, b) => a.isForbidden - b.isForbidden,
|
||||||
render: (text, record, index) => {
|
render: (text, record, index) => {
|
||||||
return (
|
return (
|
||||||
<Switch disabled checkedChildren="ON" unCheckedChildren="OFF" checked={text} />
|
<Switch disabled checkedChildren="ON" unCheckedChildren="OFF" checked={text} />
|
||||||
|
@ -94,7 +94,8 @@
|
|||||||
"Link": "Link",
|
"Link": "Link",
|
||||||
"Unlink": "Unlink",
|
"Unlink": "Unlink",
|
||||||
"Is admin": "Is admin",
|
"Is admin": "Is admin",
|
||||||
"Is global admin": "Is global admin"
|
"Is global admin": "Is global admin",
|
||||||
|
"Is forbidden": "Is forbidden"
|
||||||
},
|
},
|
||||||
"application":
|
"application":
|
||||||
{
|
{
|
||||||
|
@ -96,7 +96,8 @@
|
|||||||
"Link": "绑定",
|
"Link": "绑定",
|
||||||
"Unlink": "解绑",
|
"Unlink": "解绑",
|
||||||
"Is admin": "是管理员",
|
"Is admin": "是管理员",
|
||||||
"Is global admin": "是全局管理员"
|
"Is global admin": "是全局管理员",
|
||||||
|
"Is forbidden": "被禁用"
|
||||||
},
|
},
|
||||||
"application":
|
"application":
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user