-
Notifications
You must be signed in to change notification settings - Fork 205
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
navigator supports user management #12187
Conversation
4e5bc16
to
498ef0d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks very plausible. Have you considered how this interacts with the Navigator config? Do we just stick to not handling user management there and only support party ids & human readable names?
As for tests, you could add some integration tests in https://github.com/digital-asset/daml/blob/main/navigator/backend/src/test/scala/com/digitalasset/navigator/backend/IntegrationTest.scala
...in/scala/com/digitalasset/ledger/client/services/version/withoutledgerid/VersionClient.scala
Outdated
Show resolved
Hide resolved
...in/scala/com/digitalasset/ledger/client/services/version/withoutledgerid/VersionClient.scala
Outdated
Show resolved
Hide resolved
navigator/backend/src/main/scala/com/digitalasset/navigator/store/platform/PlatformStore.scala
Outdated
Show resolved
Hide resolved
navigator/backend/src/main/scala/com/digitalasset/navigator/store/platform/PlatformStore.scala
Outdated
Show resolved
Hide resolved
navigator/backend/src/main/scala/com/digitalasset/navigator/store/platform/PlatformStore.scala
Outdated
Show resolved
Hide resolved
ad3c578
to
73113a1
Compare
73113a1
to
91acdf7
Compare
22bbe07
to
7e7d38c
Compare
I think this is now mostly complete. I need to factor out a few changes from this PR, but I think it's worth taking a look -- @stefanobaghino-da? One thing I can offer for bikeshedding is "--disable-user-management" (this PR) vs. "--feature-user-management" (#12420) |
a0ae915
to
4389c46
Compare
The test I added is failing on CI, while it passes on my mac. It's a connection error, and it looks like it's not retrying. I'll try to debug tomorrow. |
navigator/backend/src/main/scala/com/digitalasset/navigator/config/Arguments.scala
Show resolved
Hide resolved
navigator/backend/src/main/scala/com/digitalasset/navigator/config/Arguments.scala
Outdated
Show resolved
Hide resolved
navigator/backend/src/main/scala/com/digitalasset/navigator/model/PartyState.scala
Show resolved
Hide resolved
navigator/backend/src/main/scala/com/digitalasset/navigator/UIBackend.scala
Show resolved
Hide resolved
navigator/backend/src/test/scala/com/digitalasset/navigator/backend/IntegrationTest.scala
Outdated
Show resolved
Hide resolved
ledger/ledger-api-domain/src/main/scala/com/digitalasset/ledger/api/domain.scala
Outdated
Show resolved
Hide resolved
You can use The test here seems just racy, there is no fundamental reason why we should instantly connect to the ledger. Just wrapping it in an |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good so far. 🙇🏻♂️
...ient/src/main/scala/com/digitalasset/ledger/client/services/admin/UserManagementClient.scala
Outdated
Show resolved
Hide resolved
...in/scala/com/digitalasset/ledger/client/services/version/withoutledgerid/VersionClient.scala
Outdated
Show resolved
Hide resolved
...in/scala/com/digitalasset/ledger/client/services/version/withoutledgerid/VersionClient.scala
Outdated
Show resolved
Hide resolved
ledger/ledger-api-domain/src/main/scala/com/digitalasset/ledger/api/domain.scala
Outdated
Show resolved
Hide resolved
navigator/backend/src/main/scala/com/digitalasset/navigator/model/PartyState.scala
Show resolved
Hide resolved
navigator/backend/src/main/scala/com/digitalasset/navigator/store/platform/PlatformStore.scala
Outdated
Show resolved
Hide resolved
navigator/backend/src/main/scala/com/digitalasset/navigator/store/platform/PlatformStore.scala
Outdated
Show resolved
Hide resolved
navigator/backend/src/main/scala/com/digitalasset/navigator/store/platform/PlatformStore.scala
Show resolved
Hide resolved
navigator/backend/src/main/scala/com/digitalasset/navigator/store/platform/PlatformStore.scala
Show resolved
Hide resolved
navigator/backend/src/main/scala/com/digitalasset/navigator/store/platform/PlatformStore.scala
Outdated
Show resolved
Hide resolved
...pi-client/src/main/scala/com/digitalasset/ledger/client/services/version/VersionClient.scala
Outdated
Show resolved
Hide resolved
185d563
to
b44a0f5
Compare
b44a0f5
to
4d8929e
Compare
Windows test failure seems unrelated. Linux passes.
|
thx we’ll take a look. |
ca14cad
to
ad0d4c8
Compare
Added a commit to catch up with #12610. TODO: actually deal with user pagination... |
CHANGELOG_BEGIN CHANGELOG_END
CHANGELOG_BEGIN CHANGELOG_END
CHANGELOG_BEGIN CHANGELOG_END
CHANGELOG_BEGIN CHANGELOG_END
use parties XOR users use --feature-user-management CHANGELOG_BEGIN CHANGELOG_END
This resolves the cross-talk between tests Co-authored-by: Stefano Baghino <[email protected]> CHANGELOG_BEGIN CHANGELOG_END
CHANGELOG_BEGIN CHANGELOG_END
todo: actually deal with pagination...
ad0d4c8
to
491e785
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Unfortunately at the moment we don't have full UI tests (with Selenium or something along those lines). Have you been able to test the UI manually?
@@ -15,6 +14,7 @@ import scala.reflect.ClassTag | |||
final case class User( | |||
id: String, | |||
party: PartyState, | |||
// TODO: where is `role` used? frontend has some references, but doesn't seem to impact anything? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps @rautenrieth-da (who will have a chance to have a look at this on Tuesday, so not urgent) can provide some historical context.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In Navigator config, you can assign "roles" to use "users" (see example below). The role is an arbitrary string chosen by the Navigator user. It can be used by the frontend config to customize the theme or custom views depending on the "role" (see here). There might have been other uses in the past, this is the one I know of.
Keep in mind that Navigator user handling was implemented long before we added authentication to the ledger API, which in turn was long before we started to think about the current ledger API user management.
users {
OPERATOR { // display name in Navigator
party=OPERATOR // Daml party for the ledger API
role=operator // metadata for Navigator frontend
}
BANK1 {
party=BANK1
role=bank
}
BANK2 {
party=BANK2
role=bank
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, Robert!
navigator/backend/src/main/scala/com/digitalasset/navigator/store/platform/PlatformStore.scala
Show resolved
Hide resolved
navigator/backend/src/test/scala/com/digitalasset/navigator/backend/IntegrationTest.scala
Show resolved
Hide resolved
Yes, I could log in as Happy to do more manual testing, but perhaps this is enough to get this into the hands of actual testers? |
I think so, yes, thanks, that level of manual testing is good enough for now and we can put it in the hand of users I believe. |
Some more historical context, we have Selenium based tests here, but they haven't been built or run in ages. I suspect we'd have to rewrite large parts of it to get it to run again. They also depend on the BrowserStack service, which we do not use anymore. One idea that we had in the past was to replace BrowserStack by a headless chrome browser, so that these tests can easily run locally and in CI. This would not catch regressions on non-Chrome browsers (e.g., if you broke the CSS on Firefox), but it would catch functional regressions (e.g., if you broke the GraphQL API such that the frontend doesn't display any data). |
navigator/backend/src/main/scala/com/digitalasset/navigator/model/PartyState.scala
Outdated
Show resolved
Hide resolved
// we may subscribe to the same party under different display names, but we should only create one actor per party) | ||
val partyActorName = partyState.actorName | ||
if (context.child(partyActorName).isEmpty) | ||
context.actorOf( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not new behavior, but mentioning it nevertheless: This starts an actor for each discovered party. Each actor uses its own in-memory database to store a complete copy of the whole transaction stream from ledger begin. This means Navigator backend will blow up unless the ledger is "small".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again, this is super helpful!
…del/PartyState.scala Co-authored-by: Robert Autenrieth <[email protected]>
Undoing an unnecessary refactoring I did in #12187 CHANGELOG_BEGIN CHANGELOG_END
Undoing an unnecessary refactoring from #12187 stefanobaghino-da confirmed this fixes the memory leak he observed in "long" running navigator sessions. CHANGELOG_BEGIN CHANGELOG_END
Add basic support for user management to navigator: log in as a user, act/read as its primary party.
When user management is supported & enabled, you can only log in as a user (and that user must have a primary party, which is what you'll actually be acting/reading as).
This behavior is enabled by default, but there's a feature flag you can use to disable it (
--feature-user-management
).See #12020
Pull Request Checklist
CHANGELOG_BEGIN
andCHANGELOG_END
tagsNOTE: CI is not automatically run on non-members pull-requests for security
reasons. The reviewer will have to comment with
/AzurePipelines run
totrigger the build.