Skip to content

Commit

Permalink
Issue 214 - User settings should show if the user is disabled
Browse files Browse the repository at this point in the history
If a user is disabled then show a "locked" icon next tothe user name in
the userSettings page

fixes: #214

Signed-off-by: Mark Reynolds <mreynolds@redhat.com>
  • Loading branch information
mreynolds389 committed Jan 22, 2024
1 parent d8527ee commit c66cfbe
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
22 changes: 21 additions & 1 deletion src/pages/ActiveUsers/ActiveUsersTabs.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { useState } from "react";
// PatternFly
import {
Icon,
Title,
Page,
PageSection,
Expand All @@ -25,6 +26,7 @@ import BreadcrumbLayout from "src/components/layouts/BreadcrumbLayout";
import DataSpinner from "src/components/layouts/DataSpinner";
// Hooks
import { useUserSettings } from "src/hooks/useUserSettingsData";
import LockIcon from "@patternfly/react-icons/dist/esm/icons/lock-icon";

const ActiveUsersTabs = () => {
// Get location (React Router DOM) and get state data
Expand Down Expand Up @@ -58,6 +60,8 @@ const ActiveUsersTabs = () => {
return <DataSpinner />;
}

const disabled = userSettingsData.user.nsaccountlock;

return (
<Page>
<PageSection variant={PageSectionVariants.light} className="pf-v5-u-pr-0">
Expand All @@ -68,7 +72,23 @@ const ActiveUsersTabs = () => {
/>
<TextContent>
<Title headingLevel="h1">
<Text>{userData.uid}</Text>
<Text
className="pf-v5-u-display-flex"
title={disabled ? "User is disabled" : ""}
>
{userData.uid}
{disabled ? (
<Icon
className="pf-v5-u-ml-sm pf-v5-u-mt-sm"
status="info"
size="md"
>
<LockIcon />
</Icon>
) : (
""
)}
</Text>
</Title>
</TextContent>
</PageSection>
Expand Down
2 changes: 1 addition & 1 deletion src/utils/userUtils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ export const objectToUser = (
krbcanonicalname:
partialUser.krbcanonicalname || oldUserObject?.krbcanonicalname || [],
nsaccountlock:
partialUser.nsaccountlock || oldUserObject?.nsaccountlock || true,
partialUser.nsaccountlock || oldUserObject?.nsaccountlock || false,
objectclass: partialUser.objectclass || oldUserObject?.objectclass || [],
ipauniqueid: partialUser.ipauniqueid || oldUserObject?.ipauniqueid || "",
ipantsecurityidentifier:
Expand Down

0 comments on commit c66cfbe

Please sign in to comment.