From 7ce55766a9b2a5ae13b5cfd0c27141e8fde250b7 Mon Sep 17 00:00:00 2001 From: Alex Velez Date: Tue, 25 Jun 2024 16:17:56 -0500 Subject: [PATCH] Manage user persmissions to view users management in LOD --- kolibri/core/assets/src/views/SideNav.vue | 6 +++++- .../device/assets/src/users/views/UsersPageIndex.vue | 4 ++-- .../device/assets/src/users/views/UsersSideNavEntry.js | 6 ++++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/kolibri/core/assets/src/views/SideNav.vue b/kolibri/core/assets/src/views/SideNav.vue index 6d4f23beab4..6eb60ef1163 100644 --- a/kolibri/core/assets/src/views/SideNav.vue +++ b/kolibri/core/assets/src/views/SideNav.vue @@ -359,7 +359,8 @@ .filter(item => item.section !== NavComponentSections.ACCOUNT) .sort(this.compareMenuItems) .filter(this.filterByRole) - .filter(this.filterByFullFacilityOnly); + .filter(this.filterByFullFacilityOnly) + .filter(this.filterByLODOnly); }, accountItems() { const accountItems = this.navItems @@ -473,6 +474,9 @@ filterByFullFacilityOnly(item) { return !this.isLearnerOnlyImport || !item.fullFacilityOnly; }, + filterByLODOnly(item) { + return this.isLearnerOnlyImport || !item.lodOnly; + }, /** * @public diff --git a/kolibri/plugins/device/assets/src/users/views/UsersPageIndex.vue b/kolibri/plugins/device/assets/src/users/views/UsersPageIndex.vue index 6371f236f1e..d3988c4943b 100644 --- a/kolibri/plugins/device/assets/src/users/views/UsersPageIndex.vue +++ b/kolibri/plugins/device/assets/src/users/views/UsersPageIndex.vue @@ -42,9 +42,9 @@ }; }, computed: { - ...mapGetters(['isUserLoggedIn']), + ...mapGetters(['canManageContent']), userIsAuthorized() { - return this.isUserLoggedIn; + return this.canManageContent; }, }, created() { diff --git a/kolibri/plugins/device/assets/src/users/views/UsersSideNavEntry.js b/kolibri/plugins/device/assets/src/users/views/UsersSideNavEntry.js index aad1f1cb5a7..c794c4d7771 100644 --- a/kolibri/plugins/device/assets/src/users/views/UsersSideNavEntry.js +++ b/kolibri/plugins/device/assets/src/users/views/UsersSideNavEntry.js @@ -1,4 +1,4 @@ -import { UserKinds } from 'kolibri.coreVue.vuex.constants'; +import { UserKinds, NavComponentSections } from 'kolibri.coreVue.vuex.constants'; import registerNavItem from 'kolibri.utils.registerNavItem'; import urls from 'kolibri.urls'; import coreStrings from 'kolibri.utils.coreStrings'; @@ -11,5 +11,7 @@ registerNavItem({ return coreStrings.$tr('usersLabel'); }, icon: 'audience', - role: UserKinds.ADMIN, + role: UserKinds.CAN_MANAGE_CONTENT, + section: NavComponentSections.ACCOUNT, + lodOnly: true, });