Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow managers to see device's users #1270

Merged
merged 1 commit into from
Sep 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/settings/DevicesPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import CollectionActions from './components/CollectionActions';
import TableShimmer from '../common/components/TableShimmer';
import SearchHeader, { filterByKeyword } from './components/SearchHeader';
import { formatTime } from '../common/util/formatter';
import { useAdministrator, useDeviceReadonly } from '../common/util/permissions';
import { useDeviceReadonly, useManager } from '../common/util/permissions';
import useSettingsStyles from './common/useSettingsStyles';
import DeviceUsersValue from './components/DeviceUsersValue';

Expand All @@ -25,7 +25,7 @@ const DevicesPage = () => {

const groups = useSelector((state) => state.groups.items);

const admin = useAdministrator();
const manager = useManager();
const deviceReadonly = useDeviceReadonly();

const [timestamp, setTimestamp] = useState(Date.now());
Expand Down Expand Up @@ -73,7 +73,7 @@ const DevicesPage = () => {
<TableCell>{t('deviceModel')}</TableCell>
<TableCell>{t('deviceContact')}</TableCell>
<TableCell>{t('userExpirationTime')}</TableCell>
{admin && <TableCell>{t('settingsUsers')}</TableCell>}
{manager && <TableCell>{t('settingsUsers')}</TableCell>}
<TableCell className={classes.columnAction} />
</TableRow>
</TableHead>
Expand All @@ -87,7 +87,7 @@ const DevicesPage = () => {
<TableCell>{item.model}</TableCell>
<TableCell>{item.contact}</TableCell>
<TableCell>{formatTime(item.expirationTime, 'date')}</TableCell>
{admin && <TableCell><DeviceUsersValue deviceId={item.id} /></TableCell>}
{manager && <TableCell><DeviceUsersValue deviceId={item.id} /></TableCell>}
<TableCell className={classes.columnAction} padding="none">
<CollectionActions
itemId={item.id}
Expand All @@ -99,14 +99,14 @@ const DevicesPage = () => {
/>
</TableCell>
</TableRow>
)) : (<TableShimmer columns={admin ? 8 : 7} endAction />)}
)) : (<TableShimmer columns={manager ? 8 : 7} endAction />)}
</TableBody>
<TableFooter>
<TableRow>
<TableCell>
<Button onClick={handleExport} variant="text">{t('reportExport')}</Button>
</TableCell>
<TableCell colSpan={admin ? 8 : 7} align="right">
<TableCell colSpan={manager ? 8 : 7} align="right">
<FormControlLabel
control={(
<Switch
Expand All @@ -117,7 +117,7 @@ const DevicesPage = () => {
)}
label={t('notificationAlways')}
labelPlacement="start"
disabled={!admin}
disabled={!manager}
/>
</TableCell>
</TableRow>
Expand Down