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

Issue 214 - User settings should show if the user is disabled #222

Merged
merged 1 commit into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
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
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;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that this variable is always true for enabled and disabled users, so the lock icon is being shown for all users. Maybe this is related to the way the data is retrieved (not 100% sure though).

Copy link
Collaborator Author

@mreynolds389 mreynolds389 Dec 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok I originally built this on top of your kabob work. So I think we need to get your PR's merged first then this will start working correctly

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, so maybe we can postpone the review of this one until all kebab PRs are merged.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is working now, so I'm resolving this conversation thread.


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
Loading