Skip to content

Commit 6b3ff10

Browse files
authored
Securizing bucket tags (#1249)
1 parent 53d278a commit 6b3ff10

File tree

1 file changed

+57
-37
lines changed

1 file changed

+57
-37
lines changed

portal-ui/src/screens/Console/Buckets/BucketDetails/BucketSummaryPanel.tsx

Lines changed: 57 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -617,43 +617,63 @@ const BucketSummary = ({
617617
</td>
618618
</tr>
619619
</SecureComponent>
620-
<tr>
621-
<td className={classes.titleCol}>Tags:</td>
622-
<td>
623-
{tagKeys &&
624-
tagKeys.map((tagKey: any, index: any) => {
625-
const tag = get(tags, `${tagKey}`, "");
626-
if (tag !== "") {
627-
return (
628-
<Chip
629-
key={`chip-${index}`}
630-
className={classes.tag}
631-
size="small"
632-
label={`${tagKey} : ${tag}`}
633-
color="primary"
634-
deleteIcon={<CloseIcon />}
635-
onDelete={() => {
636-
deleteTag(tagKey, tag);
637-
}}
638-
/>
639-
);
640-
}
641-
return null;
642-
})}
643-
<Chip
644-
className={classes.tag}
645-
icon={<AddIcon />}
646-
clickable
647-
size="small"
648-
label="Add tag"
649-
color="primary"
650-
variant="outlined"
651-
onClick={() => {
652-
setTagModalOpen(true);
653-
}}
654-
/>
655-
</td>
656-
</tr>
620+
<SecureComponent
621+
scopes={[IAM_SCOPES.S3_GET_BUCKET_TAGGING]}
622+
resource={bucketName}
623+
>
624+
<tr>
625+
<td className={classes.titleCol}>Tags:</td>
626+
<td>
627+
{tagKeys &&
628+
tagKeys.map((tagKey: any, index: any) => {
629+
const tag = get(tags, `${tagKey}`, "");
630+
if (tag !== "") {
631+
return (
632+
<SecureComponent
633+
key={`chip-${index}`}
634+
scopes={[IAM_SCOPES.S3_PUT_BUCKET_TAGGING]}
635+
resource={bucketName}
636+
matchAll
637+
errorProps={{
638+
deleteIcon: null,
639+
onDelete: null,
640+
}}
641+
>
642+
<Chip
643+
className={classes.tag}
644+
size="small"
645+
label={`${tagKey} : ${tag}`}
646+
color="primary"
647+
deleteIcon={<CloseIcon />}
648+
onDelete={() => {
649+
deleteTag(tagKey, tag);
650+
}}
651+
/>
652+
</SecureComponent>
653+
);
654+
}
655+
return null;
656+
})}
657+
<SecureComponent
658+
scopes={[IAM_SCOPES.S3_PUT_BUCKET_TAGGING]}
659+
resource={bucketName}
660+
>
661+
<Chip
662+
className={classes.tag}
663+
icon={<AddIcon />}
664+
clickable
665+
size="small"
666+
label="Add tag"
667+
color="primary"
668+
variant="outlined"
669+
onClick={() => {
670+
setTagModalOpen(true);
671+
}}
672+
/>
673+
</SecureComponent>
674+
</td>
675+
</tr>
676+
</SecureComponent>
657677
</tbody>
658678
</table>
659679
</Grid>

0 commit comments

Comments
 (0)