|
@@ -3,6 +3,7 @@ import {browserHistory, RouteComponentProps} from 'react-router';
|
|
|
|
|
|
import {addErrorMessage, addSuccessMessage} from 'sentry/actionCreators/indicator';
|
|
|
import {removeTeam, updateTeamSuccess} from 'sentry/actionCreators/teams';
|
|
|
+import {hasEveryAccess} from 'sentry/components/acl/access';
|
|
|
import {Button} from 'sentry/components/button';
|
|
|
import Confirm from 'sentry/components/confirm';
|
|
|
import FieldGroup from 'sentry/components/forms/fieldGroup';
|
|
@@ -12,10 +13,11 @@ import {Panel, PanelHeader} from 'sentry/components/panels';
|
|
|
import teamSettingsFields from 'sentry/data/forms/teamSettingsFields';
|
|
|
import {IconDelete} from 'sentry/icons';
|
|
|
import {t, tct} from 'sentry/locale';
|
|
|
-import {Organization, Scope, Team} from 'sentry/types';
|
|
|
+import {Organization, Team} from 'sentry/types';
|
|
|
import {normalizeUrl} from 'sentry/utils/withDomainRequired';
|
|
|
import withOrganization from 'sentry/utils/withOrganization';
|
|
|
import AsyncView from 'sentry/views/asyncView';
|
|
|
+import PermissionAlert from 'sentry/views/settings/project/permissionAlert';
|
|
|
|
|
|
type Props = RouteComponentProps<{teamId: string}, {}> & {
|
|
|
organization: Organization;
|
|
@@ -60,14 +62,17 @@ class TeamSettings extends AsyncView<Props, State> {
|
|
|
|
|
|
renderBody() {
|
|
|
const {organization, team} = this.props;
|
|
|
-
|
|
|
- const access = new Set<Scope>(organization.access);
|
|
|
const idpProvisioned = team.flags['idp:provisioned'];
|
|
|
const orgRoleList = organization.orgRoleList;
|
|
|
const hasOrgRoleFlag = organization.features.includes('org-roles-for-teams');
|
|
|
|
|
|
+ const hasTeamWrite = hasEveryAccess(['team:write'], {organization, team});
|
|
|
+ const hasOrgAdmin = hasEveryAccess(['org:admin'], {organization, team});
|
|
|
+
|
|
|
return (
|
|
|
<Fragment>
|
|
|
+ <PermissionAlert access={['team:write']} team={team} />
|
|
|
+
|
|
|
<Form
|
|
|
apiMethod="PUT"
|
|
|
apiEndpoint={`/teams/${organization.slug}/${team.slug}/`}
|
|
@@ -82,8 +87,13 @@ class TeamSettings extends AsyncView<Props, State> {
|
|
|
}}
|
|
|
>
|
|
|
<JsonForm
|
|
|
- access={access}
|
|
|
- additionalFieldProps={{idpProvisioned, hasOrgRoleFlag, orgRoleList}}
|
|
|
+ additionalFieldProps={{
|
|
|
+ idpProvisioned,
|
|
|
+ hasOrgRoleFlag,
|
|
|
+ hasTeamWrite,
|
|
|
+ hasOrgAdmin,
|
|
|
+ orgRoleList,
|
|
|
+ }}
|
|
|
forms={teamSettingsFields}
|
|
|
/>
|
|
|
</Form>
|
|
@@ -97,7 +107,7 @@ class TeamSettings extends AsyncView<Props, State> {
|
|
|
>
|
|
|
<div>
|
|
|
<Confirm
|
|
|
- disabled={!access.has('team:admin')}
|
|
|
+ disabled={!hasOrgAdmin}
|
|
|
onConfirm={this.handleRemoveTeam}
|
|
|
priority="danger"
|
|
|
message={tct('Are you sure you want to remove the team [team]?', {
|
|
@@ -107,7 +117,7 @@ class TeamSettings extends AsyncView<Props, State> {
|
|
|
<Button
|
|
|
icon={<IconDelete />}
|
|
|
priority="danger"
|
|
|
- disabled={!access.has('team:admin')}
|
|
|
+ data-test-id="button-remove-team"
|
|
|
>
|
|
|
{t('Remove Team')}
|
|
|
</Button>
|