Skip to content

Commit

Permalink
feat: display create component on a structure only for admin (#634)
Browse files Browse the repository at this point in the history
  • Loading branch information
EmmanuelDemey authored Feb 20, 2024
1 parent 49824f6 commit 45f7172
Showing 1 changed file with 17 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { ComponentDetail } from '../component-detail';

import PropTypes from 'prop-types';
import { useSelector } from 'react-redux';
import { Stores } from 'bauhaus-utilities';
import { Auth, Stores } from 'bauhaus-utilities';
import Representation from '../representation';

export const StructureComponentsSelector = ({
Expand Down Expand Up @@ -177,13 +177,13 @@ export const StructureComponentsSelector = ({
<span className="glyphicon glyphicon-eye-open"></span>
</button>
<button
data-component-id={component.identifiant}
onClick={specificationClickHandler}
aria-label={D.componentSpecificationTitle}
title={D.componentSpecificationTitle}
>
<span className="glyphicon glyphicon-cog"></span>
</button>
data-component-id={component.identifiant}
onClick={specificationClickHandler}
aria-label={D.componentSpecificationTitle}
title={D.componentSpecificationTitle}
>
<span className="glyphicon glyphicon-cog"></span>
</button>
{!readOnly && (
<button
data-component-id={component.identifiant}
Expand Down Expand Up @@ -227,13 +227,15 @@ export const StructureComponentsSelector = ({
<React.Fragment>
{D.componentTitle}{' '}
{!readOnly && (
<button
id="add-component"
aria-label={D.addComponentTitle}
onClick={handleCreateComponent}
>
<span className="glyphicon glyphicon-plus"></span>
</button>
<Auth.AuthGuard roles={[Auth.ADMIN]}>
<button
id="add-component"
aria-label={D.addComponentTitle}
onClick={handleCreateComponent}
>
<span className="glyphicon glyphicon-plus"></span>
</button>
</Auth.AuthGuard>
)}
</React.Fragment>
}
Expand Down

0 comments on commit 45f7172

Please sign in to comment.