Skip to content

Commit

Permalink
UI: Hide attributes permissions for non admin users (#372)
Browse files Browse the repository at this point in the history
  • Loading branch information
KWMORALE committed May 14, 2021
1 parent 101ed68 commit 70d9e72
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions mwdb/web/src/components/Settings/Views/AttributeDetails.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import React, { useState } from "react";
import React, { useState, useContext } from "react";
import { Link, useHistory } from "react-router-dom";
import api from "@mwdb-web/commons/api";
import {
getErrorMessage,
ConfirmationModal,
EditableItem,
} from "@mwdb-web/commons/ui";
import { AuthContext, Capability } from "@mwdb-web/commons/auth";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";

function AttributeItem(props) {
Expand All @@ -19,6 +20,7 @@ function AttributeItem(props) {
}

export function AttributeDetails({ attribute, getAttribute }) {
const auth = useContext(AuthContext);
const history = useHistory();
const [isDeleteModalOpen, setDeleteModalOpen] = useState(false);
const [isDeleteModalDisabled, setDeleteModalDisabled] = useState(false);
Expand Down Expand Up @@ -108,12 +110,14 @@ export function AttributeDetails({ attribute, getAttribute }) {
<b>Actions:</b>
<ul className="nav">
<li className="nav-item">
<Link
className="nav-link"
to={`/admin/attribute/${attribute.key}/permissions`}
>
Show attribute permissions
</Link>
{auth.hasCapability(Capability.manageUsers) && (
<Link
className="nav-link"
to={`/admin/attribute/${attribute.key}/permissions`}
>
Edit attribute permissions
</Link>
)}
<a
href="#remove-user"
className="nav-link text-danger"
Expand Down

0 comments on commit 70d9e72

Please sign in to comment.