Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit e8d3ac4

Browse files
committed
feat: permission for editing Jobs
ref issue #100
1 parent 2918e8d commit e8d3ac4

File tree

2 files changed

+23
-10
lines changed

2 files changed

+23
-10
lines changed

src/constants/permissions.js

+9
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,15 @@ export const PERMISSIONS = {
8080
/**
8181
* Job
8282
*/
83+
UPDATE_JOB_NOT_OWN: {
84+
meta: {
85+
group: "Job",
86+
title: "Edit Job (not own)",
87+
description: "Who can edit job created by some other user.",
88+
},
89+
topcoderRoles: [TOPCODER_ROLE.BOOKING_MANAGER, TOPCODER_ROLE.ADMINISTRATOR],
90+
},
91+
8392
UPDATE_JOB_STATUS: {
8493
meta: {
8594
group: "Job",

src/routes/JobDetails/index.jsx

+14-10
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ import IconOpenings from "../../assets/images/icon-openings.svg";
2222
import Button from "../../components/Button";
2323
import { formatDate } from "utils/format";
2424
import "./styles.module.scss";
25+
import { hasPermission } from "utils/permissions";
26+
import { PERMISSIONS } from "constants/permissions";
2527

2628
const JobDetails = ({ teamId, jobId }) => {
2729
const [job, loadingError] = useData(getJobById, jobId);
@@ -95,16 +97,18 @@ const JobDetails = ({ teamId, jobId }) => {
9597
{job.status}
9698
</DataItem>
9799
</div>
98-
<div styleName="actions">
99-
<Button
100-
target="_blank"
101-
size="medium"
102-
className="editButton"
103-
routeTo={`/taas/myteams/${teamId}/positions/${job.id}/edit`}
104-
>
105-
Edit Job Details
106-
</Button>
107-
</div>
100+
{hasPermission(PERMISSIONS.UPDATE_JOB_NOT_OWN) && (
101+
<div styleName="actions">
102+
<Button
103+
target="_blank"
104+
size="medium"
105+
className="editButton"
106+
routeTo={`/taas/myteams/${teamId}/positions/${job.id}/edit`}
107+
>
108+
Edit Job Details
109+
</Button>
110+
</div>
111+
)}
108112
</div>
109113
</>
110114
)}

0 commit comments

Comments
 (0)