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

feat: add dropdown to make user an org admin workspaces #1771

Merged
merged 1 commit into from
Mar 5, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,13 @@ import { PER_PAGE_OPTIONS } from '../../../../helpers/shared/pagination';
import messages from '../../../../Messages';
import paths from '../../../../utilities/pathnames';
import PermissionsContext from '../../../../utilities/permissions-context';
import OrgAdminDropdown from '../../../user/OrgAdminDropdown';
import { useFlag } from '@unleash/proxy-client-react';

const COLUMNS: string[] = ['Username', 'Email', 'First name', 'Last name', 'Status', 'Org admin'];
const authModel = useFlag('platform.rbac.common-auth-model');
const COLUMNS: string[] = authModel
? ['Org admin', 'Username', 'Email', 'First name', 'Last name', 'Status']
: ['Username', 'Email', 'First name', 'Last name', 'Status', 'Org admin'];

const EmptyTable: React.FunctionComponent<{ titleText: string }> = ({ titleText }) => {
return (
Expand Down Expand Up @@ -210,6 +215,27 @@ const UsersTable: React.FunctionComponent<UsersTableProps> = ({ onAddUserClick,
id: user.username,
is_active: user.is_active,
row: [
authModel && orgAdmin ? (
<OrgAdminDropdown
Copy link
Contributor

Choose a reason for hiding this comment

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

We should hide this behind a feature flag platform.rbac.common-auth-model so if it's not available to show the org.admin as previously. Also only org. admins can change this, so we should toggle between this and static field based on rights.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

key={`dropdown-${user.username}`}
isOrgAdmin={user.is_org_admin}
username={user.username}
intl={intl}
userId={user.uuid}
fetchData={() => {
fetchData({
limit: perPage,
offset: (page - 1) * perPage,
orderBy: 'username',
count: totalCount || 0,
});
}}
/>
) : user.is_org_admin ? (
intl.formatMessage(messages['usersAndUserGroupsYes'])
) : (
intl.formatMessage(messages['usersAndUserGroupsNo'])
),
user.username,
user.email,
user.first_name,
Expand All @@ -225,7 +251,8 @@ const UsersTable: React.FunctionComponent<UsersTableProps> = ({ onAddUserClick,
labelOff={intl.formatMessage(messages['usersAndUserGroupsInactive'])}
></Switch>,
],
user.is_org_admin ? intl.formatMessage(messages['usersAndUserGroupsYes']) : intl.formatMessage(messages['usersAndUserGroupsNo']),
!authModel &&
(user.is_org_admin ? intl.formatMessage(messages['usersAndUserGroupsYes']) : intl.formatMessage(messages['usersAndUserGroupsNo'])),
{
cell: (
<ActionsColumn
Expand Down