[tw5] Sample code: Multi-user TiddlyWiki on nodejs: locking other users' tiddlers

G’day,

As I am testing with collaborators nodejs TiddlyWiki running on a Google Compute Engine virtual server, I started wondering about a way for us to work in the same TiddlyWiki while preventing each other mistakenly deleting/editing each other’s tiddlers.

This is also a way (I have some fine-tuning to do) to prevent two people editing the same tiddler at the same time. Contributions to some other person’s tiddler can be done via tagging or other mechanism (i.e. adorning somebody else’s tiddler via new tiddlers and tagging/linking.)

Anyways, just a bit of sample code which, for now, shows a way to implement read-only on tiddlers created by other users (i.e. you can only edit/delete tiddlers you have created).

BTW, the following code in a tiddler tagged with “$:/tags/Stylesheet”:
(based on Q: How can I use a custom field to style a tiddler? and Simple ways to write protect tiddlers)

<$vars thisUser={{{ [[$:/status/UserName]get[text]] }}}>
<$list filter="[!is[system]!is[shadow]!creator]">

[data-tiddler-title="{{!!title}}"] button[title=“Edit this tiddler”] {display: none;}
[data-tiddler-title="{{!!title}}"] button[title=“Delete this tiddler”] {display: none;}

</$list>
</$vars>

Cheers !