diff --git a/services/web/frontend/js/features/subscription/components/dashboard/managed-group-subscriptions.tsx b/services/web/frontend/js/features/subscription/components/dashboard/managed-group-subscriptions.tsx
index b4077f9a45..1ebe224821 100644
--- a/services/web/frontend/js/features/subscription/components/dashboard/managed-group-subscriptions.tsx
+++ b/services/web/frontend/js/features/subscription/components/dashboard/managed-group-subscriptions.tsx
@@ -88,6 +88,9 @@ function ManagedGroupAdministrator({
export default function ManagedGroupSubscriptions() {
const { t } = useTranslation()
+
+ const usersEmail = getMeta('ol-usersEmail')
+
const { managedGroupSubscriptions } = useSubscriptionDashboardContext()
if (!managedGroupSubscriptions) {
@@ -101,6 +104,8 @@ export default function ManagedGroupSubscriptions() {
return (
<>
{managedGroupSubscriptions.map(subscription => {
+ const isAdmin = usersEmail === subscription.admin_id.email
+
return (
{t('group_management')}
@@ -126,17 +131,19 @@ export default function ManagedGroupSubscriptions() {
{groupSettingsAdvertisedFor?.includes(subscription._id) && (
)}
-
- sendMB('group-audit-log-click', {
- subscriptionId: subscription._id,
- })
- }
- />
+ {isAdmin && (
+
+ sendMB('group-audit-log-click', {
+ subscriptionId: subscription._id,
+ })
+ }
+ />
+ )}
', function () {
expect(links[2].getAttribute('href')).to.equal(
'/manage/groups/bcd567/managers'
)
- expect(links[3].getAttribute('href')).to.equal(
- '/manage/groups/bcd567/audit-logs'
- )
- expect(links[4].getAttribute('href')).to.equal('/metrics/groups/bcd567')
- expect(links[6].getAttribute('href')).to.equal(
+ expect(links[3].getAttribute('href')).to.equal('/metrics/groups/bcd567')
+ expect(links[5].getAttribute('href')).to.equal(
'/manage/groups/def456/members'
)
- expect(links[7].getAttribute('href')).to.equal(
+ expect(links[6].getAttribute('href')).to.equal(
'/manage/groups/def456/managers'
)
- expect(links[9].getAttribute('href')).to.equal('/metrics/groups/def456')
- expect(links[11].getAttribute('href')).to.equal(
+ expect(links[7].getAttribute('href')).to.equal('/metrics/groups/def456')
+ expect(links[9].getAttribute('href')).to.equal(
'/manage/groups/group2abc/members'
)
- expect(links[12].getAttribute('href')).to.equal(
+ expect(links[10].getAttribute('href')).to.equal(
'/manage/groups/group2abc/managers'
)
- expect(links[14].getAttribute('href')).to.equal('/metrics/groups/group2abc')
- expect(links[16].getAttribute('href')).to.equal(
+ expect(links[12].getAttribute('href')).to.equal('/metrics/groups/group2abc')
+ expect(links[14].getAttribute('href')).to.equal(
'/manage/groups/group123abc/members'
)
- expect(links[17].getAttribute('href')).to.equal(
+ expect(links[15].getAttribute('href')).to.equal(
'/manage/groups/group123abc/managers'
)
- expect(links[19].getAttribute('href')).to.equal(
+ expect(links[17].getAttribute('href')).to.equal(
'/metrics/groups/group123abc'
)
})
@@ -180,6 +177,37 @@ describe('', function () {
.be.null
})
+ it('does not render the Group Audit Log settings row when the user is not the group admin', function () {
+ renderWithSubscriptionDashContext(, {
+ metaTags: [
+ {
+ name: 'ol-managedGroupSubscriptions',
+ value: managedGroupSubscriptions2,
+ },
+ {
+ name: 'ol-groupSettingsEnabledFor',
+ value: [],
+ },
+ ],
+ })
+
+ expect(screen.queryByText('Audit logs')).to.be.null
+ })
+
+ it('renders the Group Audit Log settings row when the user is the group admin', async function () {
+ renderWithSubscriptionDashContext(, {
+ metaTags: [
+ {
+ name: 'ol-managedGroupSubscriptions',
+ value: managedGroupSubscriptions,
+ },
+ { name: 'ol-usersEmail', value: 'admin@example.com' },
+ ],
+ })
+
+ await screen.findAllByText('Audit logs')
+ })
+
it('renders Managed Group / Group SSO settings row when both features are turned on', async function () {
renderWithSubscriptionDashContext(, {
metaTags: [