Allow for retrieval of User by username and UserId #47

Closed
opened 2026-04-02 14:04:50 +02:00 by lars.winzer · 8 comments
lars.winzer commented 2026-04-02 14:04:50 +02:00 (Migrated from git.scicore.unibas.ch)

Feature Request

Summary

The UserRegistry currently only allows for the retrieval of a user by its SessionId.

However, UserRegistry already has several maps, with both the username and UserId as the key, that would make implementation very simple.

Required workarround

You are required to get all users, iterate over them and compare each username with the wanted until you find your match.

Description

The SessionRegistry should have additional methods like:

  • findByUserId: Looks up a user by thier UserId
  • findByUsername: Looks up a user by thier username

Both will, same as the already existing method (getBySessionId) return an Optional of User.

Checklist

  • I have described the function in detail
  • I searched docs for alternative implementations matching my needs
  • I added relevant labels
## Feature Request <!--The reccommended type is: Task--> ### Summary The UserRegistry currently only allows for the retrieval of a user by its SessionId. However, UserRegistry already has several maps, with both the username and UserId as the key, that would make implementation very simple. ### Required workarround You are required to get all users, iterate over them and compare each username with the wanted until you find your match. ### Description The SessionRegistry should have additional methods like: * `findByUserId`: Looks up a user by thier `UserId` * `findByUsername`: Looks up a user by thier username Both will, same as the already existing method (`getBySessionId`) return an Optional of User. ### Checklist - [x] I have described the function in detail - [x] I searched docs for alternative implementations matching my needs - [x] I added relevant labels
lars.winzer commented 2026-04-02 14:05:08 +02:00 (Migrated from git.scicore.unibas.ch)

This feature request is based on #39

This feature request is based on #39
lars.winzer commented 2026-04-02 14:07:51 +02:00 (Migrated from git.scicore.unibas.ch)

assigned to @lars.winzer

assigned to @lars.winzer
lars.winzer commented 2026-04-02 14:08:12 +02:00 (Migrated from git.scicore.unibas.ch)

created branch feat/47-sessionregistry-get-by-userid-and-username to address this issue

created branch [`feat/47-sessionregistry-get-by-userid-and-username`](/cs108-fs26/Gruppe-13/-/compare/main...feat%2F47-sessionregistry-get-by-userid-and-username) to address this issue
lars.winzer commented 2026-04-02 14:19:27 +02:00 (Migrated from git.scicore.unibas.ch)

added 5m of time spent at 2026-04-02 12:00:00 +0200

added 5m of time spent at 2026-04-02 12:00:00 +0200
lars.winzer commented 2026-04-02 14:20:15 +02:00 (Migrated from git.scicore.unibas.ch)

Moving forward, the methods now have the get prefix, instead of the find prefix.

Moving forward, the methods now have the get prefix, instead of the find prefix.
lars.winzer commented 2026-04-02 14:22:19 +02:00 (Migrated from git.scicore.unibas.ch)

mentioned in merge request !74

mentioned in merge request !74
lars.winzer commented 2026-04-02 14:23:43 +02:00 (Migrated from git.scicore.unibas.ch)

mentioned in commit cf64f11912

mentioned in commit cf64f11912966566a428c7130f5d40fe27a75187
lars.winzer (Migrated from git.scicore.unibas.ch) closed this issue 2026-04-02 14:23:44 +02:00
lars.winzer commented 2026-04-02 15:09:07 +02:00 (Migrated from git.scicore.unibas.ch)

mentioned in merge request !75

mentioned in merge request !75
This repo is archived. You cannot comment on issues.
1 Participants
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: University-of-Basel-Studentprojects/Programmierprojekt#47