Skip to content

Commit c7f9761

Browse files
fix
1 parent c6999c2 commit c7f9761

File tree

3 files changed

+62
-7
lines changed

3 files changed

+62
-7
lines changed

services/web/server/src/simcore_service_webserver/conversations/_controller/_conversations_messages_rest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,9 @@ async def create_conversation_message(request: web.Request):
118118
)
119119
_url = request.url
120120
if _url.port:
121-
_conversation_url = f"{_url.scheme}://{_url.host}:{_url.port}/#/conversations/{path_params.conversation_id}"
121+
_conversation_url = f"{_url.scheme}://{_url.host}:{_url.port}/#/conversation/{path_params.conversation_id}"
122122
else:
123-
_conversation_url = f"{_url.scheme}://{_url.host}/#/conversations/{path_params.conversation_id}"
123+
_conversation_url = f"{_url.scheme}://{_url.host}/#/conversation/{path_params.conversation_id}"
124124
_extra_context = _conversation.extra_context
125125
await email_service.send_email_from_template(
126126
request,

services/web/server/src/simcore_service_webserver/groups/_groups_repository.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -550,12 +550,16 @@ async def list_users_in_group(
550550

551551
# Get all users in the group
552552
query = (
553-
sa.select(*_GROUP_COLUMNS)
554-
.select_from(
555-
groups.join(
556-
user_to_groups, user_to_groups.c.gid == groups.c.gid, isouter=True
557-
).join(users, users.c.id == user_to_groups.c.uid)
553+
sa.select(
554+
users.c.id,
555+
users.c.name,
556+
users.c.email,
557+
users.c.first_name,
558+
users.c.last_name,
559+
users.c.primary_gid,
560+
# user_to_groups.c.access_rights, # <-- currently not neccessary, might be added if needed
558561
)
562+
.select_from(users.join(user_to_groups, users.c.id == user_to_groups.c.uid))
559563
.where(user_to_groups.c.gid == group_id)
560564
)
561565

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# pylint: disable=redefined-outer-name
2+
# pylint: disable=too-many-arguments
3+
# pylint: disable=unused-argument
4+
# pylint: disable=unused-variable
5+
6+
import pytest
7+
from aiohttp.test_utils import TestClient
8+
from models_library.groups import GroupMember, StandardGroupCreate
9+
from pytest_simcore.helpers.webserver_users import UserInfoDict
10+
from simcore_postgres_database.models.users import UserRole
11+
from simcore_service_webserver.groups._groups_repository import (
12+
create_standard_group,
13+
delete_standard_group,
14+
list_users_in_group,
15+
)
16+
17+
18+
@pytest.mark.parametrize("user_role", [UserRole.USER])
19+
async def test_list_users_in_group_owner_only(
20+
client: TestClient,
21+
user_role: UserRole,
22+
logged_user: UserInfoDict,
23+
):
24+
"""Test list_users_in_group returns only the owner for a new group."""
25+
assert client.app
26+
27+
# Create a standard group
28+
group, _ = await create_standard_group(
29+
app=client.app,
30+
user_id=logged_user["id"],
31+
create=StandardGroupCreate(
32+
name="Test Owner Only Group",
33+
description="A test group to check owner-only user list",
34+
thumbnail=None,
35+
),
36+
)
37+
38+
try:
39+
# List users in the group - should only contain the owner
40+
users_in_group = await list_users_in_group(app=client.app, group_id=group.gid)
41+
42+
# Should contain exactly one user (the owner)
43+
assert len(users_in_group) == 1
44+
assert isinstance(users_in_group[0], GroupMember)
45+
assert users_in_group[0].id == logged_user["id"]
46+
47+
finally:
48+
# Clean up
49+
await delete_standard_group(
50+
app=client.app, user_id=logged_user["id"], group_id=group.gid
51+
)

0 commit comments

Comments
 (0)