Skip to content
This repository has been archived by the owner on Apr 24, 2024. It is now read-only.

Feature/1182 collaborator api communication with keycloak #1184

Open
wants to merge 41 commits into
base: master
Choose a base branch
from

Conversation

Bushuo
Copy link
Contributor

@Bushuo Bushuo commented Feb 10, 2024

Basics

  • The PR is rebased with current master
  • I added a line to changelog.md
  • Details of what I changed are in the commit messages
  • References to issues, e.g. close #X, are in the commit messages and changelog
  • The buildserver is happy

Checklist

  • I fully described what my PR does in the documentation
  • I fixed all affected documentation
  • I fixed the introduction tour
  • I wrote migrations in a way that they are compatible with already present data
  • I fixed all affected decisions
  • I added automated tests or a manual test protocol
  • I added code comments, logging, and assertions as appropriate
  • I translated all strings visible to the user
  • I mentioned every code or binary not directly written or done by me in reuse syntax
  • I created left-over issues for things that are still to be done
  • Code is conforming to our Architecture
  • Code is conforming to our Guidelines
  • Code is consistent to our Design Decisions
  • Exceptions to any guidelines are documented

First Time Checklist

Review

  • I've tested the code
  • I've read through the whole code
  • I've read through the whole documentation
  • I've checked conformity to guidelines
  • I've checked conformity to requirements
  • I've checked that the requirements are tested

@Bushuo Bushuo linked an issue Feb 10, 2024 that may be closed by this pull request
4 tasks
@Bushuo Bushuo marked this pull request as draft February 10, 2024 10:26
@Bushuo
Copy link
Contributor Author

Bushuo commented Feb 10, 2024

jenkins build please

@Bushuo
Copy link
Contributor Author

Bushuo commented Feb 11, 2024

@markus2330

Die Variablen hinzuzufügen ist aber glaub ich noch zu früh, da ist imho noch Diskussionsbedarf. Lieber wäre mir eigentlich es gäbe so etwas wie KEYCLOAK_PASSWORD nicht, und es wird der Login vom Frontend verwendet.

Das ist leider nach meinem Erkenntnisstand nicht möglich. Die Admin REST API erfordert einen Login über den Admin Account. Das hab ich nur mit den variablen die ich definiert habe geschafft.

Damit könnte man dann auch steuern, dass nur Members andere Members sehen können (und nicht die Gäste).

Das verstehe ich nicht. Die role (member) kommt aus dem Token. Die anderen user kommen über ein request an die admin rest api. Man kann wsl auch die role mit der Admin api abfragen und dann filtern was als Suchergebnis zurück kommt.

Copy link
Contributor

@markus2330 markus2330 left a comment

Choose a reason for hiding this comment

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

Fantastic work! ❤️

Some suggestions how I would prefer the keycloak config to be but I didn't check if keycloak actually provides this possibility. So maybe the current way already is the best. 🚀

"owner" renames etc. could also be in follow up (and is probably even better).

Please always try to say why something is draft or what is open, it helps in a review.

Das ist leider nach meinem Erkenntnisstand nicht möglich. Die Admin REST API erfordert einen Login über den Admin Account. Das hab ich nur mit den variablen die ich definiert habe geschafft.

Thx for clarification.

Damit könnte man dann auch steuern, dass nur Members andere Members sehen können (und nicht die Gäste).
Das verstehe ich nicht. Die role (member) kommt aus dem Token. Die anderen user kommen über ein request an die admin rest api. Man kann wsl auch die role mit der Admin api abfragen und dann filtern was als Suchergebnis zurück kommt.

Yes, looks like you already do what I meant. I meant that the person who is requesting to search for others should be restricted if (s)he is not a member.

