Skip to content

Commit

Permalink
Fixed SHIBUI-2435 - enable button for admins
Browse files Browse the repository at this point in the history
  • Loading branch information
rmathis committed Oct 28, 2022
1 parent 4ae88e1 commit b47c71e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ui/src/app/core/user/UserContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ function useIsAdminOrInGroup() {
function useCanEnable() {
const isAdmin = useIsAdmin();
const isEnabler = useIsEnabler();
return isAdmin || isEnabler;
return (approved) => isAdmin ? true : (isEnabler && approved);
}

function useIsApprover() {
Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/metadata/domain/source/component/SourceList.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export default function SourceList({ entities, onDelete, onEnable, onApprove, on
</td>
<td className="text-center align-middle">
<span className="d-flex justify-content-center align-items-center">
{onEnable && (canEnable && source.approved) ?
{onEnable && canEnable(source.approved) ?
<Form.Check
type="switch"
id={`enable-switch-${idx}`}
Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/metadata/view/MetadataOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export function MetadataOptions ({reload}) {

const enabled = type === 'source' ? metadata.serviceEnabled : metadata.enabled;

const canEnable = useCanEnable();
const canEnable = useCanEnable()(metadata.approved);
const isAdmin = useIsAdmin();
const canApprove = useIsApprover();

Expand Down

0 comments on commit b47c71e

Please sign in to comment.