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

Skip to first unread message

Charlie Veniot

Oct 2, 2021, 7:26:21 PMOct 2
to TiddlyWiki

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":

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

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


Cheers !


Oct 2, 2021, 11:17:43 PMOct 2
to TiddlyWiki
Good idea Charlie!

(I'll post replies here since that's your preference, appreciate your TT heads up as I am only watching that these days normally)

I think the "lock" of two people in the same file will get hung up by the fact that there's not a file-watcher built into node.js (like there is on BOB). I say this hoping I'm wrong! Maybe whatever this "google compute engine virtual server" thing somehow doesn't need that? Very curious to watch how your efforts evolve here. 

Charlie Veniot

Oct 2, 2021, 11:58:26 PMOct 2
to TiddlyWiki

Thanks!  TT has me feeling the same way as many people talking to me all at the same time.  I have no idea how else to explain it.

I think I gave this thread a lousy title.

In the TiddlyWiki I have setup, we are three users, a few tiddlers created by each of us.

When I sign in (just basic authentication), I can edit/delete the tiddlers I've created, but can only view the tiddlers the other users created.  So each of us can view all tiddlers, but just edit/delete the tiddlers we've created.

Say user A has Tiddler A, I can't edit it.  But if I want to contribute to it, I can create a tiddler linked to Tiddler A (say "Tiddler A.1", either linked to Tiddler A, or tagged "Tiddler A", or something like that) to enhance the information in Tiddler A.

So this circumvents the problem of two people trying to edit the same tiddler at the same time.

It isn't meant to be any kind of robust security mechanism.  It just makes it more difficult to edit/delete what you haven't created.

We'd need a modified "view tiddler template" to show show additional information related to Tiddler A, to show additional stuff added by other contributors via added and linked tiddlers.

A little bit like how one can share a Google Doc with others, giving them ability to comment on the document but not editing it.

Something like that.

Proof is in the pudding, so I can report back on any hiccups, but it is looking pretty good so far.

Maybe later, once I've tidied up the machinery of it all, I can quickly setup another server and invite a few interested folk to do some heavy-duty sanity checks.  A lot easier to show than to tell.
Reply all
Reply to author
0 new messages