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

Adding User Manager #21

Merged
merged 3 commits into from
Jan 25, 2024
Merged

Adding User Manager #21

merged 3 commits into from
Jan 25, 2024

Conversation

A-Guldborg
Copy link
Contributor

@A-Guldborg A-Guldborg commented Dec 19, 2023

Adds a way to manage the group that a user belongs to.

Fixes #6

User interface looks like this:
image

We can only edit one element at a time (remaining edit icons are disabled until you commit / cancel changes).
Search field uses backend search engine meaning we only pass a query
Only UserGroup field is editable. MudTable allows easily defining which elements are editable if we want to extend this in the future.

@A-Guldborg A-Guldborg added the enhancement New feature or request label Dec 19, 2023
@A-Guldborg A-Guldborg force-pushed the feature/user-manager branch from ff2a040 to a7bb8f3 Compare January 18, 2024 19:04
@A-Guldborg A-Guldborg marked this pull request as ready for review January 18, 2024 23:21
@A-Guldborg A-Guldborg requested a review from TTA777 January 18, 2024 23:32
@A-Guldborg A-Guldborg force-pushed the feature/user-manager branch from 8c081e3 to b7428e0 Compare January 25, 2024 18:03
Copy link
Member

@TTA777 TTA777 left a comment

Choose a reason for hiding this comment

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

lgtm

@TTA777 TTA777 merged commit e202646 into main Jan 25, 2024
2 checks passed
@TTA777 TTA777 deleted the feature/user-manager branch January 25, 2024 18:13
A-Guldborg added a commit to AnalogIO/analog-core that referenced this pull request Feb 27, 2024
Implements the endpoint `PUT /api/v2/webhooks/accounts/user-group`,
allowing an external service to update user groups in bulk.

Example request body:
```
{
   "privilegedUsers": [
       { "accountId": 123, "userGroup": "Manager" },
       { "accountId": 124, "userGroup": "Barista" }
    ]
}
```

The X-Api-Key header should be present on the request with a valid API
key.

The userGroup should be one of:
- Barista
- Manager
- Board
- (Customer will also work, but will have the same effect as not
specifying the user in the request)

### Notes on testing

I have been unable to implement an integration test, since
EFCore.InMemory does not seem to support the performance-optimized
ExecuteUpdate that is implemented in EF Core 7 and used in this service.
Reference:

https://stackoverflow.com/questions/74907256/ef-7-new-executedelete-and-executeupdate-methods-not-working-on-an-in-memory-d

### Business logic

Initially, business logic was implemented using client-side hashing to
verify duplicate requests did not use many resources. Later, it was
changed to server-side hashing however hashing was completely removed
again, as it would cause weird behaviour in combination with the below
mentioned existing endpoint. Now it will be clearer that the state in
the external system will correct itself if analog-core and the external
system are out of sync.

### Notes on affected existing endpoints

This change will also mark our `PATCH /api/v2/account/<id>/user-group`
endpoint, as any calls to the new endpoint will override any user-groups
set by the old patch endpoint.
The endpoint is used by the Shifty User Manager from
AnalogIO/shifty-webapp#21

---------

Co-authored-by: Jonas Anker Rasmussen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UI for managing the role of a user
2 participants