Skip to content
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
12 changes: 10 additions & 2 deletions apps/meteor/client/components/UserInfo/UserInfo.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ WithVoiceCallExtension.args = {

export const WithABACAttributes = Template.bind({});
WithABACAttributes.args = {
// @ts-expect-error - abacAttributes is not yet implemented in Users properties
abacAttributes: ['Classified', 'Top Secret', 'Confidential'],
abacAttributes: [
{
key: 'Classified',
values: ['Top Secret', 'Confidential'],
},
{
key: 'Security_Clearance',
values: ['Top Secret', 'Confidential'],
},
],
};
2 changes: 1 addition & 1 deletion apps/meteor/client/components/UserInfo/UserInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ const UserInfo = ({
{abacAttributes && abacAttributes.length > 0 && (
<InfoPanelField>
<InfoPanelLabel title={t('ABAC_Attributes_description')}>{t('ABAC_Attributes')}</InfoPanelLabel>
<UserInfoABACAttributes abacAttributes={abacAttributes.map((attribute) => attribute.key)} />
<UserInfoABACAttributes abacAttributes={abacAttributes} />
</InfoPanelField>
)}
{userCustomFields?.map(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
import type { IAbacAttributeDefinition } from '@rocket.chat/core-typings';
import { Box, Margins } from '@rocket.chat/fuselage';

import UserInfoABACAttribute from './UserInfoABACAttribute';

type UserInfoABACAttributesProps = {
abacAttributes: string[];
abacAttributes: IAbacAttributeDefinition[];
};

const UserInfoABACAttributes = ({ abacAttributes }: UserInfoABACAttributesProps) => {
return (
<Box m='neg-x2'>
<Box flexWrap='wrap' display='flex' flexShrink={0} mb={8}>
{abacAttributes.map((attribute, index) => (
<Margins inline={2} blockEnd={4} key={`${attribute}-${index}`}>
<UserInfoABACAttribute attribute={attribute} />
</Margins>
))}
{abacAttributes.map((attribute, index) =>
attribute.values.map((value) => (
<Margins inline={2} blockEnd={4} key={`${attribute.key}-${value}-${index}`}>
<UserInfoABACAttribute attribute={value} />
</Margins>
)),
)}
</Box>
</Box>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -509,21 +509,36 @@ exports[`renders WithABACAttributes without crashing 1`] = `
>
<span
class="rcx-tag__inner"
/>
>
Top Secret
</span>
</span>
<span
class="rcx-box rcx-box--full rcx-tag rcx-tag--secondary-warning rcx-css-1drnhgd"
>
<span
class="rcx-tag__inner"
>
Confidential
</span>
</span>
<span
class="rcx-box rcx-box--full rcx-tag rcx-tag--secondary-warning rcx-css-1drnhgd"
>
<span
class="rcx-tag__inner"
/>
>
Top Secret
</span>
</span>
<span
class="rcx-box rcx-box--full rcx-tag rcx-tag--secondary-warning rcx-css-1drnhgd"
>
<span
class="rcx-tag__inner"
/>
>
Confidential
</span>
</span>
</div>
</div>
Expand Down
Loading