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 social and permission level discovery #736

Draft
wants to merge 2 commits into
base: staging
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/gestalts/GestaltGraph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1104,7 +1104,12 @@ class GestaltGraph {
switch (type) {
case 'node': {
if ((await tran.get([...this.dbNodesPath, gestaltKey], true)) == null) {
throw new gestaltsErrors.ErrorGestaltsGraphNodeIdMissing();
await this.setNode(
{
nodeId: id,
},
tran,
);
}
await this.acl.setNodeAction(id, action, tran);
return;
Expand Down Expand Up @@ -1498,6 +1503,7 @@ class GestaltGraph {
return gestalt;
}

// FIXME: this returns only 1 node that is linked to an identity, It should really return all of them. Maybe convert to a generator?
protected async getIdentityLinkedNodeId(
providerIdentityId: ProviderIdentityId,
tran: DBTransaction,
Expand Down
11 changes: 11 additions & 0 deletions tests/client/handlers/gestalts.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1948,6 +1948,17 @@ describe('gestaltsGestaltTrustByNode', () => {
notify: null,
});
});
test('trusts a node (not in gestalt graph)', async () => {
const request = {
nodeIdEncoded: nodeIdEncodedRemote,
};
await rpcClient.methods.gestaltsGestaltTrustByNode(request);
expect(
await gestaltGraph.getGestaltActions(['node', nodeIdRemote!]),
).toEqual({
notify: null,
});
});
test('trusts a node (new node)', async () => {
const request = {
nodeIdEncoded: nodeIdEncodedRemote,
Expand Down
6 changes: 3 additions & 3 deletions tests/client/handlers/vaults.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -468,9 +468,9 @@ describe('vaultsPermissionSet and vaultsPermissionUnset and vaultsPermissionGet'
acl,
logger,
});
await gestaltGraph.setNode({
nodeId: nodeId,
});
// Await gestaltGraph.setNode({
// nodeId: nodeId,
// });
taskManager = await TaskManager.createTaskManager({
db,
logger,
Expand Down