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

Finishing Part 5 of the Field Manual using Validation not ACLs. #152

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
7 changes: 2 additions & 5 deletions 05_Customizing_OrbitDB/05_Conclusion.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,7 @@ code here: [final](../code_examples/05_Customizing_OrbitDB/final).
We also have an Appendix
to this part of the tutorial,
that describes how you can
use the `AccessControllers`
with OrbitDB to moderate
the discussions about the
notes.
implement Moderation.

If you want to read that,
go to this: **[Moderating your Comment Threads.](06_AccessControllers.md)**
go to this: **[Moderating your Comment Threads.](06_Moderation.md)**
74 changes: 0 additions & 74 deletions 05_Customizing_OrbitDB/06_AccessControllers.md

This file was deleted.

46 changes: 46 additions & 0 deletions 05_Customizing_OrbitDB/06_Moderation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
## Moderating your Comment Threads.

We have now gotten a store that
you can publish notes and comments with.

But we have not implemented any method
for moderating the Threads.

That's the subject of this Appendix:
Moderation of the Threads.

### Access Controllers vs. Validation
There are two ways I considered for implementing
moderation in OrbitDB:
1. Access Controllers
2. Validation

#### Access Controllers
Access Controllers (ACL) are used to check if an
entry should become part of the `oplog` or not.

They do this by implementing a `canAppend(entry, identityProvider)` function
that returns true if the entry can be added.

But Access Controllers are very low-level, because they
can't consider the state of the store that the oplog is for.

Thus most complicated Access Rules can actually not be implemented
using Access Controllers. Including the Moderation of the Threads
of the notes store.

I think you should not try to implement any Access Rules using
ACLs unless you really understand what you are doing and know
what you want to achieve.

### Validation
Instead of an ACL I will use validation to achieve moderation.
This means implementing Moderation in the Index of the NotesIndex
before applying an entry.

With this method I can access the state of the Index to validate an entry,
but it also means that invalid entries will persist and be replicated
across the network. Because validation happens on the existing oplog, instead
of before creating the oplog.

**Next: [Implementing a custom AccessController](06_Implementing_a_custom_AccessController.md)**