diff --git a/frontend/common/project.js b/frontend/common/project.js index 3ee99c8fab49..c20ad3572e64 100644 --- a/frontend/common/project.js +++ b/frontend/common/project.js @@ -1,3 +1,20 @@ +// Dev is unused +// module.exports = global.Project = { +// api: 'https://api-dev.flagsmith.com/api/v1/', +// flagsmithClientAPI: 'https://api.flagsmith.com/api/v1/', +// flagsmith: '8KzETdDeMY7xkqkSkY3Gsg', // This is our Bullet Train API key - Bullet Train runs on Bullet Train! +// debug: false, +// env: 'dev', // This is used for Sentry tracking +// maintenance: false, // trigger maintenance mode +// demoAccount: { +// email: 'kyle+bullet-train@solidstategroup.com', +// password: 'demo_account', +// }, +// chargebee: { +// site: 'flagsmith-test', +// }, +// }; + module.exports = global.Project = { api: 'https://api-staging.flagsmith.com/api/v1/', flagsmithClientAPI: 'https://api.flagsmith.com/api/v1/', diff --git a/frontend/env/project_dev.js b/frontend/env/project_dev.js index 06c6d01e2dba..c20ad3572e64 100644 --- a/frontend/env/project_dev.js +++ b/frontend/env/project_dev.js @@ -1,9 +1,25 @@ +// Dev is unused +// module.exports = global.Project = { +// api: 'https://api-dev.flagsmith.com/api/v1/', +// flagsmithClientAPI: 'https://api.flagsmith.com/api/v1/', +// flagsmith: '8KzETdDeMY7xkqkSkY3Gsg', // This is our Bullet Train API key - Bullet Train runs on Bullet Train! +// debug: false, +// env: 'dev', // This is used for Sentry tracking +// maintenance: false, // trigger maintenance mode +// demoAccount: { +// email: 'kyle+bullet-train@solidstategroup.com', +// password: 'demo_account', +// }, +// chargebee: { +// site: 'flagsmith-test', +// }, +// }; + module.exports = global.Project = { - api: 'https://api-dev.flagsmith.com/api/v1/', + api: 'https://api-staging.flagsmith.com/api/v1/', flagsmithClientAPI: 'https://api.flagsmith.com/api/v1/', - flagsmith: '8KzETdDeMY7xkqkSkY3Gsg', // This is our Bullet Train API key - Bullet Train runs on Bullet Train! - debug: false, - env: 'dev', // This is used for Sentry tracking + flagsmith: 'ENktaJnfLVbLifybz34JmX', // This is our Bullet Train API key - Bullet Train runs on Bullet Train! + env: 'staging', // This is used for Sentry tracking maintenance: false, // trigger maintenance mode demoAccount: { email: 'kyle+bullet-train@solidstategroup.com', diff --git a/frontend/web/components/pages/OrganisationSettingsPage.js b/frontend/web/components/pages/OrganisationSettingsPage.js index 1ba45c8eeee2..2eec60314c8b 100644 --- a/frontend/web/components/pages/OrganisationSettingsPage.js +++ b/frontend/web/components/pages/OrganisationSettingsPage.js @@ -84,19 +84,24 @@ const OrganisationSettingsPage = class extends Component { } save = (e) => { - e.preventDefault(); - const { name, webhook_notification_email } = this.state; - if (AccountStore.isSaving || (!name && webhook_notification_email === undefined)) { + e && e.preventDefault(); + const { name, webhook_notification_email, restrict_project_create_to_admin } = this.state; + if (AccountStore.isSaving) { return; } const org = AccountStore.getOrganisation(); AppActions.editOrganisation({ name: name || org.name, + restrict_project_create_to_admin: typeof restrict_project_create_to_admin === 'boolean' ? restrict_project_create_to_admin : undefined, webhook_notification_email: webhook_notification_email !== undefined ? webhook_notification_email : org.webhook_notification_email, }); } + setAdminCanCreateProject = (restrict_project_create_to_admin) => { + this.setState({ restrict_project_create_to_admin }, this.save); + } + saveDisabled = () => { const { name, webhook_notification_email } = this.state; if (AccountStore.isSaving || (!name && webhook_notification_email === undefined)) { @@ -701,6 +706,31 @@ const OrganisationSettingsPage = class extends Component { /> )} + {this.props.hasFeature('restrict_project_create_to_admin') && ( + + + +

Admin Settings

+ + Only allow organisation admins to create projects + this.setAdminCanCreateProject(!organisation.restrict_project_create_to_admin)} + /> + +
+ +
+ +
+ )}