Skip to content

Commit 9ce4616

Browse files
authored
Add owner can promote to owner. (#68)
1 parent 159118e commit 9ce4616

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/components/Users/UserListItem.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { Card, CardGroup, Button, Modal, Form } from 'react-bootstrap';
44
import { capitalize } from 'lodash';
55
import { useSelector } from 'react-redux';
66
import API from '../../apis/API';
7-
import { isManagement } from '../../util/util';
7+
import { isOwner, isManagement } from '../../util/util';
88
import { getIDfromRole, getRoleFromID } from '../shared/userRoleHelpers';
99

1010
const CHANGE_ROLE = 'CHANGE ROLE';
@@ -62,6 +62,7 @@ export default function UserListItem({ user: propUser }) {
6262
onChange={(e) => setNewUserRole(e.target.value)}
6363
>
6464
<option />
65+
{isOwner(currentUser) && <option>Owner</option>}
6566
<option>Manager</option>
6667
<option>Buyer</option>
6768
<option>Cashier</option>

src/util/util.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ export const isDevelopment = () => {
22
return process.env.NODE_ENV === 'development';
33
};
44

5+
export const isOwner = (user) => {
6+
return user.userLevelID === parseInt(process.env.REACT_APP_DB_OWNER_ID, 10);
7+
};
8+
59
export const isManagement = (user) => {
610
return (
711
user.userLevelID === parseInt(process.env.REACT_APP_DB_OWNER_ID, 10) ||

0 commit comments

Comments
 (0)