Skip to content

Commit

Permalink
Supervisor profile (pr ticketz-oss#144 by @brunocgc)
Browse files Browse the repository at this point in the history
  • Loading branch information
allgood committed Aug 23, 2024
1 parent 5398b0c commit bf5c004
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
16 changes: 9 additions & 7 deletions frontend/src/components/TicketsManagerTabs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,14 @@ const TicketsManagerTabs = () => {
const [selectedTags, setSelectedTags] = useState([]);
const [selectedUsers, setSelectedUsers] = useState([]);

useEffect(() => {
if (user.profile.toUpperCase() === "ADMIN") {
setShowAllTickets(true);
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
useEffect(() => {
if (
user.profile.toUpperCase() === "ADMIN" ||
user.profile.toUpperCase() === "SUPERVISOR"
) {
setShowAllTickets(true);
}
}, [user]);

useEffect(() => {
if (tab === "search") {
Expand Down Expand Up @@ -320,7 +322,7 @@ const TicketsManagerTabs = () => {
</TabPanel>
<TabPanel value={tab} name="search" className={classes.ticketsWrapper}>
<TagsFilter onFiltered={handleSelectedTags} />
{profile === "admin" && (
{(profile === "admin" || profile === "supervisor") && (
<UsersFilter onFiltered={handleSelectedUsers} />
)}
<TicketsList
Expand Down
1 change: 1 addition & 0 deletions frontend/src/components/UserModal/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ const UserModal = ({ open, onClose, userId }) => {
required
>
<MenuItem value="admin">Admin</MenuItem>
<MenuItem value="supervisor">Supervisor</MenuItem>
<MenuItem value="user">User</MenuItem>
</Field>
</>
Expand Down
10 changes: 10 additions & 0 deletions frontend/src/rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@ const rules = {
static: [],
},

supervisor: {
static: [
"dashboard:view",
"tickets-manager:showall",
"ticket-options:deleteTicket",
"contacts-page:deleteContact",
"contact-modal:editUserDefault",
],
},

admin: {
static: [
//"dashboard:view",
Expand Down

0 comments on commit bf5c004

Please sign in to comment.