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

General: Ensure manually created users can log in #7209

Merged
merged 4 commits into from
Sep 22, 2023

Conversation

b-fein
Copy link
Contributor

@b-fein b-fein commented Sep 15, 2023

Checklist

General

Server

  • Important: I implemented the changes with a very good performance and prevented too many (unnecessary) database calls.
  • I followed the coding and design guidelines.
  • I added multiple integration tests (Spring) related to the features (with a high test coverage).
  • I documented the Java code using JavaDoc style.

Motivation and Context

When manually creating users as admin, the admin can select from a few roles the user can have. By default none of the options is selected. However, to be able to construct a valid token for login the user needs to have at lease one role. This is typically the STUDENT/USER role that has no special permissions.

Description

Updated the user creation logic to always include at least this role if no other ones have been defined for the user.

Steps for Testing

Prerequisites:

  • 1 Admin
  1. As admin, go to the user management page.
  2. Create a new user. You can select a set of roles for the new user.
  3. Select none of the roles, the newly created user should still be able to log in to Artemis afterwards.

Review Progress

Code Review

  • Code Review 1
  • Code Review 2

Manual Tests

  • Test 1
  • Test 2

Test Coverage

Class/File Line Coverage Confirmation (assert/expect)
UserCreationService.java 94%

@github-actions github-actions bot added tests server Pull requests that update Java code. (Added Automatically!) labels Sep 15, 2023
@b-fein b-fein marked this pull request as ready for review September 15, 2023 21:09
@b-fein b-fein requested a review from a team as a code owner September 15, 2023 21:09
@terlan98 terlan98 temporarily deployed to artemis-test5.artemis.cit.tum.de September 16, 2023 06:34 — with GitHub Actions Inactive
Copy link
Contributor

@terlan98 terlan98 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested on TS5. I was able to log in with a new user that did not have any roles specified during creation 👍

Copy link
Contributor

@JohannesStoehr JohannesStoehr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good to me

Copy link
Contributor

@Strohgelaender Strohgelaender left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code lgtm

@b-fein b-fein requested a review from chrisknedl September 18, 2023 17:42
Copy link
Contributor

@chrisknedl chrisknedl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested on my local setup. Everything worked as described above.

@b-fein b-fein added this to the 6.5.1 milestone Sep 19, 2023
@krusche krusche modified the milestones: 6.5.1, 6.5.2 Sep 21, 2023
@krusche krusche merged commit 856f588 into develop Sep 22, 2023
14 of 19 checks passed
@krusche krusche deleted the fix-user-always-has-role branch September 22, 2023 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix ready to merge server Pull requests that update Java code. (Added Automatically!) small tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants