Skip to content

Setting up bags, recipes, and users in TiddlyWeb(Wiki)

Up to now, I’ve been using TiddlyWeb as a server-hosted version of TiddlyWiki. This is a fraction of what’s possible with TiddlyWeb. One can create bags which are self-contained stores of tiddlers. One can combine these bags using recipes. Different users can have access to different bags and to different recipes.
By default, TiddlyWebWiki comes with a recipe aptly named default which is owned by a user named administrator. This recipe pulls in tiddlers from two bags: system and common.
Basically, system has the innards that make TiddlyWiki work over TiddlyWeb (the combination of which is called TiddlyWebWiki). common contains stuff that’s supposed to be common between all users.
To customize permissions, one needs to do the following:

  1. Create users
  2. Set up a bag other than common to house per-user (or group) tiddlers
  3. Set up a recipe that exposes the bag to users (or groups thereof)

Setting up a new user is performed by running


twanager adduser UserName UserssAwe$om3P@assw0rd USERROLE WORKROLE BLAHBLAROLE

A role is essentially a user group that one can use to set group permissions on bags/recipes. To set up a new bag, etc. Here’s what you do:


(tiddlyweb)[username@host main_inst]$ twanager bag personal

Now, entere the following and terminate it with CTRLD (^D):
{“policy”: {“read”: [“UserName”, “R:ADMIN”], “create”: [“UserName”, “R:ADMIN”], “manage”: [“R:ADMIN”], “accept”: [“UserName”, “R:ADMIN”], “write”: [“UserName”, “R:ADMIN”], “owner”: “UserName”, “delete”: [“UserName”, “R:ADMIN”]}, “desc”: “UserName’s personal bag”}
^D

If you make a mistake, you can edit the fields that define this bag manually with

vi store/bags/personal/policy
vi store/bags/personal/description

Now, for the recipe:

twanager recipe personal

And type in:

desc: UserName’s personal recipe
policy: {“read”: [“R:ADMIN”, “UserName”], “create”: [“UserName”, “R:ADMIN”], “manage”: [“R:ADMIN”], “accept”: [“UserName”, “R:ADMIN”], “write”: [“R:ADMIN”], “owner”: “UserName”, “delete”: [“R:ADMIN”]}

/bags/system/tiddlers
/bags/common/tiddlers
/bags/personal/tiddlers
^D

Since /bags/personal/tiddlers is specified last in the list, that’s the default bag that UserName‘s tiddlers will go.

You can edit this recipe definition after the fact with:

vi store/recipes/personal

I haven’t tried this, but another option is to use a template recipe such as:

desc: Any user’s personal recipe
policy: {“read”: [“R:ADMIN”, “R:USER”], “create”: [“R:USER”, “R:ADMIN”], “manage”: [“R:ADMIN”], “accept”: [“R:USER”, “R:ADMIN”], “write”: [“R:ADMIN”], “owner”: “”, “delete”: [“R:ADMIN”]}

/bags/system/tiddlers
/bags/common/tiddlers
/bags/{{ user }}/tiddlers
^D

where {{ user }} will get replaced with the login of the current user. I’m not sure how the bag for each user gets created, though. Also, in the above, I specified the role USER (specified with “R:USER”), which is something you’d set up when you add a user.
Finally, to access the newly-created TiddlyWiki described by the above storage scheme (recipe), one would visit http://TiddlyWikiURI/recipes/personal/tiddlers.wiki.

Be the first to like.

Post a Comment

Your email is never published nor shared. Required fields are marked *
*
*