-
Notifications
You must be signed in to change notification settings - Fork 44
Is it possible to give write access in a single record ? #79
Comments
What do you mean by other records? Should a creator of a record be allowed to remove? This would be a lot of work right now. If you just don't want to support a I haven't tested it, but you could try this: class CustomStore extends DocumentStore {
constructor (ipfs, id, dbname, options) {
super(ipfs, id, dbname, options)
this._type = CustomStore.type
}
static get type() {
return 'custom'
}
put (doc) {
if (this.get(doc.key)) { throw new Error("Can't modify existing record!")} // <- like this
super(doc)
}
del (key) {
throw new Error('Store does not support delete!') // <- And this
}
} Keep in mind that you have to register the custom store with // add custom type to orbitdb
OrbitDB.addDatabaseType(CustomStore.type, CustomStore)
// instantiate custom store
let orbitdb = new OrbitDB(ipfs, dbPath)
let store = orbitdb.create(name, CustomStore.type) |
OK.. but I was asking about ownership of data in the same database |
@maroodb I think what you might consider is giving everybody their own docstore database with write access pinned to them, and then using OrbitDB's ability to do distributed queries to search all of them across the swarm and collate the data in the application layer. This is covered in the tutorial section of the OrbitDB Field Manual. Have a look there and open an issue or a PR if you have any more questions or if something doesn't make sense. |
Moving to the Field Manual repo to go into more detail |
I am looking for a solution that makes everyone write in a docs database, but no one can remove/modify other records.. is it possible? or I have to create multiple databases for each user?
The text was updated successfully, but these errors were encountered: