Skip to content

Commit

Permalink
remove organisation_permissions flag (#638)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyle-ssg authored Jan 4, 2022
1 parent 0cf69cf commit 4f9380a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
6 changes: 2 additions & 4 deletions frontend/common/stores/permissions-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,8 @@ const controller = {
if (store.model.availablePermissions.projects) {
return;
}
const permissions = ['project', 'environment'];
if (flagsmith.hasFeature('organisation_permissions')) {
permissions.push('organisation');
}
const permissions = ['project', 'environment', 'organisation'];

Promise.all(permissions.map(v => data.get(`${Project.api}${v}s/permissions/`)
.then((res) => {
store.model.availablePermissions[v] = res;
Expand Down
7 changes: 3 additions & 4 deletions frontend/web/components/pages/OrganisationSettingsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,6 @@ const OrganisationSettingsPage = class extends Component {
const hasRbacPermission = !this.props.hasFeature('plan_based_access') || Utils.getPlansPermission(AccountStore.getPlans(), 'RBAC');
const paymentsEnabled = this.props.hasFeature('payments_enabled');
const force2faPermission = Utils.getPlansPermission(AccountStore.getPlans(), 'FORCE_2FA');
const organisationPermissionsEnabled = this.props.hasFeature('organisation_permissions');

return (
<div className="app-container container">
Expand Down Expand Up @@ -526,15 +525,15 @@ const OrganisationSettingsPage = class extends Component {
renderRow={(user, i) => {
const { id, first_name, last_name, email, role } = user;
const onEditClick = () => {
if (role !== 'ADMIN' && organisationPermissionsEnabled) {
if (role !== 'ADMIN') {
this.editUserPermissions(user);
}
};
return (
<Row
data-test={`user-${i}`}

space className={'list-item' + `${role === 'ADMIN' || !organisationPermissionsEnabled ? '' : ' clickable'}`} key={id}
space className={'list-item clickable'} key={id}
>
<Flex onClick={onEditClick}>

Expand Down Expand Up @@ -576,7 +575,7 @@ const OrganisationSettingsPage = class extends Component {
)}
</Column>

{role !== 'ADMIN' && organisationPermissionsEnabled && (
{role !== 'ADMIN' && (
<Column onClick={onEditClick}>
<Button className="btn--link">Edit Permissions</Button>
</Column>
Expand Down
4 changes: 2 additions & 2 deletions frontend/web/components/pages/ProjectSelectPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const ProjectSelectPage = class extends Component {
<div className="col-md-3 pl-0 pr-0">
<Permission level="organisation" permission="CREATE_PROJECT" id={AccountStore.getOrganisation().id}>
{({ permission, isLoading }) => {
const canCreate = permission || !this.props.hasFeature('organisation_permissions');
const canCreate = permission;
return Utils.renderWithPermission(permission, Constants.environmentPermissions('Create Project'), (
<Button disabled={!canCreate} className="float-right btn__md-full mb-md-0 mb-3" onClick={this.newProject}>
Create Project
Expand Down Expand Up @@ -121,7 +121,7 @@ const ProjectSelectPage = class extends Component {
<div>
<Permission level="organisation" permission="CREATE_PROJECT" id={AccountStore.getOrganisation().id}>
{({ permission, isLoading }) => {
const canCreate = permission || !this.props.hasFeature('organisation_permissions');
const canCreate = permission;
return Utils.renderWithPermission(permission, Constants.environmentPermissions('Create Project'), (
<button
disabled={!canCreate}
Expand Down

0 comments on commit 4f9380a

Please sign in to comment.