Sync-in · Sovereign platform for file storage, sharing, synchronization, and collaboration.
TypeScript cloud-alternativecollaborationcollaborative-editingdropboxfile-serverfile-sharingfile-storagefile-syncfull-text-searchhomelabnextcloudon-premiseopen-sourceprivacy-firstprivate-cloudrealtimesecureself-hostedstorage-serverwebdav
fix(users): ensure guests cannot be elected as group managers
johaven24e0d5760213
diff --git a/backend/src/applications/users/services/users-manager.service.ts b/backend/src/applications/users/services/users-manager.service.tsindex ceacc74f..5c9dd1d0 100755--- a/backend/src/applications/users/services/users-manager.service.ts+++ b/backend/src/applications/users/services/users-manager.service.ts@@ -391,6 +391,9 @@ export class UsersManager {if (!userToUpdate) {throw new HttpException('User was not found', HttpStatus.BAD_REQUEST)}+ if (userToUpdate.type === MEMBER_TYPE.GUEST && updateUserFromGroupDto.role === USER_GROUP_ROLE.MANAGER) {+ throw new HttpException('Guest cannot be a group manager', HttpStatus.FORBIDDEN)+ }if (userToUpdate.groupRole !== updateUserFromGroupDto.role) {if (userToUpdate.groupRole === USER_GROUP_ROLE.MANAGER) {if (currentGroup.members.filter((m) => m.groupRole === USER_GROUP_ROLE.MANAGER).length === 1) {diff --git a/backend/src/applications/users/services/users-queries.service.ts b/backend/src/applications/users/services/users-queries.service.tsindex c6024c65..d3ec8202 100644--- a/backend/src/applications/users/services/users-queries.service.ts+++ b/backend/src/applications/users/services/users-queries.service.ts@@ -252,7 +252,7 @@ export class UsersQueries {name: userFullNameSQL(users).as('name'),description: users.email,createdAt: usersGroups.createdAt,- type: sql<MEMBER_TYPE>`${MEMBER_TYPE.USER}`,+ type: sql<MEMBER_TYPE>`IF(${users.role} = ${USER_ROLE.GUEST}, ${sql.raw(`'${MEMBER_TYPE.GUEST}'`)}, ${sql.raw(`'${MEMBER_TYPE.USER}'`)})`,groupRole: sql<USER_GROUP_ROLE>`${usersGroups.role}`} satisfies Member | SelectedFields<any, any>).from(groups)@@ -315,7 +315,7 @@ export class UsersQueries {login: users.login,name: userFullNameSQL(users),description: users.email,- type: sql.raw(`'${MEMBER_TYPE.USER}'`),+ type: sql<MEMBER_TYPE>`IF(${users.role} = ${USER_ROLE.GUEST}, ${sql.raw(`'${MEMBER_TYPE.GUEST}'`)}, ${sql.raw(`'${MEMBER_TYPE.USER}'`)})`,groupRole: usersGroupsAlias.role,createdAt: dateTimeUTC(usersGroupsAlias.createdAt)} satisfies Record<keyof Pick<Member, 'id' | 'name' | 'login' | 'description' | 'type' | 'groupRole' | 'createdAt'>, any>)diff --git a/frontend/src/app/applications/users/components/user-groups.component.html b/frontend/src/app/applications/users/components/user-groups.component.htmlindex 4cc31796..3ab83a44 100644--- a/frontend/src/app/applications/users/components/user-groups.component.html+++ b/frontend/src/app/applications/users/components/user-groups.component.html@@ -118,15 +118,17 @@@if (m.isGroup) {<span l10nTranslate>{{ m.type }}</span>} @else {- <span l10nTranslate>{{ m.isGroupManager ? 'Manager' : 'Member' }}</span>+ <ng-container+ [ngTemplateOutlet]="userRoleTemplate"+ [ngTemplateOutletContext]="{ $implicit: m }">+ </ng-container>}}@case ('role') {- @if (m.isGroupManager) {- <span class="badge bg-primary" l10nTranslate>Manager</span>- } @else {- <span l10nTranslate>Member</span>- }+ <ng-container+ [ngTemplateOutlet]="userRoleTemplate"+ [ngTemplateOutletContext]="{ $implicit: m }">+ </ng-container>}@case ('members') {@if (m.isGroup) {@@ -159,6 +161,17 @@<span class="mx-auto">{{ members.length }} {{ 'groups' | translate:locale.language }}</span></div><!--End Foot Content-->+<!--Start Member Template -->+<ng-template #userRoleTemplate let-m>+ @if (m.isGroupManager) {+ <span class="badge bg-primary" l10nTranslate>Manager</span>+ } @else if (m.isGuest) {+ <span l10nTranslate>Guest</span>+ } @else {+ <span l10nTranslate>Member</span>+ }+</ng-template>+<!--End Member Template --><!--Start Context Menu --><context-menu #MainContextMenu>@if (allowedAction.addGroup || allowedAction.addUsers) {diff --git a/frontend/src/app/applications/users/components/user-groups.component.ts b/frontend/src/app/applications/users/components/user-groups.component.tsindex 06f97877..df328c63 100644--- a/frontend/src/app/applications/users/components/user-groups.component.ts+++ b/frontend/src/app/applications/users/components/user-groups.component.ts@@ -1,4 +1,4 @@-import { KeyValuePipe } from '@angular/common'+import { KeyValuePipe, NgTemplateOutlet } from '@angular/common'import { HttpErrorResponse } from '@angular/common/http'import { Component, ElementRef, inject, ViewChild } from '@angular/core'import { ActivatedRoute, Data, Router, UrlSegment } from '@angular/router'@@ -61,7 +61,8 @@ import { UserPersonalGroupLeaveDialogComponent } from './dialogs/user-personal-gBsDropdownToggleDirective,BsDropdownMenuDirective,TapDirective,- BadgeMembersComponent+ BadgeMembersComponent,+ NgTemplateOutlet],templateUrl: 'user-groups.component.html'})diff --git a/frontend/src/i18n/de.json b/frontend/src/i18n/de.jsonindex 2f7ec6a7..b37266d4 100644--- a/frontend/src/i18n/de.json+++ b/frontend/src/i18n/de.json@@ -74,6 +74,7 @@"Group not found": "Gruppe nicht gefunden","Group error": "Gruppenfehler","Set as group manager": "Als Gruppenmanager festlegen",+ "Guest cannot be a group manager": "Ein Gast kann kein Gruppenmanager sein","As a manager, the user will be able to manage the group and its members.": "Als Manager kann der Benutzer die Gruppe und ihre Mitglieder verwalten.","As a manager, the user will be able to manage group members but not group properties.": "Als Manager kann der Benutzer die Gruppenmitglieder verwalten, jedoch nicht die Gruppeneigenschaften.","Visible": "Sichtbar",diff --git a/frontend/src/i18n/es.json b/frontend/src/i18n/es.jsonindex caa72dcf..4bf3a4b6 100644--- a/frontend/src/i18n/es.json+++ b/frontend/src/i18n/es.json@@ -74,6 +74,7 @@"Group not found": "Grupo no encontrado","Group error": "Error del grupo","Set as group manager": "Definir como gestor del grupo",+ "Guest cannot be a group manager": "Un invitado no puede ser gestor del grupo","As a manager, the user will be able to manage the group and its members.": "Como gestor, el usuario podrá gestionar el grupo y sus miembros.","As a manager, the user will be able to manage group members but not group properties.": "Como gestor, el usuario podrá gestionar los miembros del grupo pero no las propiedades del grupo.\n","Visible": "Visible",diff --git a/frontend/src/i18n/fr.json b/frontend/src/i18n/fr.jsonindex 2a5412c9..34e26574 100644--- a/frontend/src/i18n/fr.json+++ b/frontend/src/i18n/fr.json@@ -74,6 +74,7 @@"Group not found": "Groupe non trouvé","Group error": "Groupe erreur","Set as group manager": "Définir comme manageur de groupe",+ "Guest cannot be a group manager": "Un invité ne peut pas être manageur de groupe","As a manager, the user will be able to manage the group and its members.": "En tant que manageur, l'utilisateur pourra gérer le groupe et ses membres.","As a manager, the user will be able to manage group members but not group properties.": "En tant que manageur, l'utilisateur pourra gérer les membres du groupe mais pas les propriétés du groupe.\n","Visible": "Visible",diff --git a/frontend/src/i18n/hi.json b/frontend/src/i18n/hi.jsonindex ae129ef7..9da91185 100644--- a/frontend/src/i18n/hi.json+++ b/frontend/src/i18n/hi.json@@ -74,6 +74,7 @@"Group not found": "समूह नहीं मिला","Group error": "समूह त्रुटि","Set as group manager": "समूह प्रबंधक के रूप में सेट करें",+ "Guest cannot be a group manager": "अतिथि समूह प्रबंधक नहीं हो सकता","As a manager, the user will be able to manage the group and its members.": "प्रबंधक के रूप में, उपयोगकर्ता समूह और उसके सदस्यों का प्रबंधन कर सकेगा।","As a manager, the user will be able to manage group members but not group properties.": "प्रबंधक के रूप में, उपयोगकर्ता समूह के सदस्यों का प्रबंधन कर सकेगा, पर समूह के गुणों का नहीं।\n","Visible": "दृश्यमान",diff --git a/frontend/src/i18n/it.json b/frontend/src/i18n/it.jsonindex 40ab9b3a..200fe753 100644--- a/frontend/src/i18n/it.json+++ b/frontend/src/i18n/it.json@@ -74,6 +74,7 @@"Group not found": "Gruppo non trovato","Group error": "Errore del gruppo","Set as group manager": "Imposta come gestore del gruppo",+ "Guest cannot be a group manager": "Un ospite non può essere gestore del gruppo","As a manager, the user will be able to manage the group and its members.": "Come gestore, l’utente potrà gestire il gruppo e i suoi membri.","As a manager, the user will be able to manage group members but not group properties.": "Come gestore, l’utente potrà gestire i membri del gruppo ma non le proprietà del gruppo.\n","Visible": "Visibile",diff --git a/frontend/src/i18n/ja.json b/frontend/src/i18n/ja.jsonindex 002b2dcd..c78589de 100644--- a/frontend/src/i18n/ja.json+++ b/frontend/src/i18n/ja.json@@ -74,6 +74,7 @@"Group not found": "グループが見つかりません","Group error": "グループエラー","Set as group manager": "グループマネージャーに設定",+ "Guest cannot be a group manager": "ゲストをグループマネージャーにすることはできません","As a manager, the user will be able to manage the group and its members.": "マネージャーはグループとそのメンバーを管理できます。","As a manager, the user will be able to manage group members but not group properties.": "マネージャーはグループのメンバーを管理できますが、グループのプロパティは管理できません。","Visible": "可視",diff --git a/frontend/src/i18n/ko.json b/frontend/src/i18n/ko.jsonindex 190c2de7..d72bdbcf 100644--- a/frontend/src/i18n/ko.json+++ b/frontend/src/i18n/ko.json@@ -74,6 +74,7 @@"Group not found": "그룹을 찾을 수 없습니다","Group error": "그룹 오류","Set as group manager": "그룹 관리자 지정",+ "Guest cannot be a group manager": "게스트는 그룹 관리자가 될 수 없습니다","As a manager, the user will be able to manage the group and its members.": "관리자는 그룹과 구성원을 관리할 수 있습니다.","As a manager, the user will be able to manage group members but not group properties.": "관리자는 구성원은 관리할 수 있으나 그룹 속성은 관리할 수 없습니다.","Visible": "표시",diff --git a/frontend/src/i18n/nl.json b/frontend/src/i18n/nl.jsonindex 25d915ef..75d76ac5 100644--- a/frontend/src/i18n/nl.json+++ b/frontend/src/i18n/nl.json@@ -74,6 +74,7 @@"Group not found": "Groep niet gevonden","Group error": "Fout met groep","Set as group manager": "Als groepsbeheerder instellen",+ "Guest cannot be a group manager": "Een gast kan geen groepsbeheerder zijn","As a manager, the user will be able to manage the group and its members.": "Als beheerder kan de gebruiker de groep en de leden ervan beheren.","As a manager, the user will be able to manage group members but not group properties.": "Als manager kan de gebruiker de leden en eigenschappen van de groep beheren.","Visible": "Zichtbaar",diff --git a/frontend/src/i18n/pl.json b/frontend/src/i18n/pl.jsonindex 57666998..cfbe6a0e 100644--- a/frontend/src/i18n/pl.json+++ b/frontend/src/i18n/pl.json@@ -74,6 +74,7 @@"Group not found": "Nie znaleziono grupy","Group error": "Błąd grupy","Set as group manager": "Ustaw jako menedżera grupy",+ "Guest cannot be a group manager": "Gość nie może być menedżerem grupy","As a manager, the user will be able to manage the group and its members.": "Jako menedżer użytkownik będzie mógł zarządzać grupą i jej członkami.","As a manager, the user will be able to manage group members but not group properties.": "Jako menedżer użytkownik będzie mógł zarządzać członkami grupy, ale nie jej właściwościami.","Visible": "Widoczna",diff --git a/frontend/src/i18n/pt-BR.json b/frontend/src/i18n/pt-BR.jsonindex b9fa1413..3d3296c1 100644--- a/frontend/src/i18n/pt-BR.json+++ b/frontend/src/i18n/pt-BR.json@@ -74,6 +74,7 @@"Group not found": "Grupo não encontrado","Group error": "Erro no grupo","Set as group manager": "Definir como gerente do grupo",+ "Guest cannot be a group manager": "Um convidado não pode ser gerente do grupo","As a manager, the user will be able to manage the group and its members.": "Como gerente, o usuário poderá gerenciar o grupo e seus membros.","As a manager, the user will be able to manage group members but not group properties.": "Como gerente, o usuário poderá gerenciar os membros, mas não as propriedades do grupo.","Visible": "Visível",diff --git a/frontend/src/i18n/pt.json b/frontend/src/i18n/pt.jsonindex 900f046a..1202a653 100644--- a/frontend/src/i18n/pt.json+++ b/frontend/src/i18n/pt.json@@ -74,6 +74,7 @@"Group not found": "Grupo não encontrado","Group error": "Erro do grupo","Set as group manager": "Definir como gerente do grupo",+ "Guest cannot be a group manager": "Um convidado não pode ser gerente do grupo","As a manager, the user will be able to manage the group and its members.": "Como gerente, o usuário poderá gerenciar o grupo e seus membros.","As a manager, the user will be able to manage group members but not group properties.": "Como gerente, o usuário poderá gerenciar os membros do grupo, mas não as propriedades do grupo.\n","Visible": "Visível",diff --git a/frontend/src/i18n/ru.json b/frontend/src/i18n/ru.jsonindex 69ed098f..b8063042 100644--- a/frontend/src/i18n/ru.json+++ b/frontend/src/i18n/ru.json@@ -74,6 +74,7 @@"Group not found": "Группа не найдена","Group error": "Ошибка группы","Set as group manager": "Назначить менеджером группы",+ "Guest cannot be a group manager": "Гость не может быть менеджером группы","As a manager, the user will be able to manage the group and its members.": "В качестве менеджера пользователь сможет управлять группой и её участниками.","As a manager, the user will be able to manage group members but not group properties.": "В качестве менеджера пользователь сможет управлять участниками группы, но не её свойствами.","Visible": "Видимая",diff --git a/frontend/src/i18n/tr.json b/frontend/src/i18n/tr.jsonindex 82d055a1..eedb49c2 100644--- a/frontend/src/i18n/tr.json+++ b/frontend/src/i18n/tr.json@@ -74,6 +74,7 @@"Group not found": "Grup bulunamadı","Group error": "Grup hatası","Set as group manager": "Grup yöneticisi yap",+ "Guest cannot be a group manager": "Misafir grup yöneticisi olamaz","As a manager, the user will be able to manage the group and its members.": "Yönetici, grubu ve üyelerini yönetebilir.","As a manager, the user will be able to manage group members but not group properties.": "Yönetici, grup üyelerini yönetebilir ancak grup özelliklerini yönetemez.","Visible": "Görünür",diff --git a/frontend/src/i18n/zh.json b/frontend/src/i18n/zh.jsonindex 0a4942fd..68dc0210 100644--- a/frontend/src/i18n/zh.json+++ b/frontend/src/i18n/zh.json@@ -74,6 +74,7 @@"Group not found": "未找到群组","Group error": "群组错误","Set as group manager": "设为群组管理者",+ "Guest cannot be a group manager": "访客不能成为群组管理者","As a manager, the user will be able to manage the group and its members.": "作为管理者,用户可以管理该群组及其成员。","As a manager, the user will be able to manage group members but not group properties.": "作为管理者,用户可以管理群组成员,但不能管理群组属性。\n","Visible": "可见",