mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-04 05:10:19 +08:00
Restrict app edit page values.
This commit is contained in:
@ -289,6 +289,7 @@ class ApplicationEditPage extends React.Component {
|
|||||||
title={i18next.t("general:Providers")}
|
title={i18next.t("general:Providers")}
|
||||||
table={this.state.application.providers}
|
table={this.state.application.providers}
|
||||||
providers={this.state.providers}
|
providers={this.state.providers}
|
||||||
|
application={this.state.application}
|
||||||
onUpdateTable={(value) => { this.updateApplicationField('providers', value)}}
|
onUpdateTable={(value) => { this.updateApplicationField('providers', value)}}
|
||||||
/>
|
/>
|
||||||
</Col>
|
</Col>
|
||||||
@ -301,18 +302,22 @@ class ApplicationEditPage extends React.Component {
|
|||||||
this.renderPreview()
|
this.renderPreview()
|
||||||
}
|
}
|
||||||
</Row>
|
</Row>
|
||||||
<Row style={{marginTop: '20px'}} >
|
{
|
||||||
<Col style={{marginTop: '5px'}} span={2}>
|
!this.state.application.enableSignUp ? null : (
|
||||||
{Setting.getLabel(i18next.t("application:Signup items"), i18next.t("application:Signup items - Tooltip"))} :
|
<Row style={{marginTop: '20px'}} >
|
||||||
</Col>
|
<Col style={{marginTop: '5px'}} span={2}>
|
||||||
<Col span={22} >
|
{Setting.getLabel(i18next.t("application:Signup items"), i18next.t("application:Signup items - Tooltip"))} :
|
||||||
<SignupTable
|
</Col>
|
||||||
title={i18next.t("application:Signup items")}
|
<Col span={22} >
|
||||||
table={this.state.application.signupItems}
|
<SignupTable
|
||||||
onUpdateTable={(value) => { this.updateApplicationField('signupItems', value)}}
|
title={i18next.t("application:Signup items")}
|
||||||
/>
|
table={this.state.application.signupItems}
|
||||||
</Col>
|
onUpdateTable={(value) => { this.updateApplicationField('signupItems', value)}}
|
||||||
</Row>
|
/>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
)
|
||||||
|
}
|
||||||
<Row style={{marginTop: '20px'}} >
|
<Row style={{marginTop: '20px'}} >
|
||||||
<Col style={{marginTop: '5px'}} span={2}>
|
<Col style={{marginTop: '5px'}} span={2}>
|
||||||
{Setting.getLabel(i18next.t("general:Preview"), i18next.t("general:Preview - Tooltip"))} :
|
{Setting.getLabel(i18next.t("general:Preview"), i18next.t("general:Preview - Tooltip"))} :
|
||||||
|
@ -62,7 +62,7 @@ class ProviderTable extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
renderTable(table) {
|
renderTable(table) {
|
||||||
const columns = [
|
let columns = [
|
||||||
{
|
{
|
||||||
title: i18next.t("provider:Name"),
|
title: i18next.t("provider:Name"),
|
||||||
dataIndex: 'name',
|
dataIndex: 'name',
|
||||||
@ -89,6 +89,10 @@ class ProviderTable extends React.Component {
|
|||||||
key: 'canSignUp',
|
key: 'canSignUp',
|
||||||
width: '120px',
|
width: '120px',
|
||||||
render: (text, record, index) => {
|
render: (text, record, index) => {
|
||||||
|
if (record.provider.category !== "OAuth") {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Switch checked={text} onChange={checked => {
|
<Switch checked={text} onChange={checked => {
|
||||||
this.updateField(table, index, 'canSignUp', checked);
|
this.updateField(table, index, 'canSignUp', checked);
|
||||||
@ -102,6 +106,10 @@ class ProviderTable extends React.Component {
|
|||||||
key: 'canSignIn',
|
key: 'canSignIn',
|
||||||
width: '120px',
|
width: '120px',
|
||||||
render: (text, record, index) => {
|
render: (text, record, index) => {
|
||||||
|
if (record.provider.category !== "OAuth") {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Switch checked={text} onChange={checked => {
|
<Switch checked={text} onChange={checked => {
|
||||||
this.updateField(table, index, 'canSignIn', checked);
|
this.updateField(table, index, 'canSignIn', checked);
|
||||||
@ -115,6 +123,10 @@ class ProviderTable extends React.Component {
|
|||||||
key: 'canUnlink',
|
key: 'canUnlink',
|
||||||
width: '120px',
|
width: '120px',
|
||||||
render: (text, record, index) => {
|
render: (text, record, index) => {
|
||||||
|
if (record.provider.category !== "OAuth") {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Switch checked={text} onChange={checked => {
|
<Switch checked={text} onChange={checked => {
|
||||||
this.updateField(table, index, 'canUnlink', checked);
|
this.updateField(table, index, 'canUnlink', checked);
|
||||||
@ -128,6 +140,10 @@ class ProviderTable extends React.Component {
|
|||||||
key: 'prompted',
|
key: 'prompted',
|
||||||
width: '120px',
|
width: '120px',
|
||||||
render: (text, record, index) => {
|
render: (text, record, index) => {
|
||||||
|
if (record.provider.category !== "OAuth") {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Switch checked={text} onChange={checked => {
|
<Switch checked={text} onChange={checked => {
|
||||||
this.updateField(table, index, 'prompted', checked);
|
this.updateField(table, index, 'prompted', checked);
|
||||||
@ -135,27 +151,27 @@ class ProviderTable extends React.Component {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
title: i18next.t("provider:alertType"),
|
// title: i18next.t("provider:alertType"),
|
||||||
dataIndex: 'alertType',
|
// dataIndex: 'alertType',
|
||||||
key: 'alertType',
|
// key: 'alertType',
|
||||||
width: '120px',
|
// width: '120px',
|
||||||
render: (text, record, index) => {
|
// render: (text, record, index) => {
|
||||||
return (
|
// return (
|
||||||
<Select virtual={false} style={{width: '100%'}} value={text} onChange={(value => {
|
// <Select virtual={false} style={{width: '100%'}} value={text} onChange={(value => {
|
||||||
this.updateField(table, index, 'alertType', value);
|
// this.updateField(table, index, 'alertType', value);
|
||||||
})}>
|
// })}>
|
||||||
{
|
// {
|
||||||
[
|
// [
|
||||||
{id: 'None', name: 'None'},
|
// {id: 'None', name: 'None'},
|
||||||
{id: 'Once', name: 'Once'},
|
// {id: 'Once', name: 'Once'},
|
||||||
{id: 'Always', name: 'Always'},
|
// {id: 'Always', name: 'Always'},
|
||||||
].map((item, index) => <Option key={index} value={item.id}>{item.name}</Option>)
|
// ].map((item, index) => <Option key={index} value={item.id}>{item.name}</Option>)
|
||||||
}
|
// }
|
||||||
</Select>
|
// </Select>
|
||||||
)
|
// )
|
||||||
}
|
// }
|
||||||
},
|
// },
|
||||||
{
|
{
|
||||||
title: i18next.t("general:Action"),
|
title: i18next.t("general:Action"),
|
||||||
key: 'action',
|
key: 'action',
|
||||||
@ -178,6 +194,10 @@ class ProviderTable extends React.Component {
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
if (!this.props.application.enableSignUp || this.props.application.enablePassword) {
|
||||||
|
columns = columns.filter(column => column.key !== "canSignUp");
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Table rowKey="index" columns={columns} dataSource={table} size="middle" bordered pagination={false}
|
<Table rowKey="index" columns={columns} dataSource={table} size="middle" bordered pagination={false}
|
||||||
title={() => (
|
title={() => (
|
||||||
|
@ -99,6 +99,10 @@ class SignupTable extends React.Component {
|
|||||||
key: 'visible',
|
key: 'visible',
|
||||||
width: '120px',
|
width: '120px',
|
||||||
render: (text, record, index) => {
|
render: (text, record, index) => {
|
||||||
|
if (record.name === "ID") {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Switch checked={text} onChange={checked => {
|
<Switch checked={text} onChange={checked => {
|
||||||
this.updateField(table, index, 'visible', checked);
|
this.updateField(table, index, 'visible', checked);
|
||||||
@ -134,6 +138,10 @@ class SignupTable extends React.Component {
|
|||||||
key: 'prompted',
|
key: 'prompted',
|
||||||
width: '120px',
|
width: '120px',
|
||||||
render: (text, record, index) => {
|
render: (text, record, index) => {
|
||||||
|
if (record.name === "ID") {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
if (record.visible) {
|
if (record.visible) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user