Skip to content

Commit

Permalink
permissions tweaks to Bids (#737)
Browse files Browse the repository at this point in the history
- view_hidden_bid is a last resort, view_bid or change_bid are now sufficient

[#188391351]
  • Loading branch information
uraniumanchor authored Nov 6, 2024
1 parent 435bf97 commit fda6c87
Show file tree
Hide file tree
Showing 5 changed files with 323 additions and 230 deletions.
12 changes: 6 additions & 6 deletions bundles/admin/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { BrowserRouter, Link } from 'react-router-dom';
import { useConstants } from '@common/Constants';
import Loading from '@common/Loading';
import { actions } from '@public/api';
import { usePermissions } from '@public/api/helpers/auth';
import { usePermission } from '@public/api/helpers/auth';
import V2HTTPUtils from '@public/apiv2/HTTPUtils';
import Dropdown from '@public/dropdown';
import Spinner from '@public/spinner';
Expand Down Expand Up @@ -89,7 +89,7 @@ function DropdownMenu({ name, path }) {

function Menu() {
const { ADMIN_ROOT } = useConstants();
const canSeeHiddenBids = usePermissions(['tracker.change_bid', 'tracker.view_hidden_bid']);
const canChangeBids = usePermission('tracker.change_bid');
const { status } = useSelector(state => ({
status: state.status,
}));
Expand All @@ -105,7 +105,7 @@ function Menu() {
<DropdownMenu name="Schedule Editor" path="schedule_editor" />
&mdash;
<DropdownMenu name="Interstitials" path="interstitials" />
{canSeeHiddenBids && (
{canChangeBids && (
<>
&mdash;
<DropdownMenu name="Process Pending Bids" path="process_pending_bids" />
Expand All @@ -126,7 +126,7 @@ function App({ rootPath }) {
}));

const { API_ROOT, APIV2_ROOT } = useConstants();
const canSeeHiddenBids = usePermissions(['tracker.change_bid', 'tracker.view_hidden_bid']);
const canChangeBids = usePermission('tracker.change_bid');

React.useLayoutEffect(() => {
setAPIRoot(API_ROOT);
Expand Down Expand Up @@ -176,10 +176,10 @@ function App({ rootPath }) {
</React.Suspense>
}
/>
{canSeeHiddenBids && (
{canChangeBids && (
<Route path="process_pending_bids/" element={React.createElement(EventMenu('Process Pending Bids'))} />
)}
{canSeeHiddenBids && (
{canChangeBids && (
<Route
path="process_pending_bids/:eventId"
element={
Expand Down
Loading

0 comments on commit fda6c87

Please sign in to comment.