backend/.env.sample Outdated Show resolved Hide resolved
backend/load-testing/README.md Outdated Show resolved Hide resolved
backend/load-testing/src/oauth/keycloak.js Outdated Show resolved Hide resolved
backend/src/controller/map_collaborators.rs Show resolved Hide resolved
backend/src/controller/map_collaborators.rs Outdated Show resolved Hide resolved
backend/src/schema.patch Show resolved Hide resolved
doc/changelog.md Show resolved Hide resolved
@Bushuo Bushuo marked this pull request as ready for review February 16, 2024 20:11
@Bushuo
Copy link
Contributor Author

Bushuo commented Feb 16, 2024

@markus2330 I think this PR is ready now

Copy link
Contributor

@chr-schr chr-schr left a comment

Choose a reason for hiding this comment

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

I just reviewed this PR and it overall it looks solid to me 👍
One problem is it breaks the devcontainer (missing the new AUTH_HOST env var)
Also had some minor suggestions / thoughts.

doc/backend/01setup.md Show resolved Hide resolved
}

futures
// TODO: restrict concurrency
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we create a ticket for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I do not know if it is problematic to potentially send an unbounded amount of update queries to the DBMS.
We could open a discussion in the diesel_async repo and ask for guidance.

backend/src/keycloak_api/api.rs Outdated Show resolved Hide resolved
backend/src/service/map_collaborator.rs Outdated Show resolved Hide resolved
Copy link
Contributor Author

@Bushuo Bushuo left a comment

Choose a reason for hiding this comment

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

I just reviewed this PR and it overall it looks solid to me 👍

Thanks for the review. Nice catches :)

@markus2330 markus2330 removed the request for review from horenso February 19, 2024 11:57
@markus2330
Copy link
Contributor

@lukashartl and I will try tomorrow to fix the env vars and do the Keycloak setup.

@Bushuo
Copy link
Contributor Author

Bushuo commented Feb 19, 2024

@lukashartl and I will try tomorrow to fix the env vars and do the Keycloak setup.

Ping me if you need assistance.

@Bushuo
Copy link
Contributor Author

Bushuo commented Feb 26, 2024

@markus2330
what is the status of your testing? I would like to get this merged or keep working on it if it still needs work.

@Bushuo Bushuo force-pushed the feature/1182-collaborator-api-communication-with-keycloak branch from 2068e67 to 0a25c97 Compare February 26, 2024 18:55
@markus2330
Copy link
Contributor

what is the status of your testing? I would like to get this merged or keep working on it if it still needs work.

I'll start testing when also frontend is ready. We can merge this when @lukashartl has fixed our keycloak+infrastructure to accept the env vars. We probably even need 3 steps:

  1. first fix pr.permaplant.net
  2. then dev.permaplant.net (and retrigger master builds until it works)
  3. and then fix www.permaplant.net (and release again)

@Bushuo
Copy link
Contributor Author

Bushuo commented Mar 2, 2024

I'll start testing when also frontend is ready.

Ok. I have the frontend ready on a separate branch that is based on this branch.
I decided to rework the map creation and edit page. This also fixes #706, #1166 and #1163.
Should I open another PR for it, even though this is not merged?

We can merge this when @lukashartl has fixed our keycloak+infrastructure to accept the env vars.

Alright, I also have a fix for #755, the first two of #1093 and #480.
They all depend on this to be merged first.

@Bushuo Bushuo force-pushed the feature/1182-collaborator-api-communication-with-keycloak branch from 0a25c97 to ec5e929 Compare March 2, 2024 13:56
@markus2330
Copy link
Contributor

jenkins build please

@markus2330
Copy link
Contributor

markus2330 commented Mar 26, 2024

Keycloak was now reconfigured for this PR, let us see if the build succeeds.

@markus2330
Copy link
Contributor

Failed with:

/home/jenkins/workspace/PermaplanT_PR-1184@2/frontend/node_modules/vite/node_modules/rollup/dist/native.js:64

		throw new Error(

		      ^


Error: Cannot find module @rollup/rollup-linux-x64-gnu. npm has a bug related to optional dependencies

@Bushuo
Copy link
Contributor Author

Bushuo commented Mar 26, 2024

@markus2330
thats good news.
I will get it to build in the evening.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Collaborator API & communication with Keycloak
4 participants