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

BC-8519 - add room owner role #3473

Merged
merged 11 commits into from
Dec 16, 2024
3 changes: 3 additions & 0 deletions src/modules/data/room/roomMembers/roomMembers.composable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ export const useRoomMembers = (roomId: string) => {
};

const userRoles: Record<string, string> = {
[RoleName.Roomowner]: t("common.labels.teacher"),
[RoleName.Roomadmin]: t("common.labels.teacher"),
[RoleName.Roomeditor]: t("common.labels.teacher"),
[RoleName.Roomviewer]: t("common.labels.teacher"),
};

const roomApi = RoomApiFactory(undefined, "/v3", $axios);
Expand Down
8 changes: 7 additions & 1 deletion src/modules/feature/room/RoomMembers/MembersTable.vue
muratmerdoglu-dp marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
item-value="userId"
mobile-breakpoint="sm"
:items="memberList"
item-selectable="isSelectable"
:headers="tableHeader"
:items-per-page-options="[5, 10, 25, 50, 100]"
:items-per-page="50"
Expand All @@ -69,6 +70,7 @@
<template #[`item.actions`]="{ item, index }">
<v-btn
:data-testid="`remove-member-${index}`"
v-if="item.roleName !== RoleName.Roomowner"
size="x-small"
variant="text"
:aria-label="getRemoveAriaLabel(item)"
Expand All @@ -90,7 +92,7 @@ import {
mdiMagnify,
mdiTrashCanOutline,
} from "@icons/material";
import { RoomMemberResponse } from "@/serverApi/v3";
import { RoleName, RoomMemberResponse } from "@/serverApi/v3";
import {
ConfirmationDialog,
useConfirmationDialog,
Expand Down Expand Up @@ -189,6 +191,10 @@ const tableHeader = [
font-weight: bold;
}

:deep(.v-data-table__td .v-selection-control--disabled) {
color: rgba(var(--v-theme-on-surface), var(--v-disabled-opacity));
}

.table-title-header {
min-height: 50px;
}
Expand Down
12 changes: 11 additions & 1 deletion src/modules/page/room/RoomMembers.page.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ import { MembersTable, AddMembers } from "@feature-room";
import { RoleName, RoomMemberResponse } from "@/serverApi/v3";
import { useDisplay } from "vuetify";

import { authModule } from "@/store/store-accessor";

const { fetchRoom } = useRoomDetailsStore();
const { t } = useI18n();
const route = useRoute();
Expand All @@ -83,7 +85,15 @@ const {
getSchools,
removeMembers,
} = useRoomMembers(roomId);
const memberList: Ref<RoomMemberResponse[]> = ref(roomMembers);
const currentUserId = authModule.getUser?.id ?? "";
const memberList: Ref<RoomMemberResponse[]> = computed(() => {
return roomMembers.value.map((member) => ({
...member,
isSelectable: !(
member.userId === currentUserId || member.roleName === RoleName.Roomowner
),
}));
});
NFriedo marked this conversation as resolved.
Show resolved Hide resolved
const pageTitle = computed(() =>
buildPageTitle(`${room.value?.name} - ${t("pages.rooms.members.manage")}`)
);
Expand Down
10 changes: 10 additions & 0 deletions src/serverApi/v3/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,9 @@ export enum AuthorizationContextParamsRequiredPermissionsEnum {
RoomEdit = 'ROOM_EDIT',
RoomView = 'ROOM_VIEW',
RoomDelete = 'ROOM_DELETE',
RoomMembersAdd = 'ROOM_MEMBERS_ADD',
RoomMembersRemove = 'ROOM_MEMBERS_REMOVE',
RoomChangeOwner = 'ROOM_CHANGE_OWNER',
SchoolChatManage = 'SCHOOL_CHAT_MANAGE',
SchoolCreate = 'SCHOOL_CREATE',
SchoolEdit = 'SCHOOL_EDIT',
Expand Down Expand Up @@ -6887,6 +6890,9 @@ export enum Permission {
RoomEdit = 'ROOM_EDIT',
RoomView = 'ROOM_VIEW',
RoomDelete = 'ROOM_DELETE',
RoomMembersAdd = 'ROOM_MEMBERS_ADD',
RoomMembersRemove = 'ROOM_MEMBERS_REMOVE',
RoomChangeOwner = 'ROOM_CHANGE_OWNER',
SchoolChatManage = 'SCHOOL_CHAT_MANAGE',
SchoolCreate = 'SCHOOL_CREATE',
SchoolEdit = 'SCHOOL_EDIT',
Expand Down Expand Up @@ -7309,6 +7315,8 @@ export enum RoleName {
Helpdesk = 'helpdesk',
Roomviewer = 'roomviewer',
Roomeditor = 'roomeditor',
Roomadmin = 'roomadmin',
Roomowner = 'roomowner',
Student = 'student',
Superhero = 'superhero',
Teacher = 'teacher',
Expand Down Expand Up @@ -9480,6 +9488,8 @@ export interface UserIdAndRole {
* @enum {string}
*/
export enum UserIdAndRoleRoleNameEnum {
Roomowner = 'roomowner',
Roomadmin = 'roomadmin',
Roomeditor = 'roomeditor',
Roomviewer = 'roomviewer'
}
Expand Down
Loading