{"id":254,"date":"2010-07-15T04:00:18","date_gmt":"2010-07-15T04:00:18","guid":{"rendered":"http:\/\/poojanwagh.opalstacked.com\/techblog\/?p=254"},"modified":"2010-07-15T04:05:13","modified_gmt":"2010-07-15T04:05:13","slug":"setting-up-bags-recipes-and-users-in-tiddlywebwiki","status":"publish","type":"post","link":"https:\/\/tech.poojanblog.com\/blog\/hosted-web\/setting-up-bags-recipes-and-users-in-tiddlywebwiki\/","title":{"rendered":"Setting up bags, recipes, and users in TiddlyWeb(Wiki)"},"content":{"rendered":"<p style=\"text-align: left\">Up to now, I&#8217;ve been using <a title=\"Setting up TiddlyWeb (TiddlyWiki)\" href=\"http:\/\/poojanwagh.opalstacked.com\/techblog\/hosted-web\/setting-up-tiddlyweb-tiddlywiki\/\">TiddlyWeb<\/a> as a server-hosted version of TiddlyWiki. This is a fraction of what&#8217;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.<br \/>\nBy default, TiddlyWebWiki comes with a recipe aptly named <code>default<\/code> which is owned by a user named <code>administrator<\/code>. This recipe pulls in tiddlers from two bags: <code>system<\/code> and <code>common<\/code>.<br \/>\nBasically, <code>system<\/code> has the innards that make TiddlyWiki work over TiddlyWeb (the combination of which is called TiddlyWebWiki). <code>common<\/code> contains stuff that&#8217;s supposed to be common between all users.<br \/>\nTo customize permissions, one needs to do the following:<\/p>\n<ol>\n<li>Create users<\/li>\n<li>Set up a bag other than <code>common<\/code> to house per-user (or group) tiddlers<\/li>\n<li>Set up a recipe that exposes the bag to users (or groups thereof)<\/li>\n<\/ol>\n<p style=\"text-align: left\">Setting up a new user is performed by running<\/p>\n<code><br \/>\ntwanager adduser UserName UserssAwe$om3P@assw0rd USERROLE WORKROLE BLAHBLAROLE<br \/>\n<\/code>\n<p style=\"text-align: left\">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&#8217;s what you do:<\/p>\n<p><code><br \/>\n(tiddlyweb)[username@host main_inst]$ twanager bag personal<br \/>\n<\/code><br \/>\nNow, entere the following and terminate it with <em>CTRL<\/em>&#8211;<code>D<\/code> (<code>^D<\/code>):<br \/>\n<code>{&#8220;policy&#8221;: {&#8220;read&#8221;: [&#8220;UserName&#8221;, &#8220;R:ADMIN&#8221;], &#8220;create&#8221;: [&#8220;UserName&#8221;, &#8220;R:ADMIN&#8221;], &#8220;manage&#8221;: [&#8220;R:ADMIN&#8221;], &#8220;accept&#8221;: [&#8220;UserName&#8221;, &#8220;R:ADMIN&#8221;], &#8220;write&#8221;: [&#8220;UserName&#8221;, &#8220;R:ADMIN&#8221;], &#8220;owner&#8221;: &#8220;UserName&#8221;, &#8220;delete&#8221;: [&#8220;UserName&#8221;, &#8220;R:ADMIN&#8221;]}, &#8220;desc&#8221;: &#8220;UserName&#8217;s personal bag&#8221;}<br \/>\n^D<br \/>\n<\/code><br \/>\nIf you make a mistake, you can edit the fields that define this bag manually with<br \/>\n<code><br \/>\nvi store\/bags\/personal\/policy<br \/>\nvi store\/bags\/personal\/description<br \/>\n<\/code><br \/>\nNow, for the recipe:<br \/>\n<code><br \/>\ntwanager recipe personal<br \/>\n<\/code><br \/>\nAnd type in:<br \/>\n<code><br \/>\ndesc: UserName&#8217;s personal recipe<br \/>\npolicy: {&#8220;read&#8221;: [&#8220;R:ADMIN&#8221;, &#8220;UserName&#8221;], &#8220;create&#8221;: [&#8220;UserName&#8221;, &#8220;R:ADMIN&#8221;], &#8220;manage&#8221;: [&#8220;R:ADMIN&#8221;], &#8220;accept&#8221;: [&#8220;UserName&#8221;, &#8220;R:ADMIN&#8221;], &#8220;write&#8221;: [&#8220;R:ADMIN&#8221;], &#8220;owner&#8221;: &#8220;UserName&#8221;, &#8220;delete&#8221;: [&#8220;R:ADMIN&#8221;]}<\/p>\n<p>\/bags\/system\/tiddlers<br \/>\n\/bags\/common\/tiddlers<br \/>\n\/bags\/personal\/tiddlers<br \/>\n^D<br \/>\n<\/code><br \/>\nSince <code>\/bags\/personal\/tiddlers<\/code> is specified last in the list, that&#8217;s the default bag that <code>UserName<\/code>&#8216;s tiddlers will go.<\/p>\n<p>You can edit this recipe definition after the fact with:<br \/>\n<code><br \/>\nvi store\/recipes\/personal<br \/>\n<\/code><br \/>\nI haven&#8217;t tried this, but another option is to use a template recipe such as:<br \/>\n<code><br \/>\ndesc: Any user&#8217;s personal recipe<br \/>\npolicy: {&#8220;read&#8221;: [&#8220;R:ADMIN&#8221;, &#8220;R:USER&#8221;], &#8220;create&#8221;: [&#8220;R:USER&#8221;, &#8220;R:ADMIN&#8221;], &#8220;manage&#8221;: [&#8220;R:ADMIN&#8221;], &#8220;accept&#8221;: [&#8220;R:USER&#8221;, &#8220;R:ADMIN&#8221;], &#8220;write&#8221;: [&#8220;R:ADMIN&#8221;], &#8220;owner&#8221;: &#8220;&#8221;, &#8220;delete&#8221;: [&#8220;R:ADMIN&#8221;]}<\/p>\n<p>\/bags\/system\/tiddlers<br \/>\n\/bags\/common\/tiddlers<br \/>\n\/bags\/{{ user }}\/tiddlers<br \/>\n^D<br \/>\n<\/code><br \/>\nwhere <code>{{ user }}<\/code> will get replaced with the login of the current user. I&#8217;m not sure how the bag for each user gets created, though. Also, in the above, I specified the role <code>USER<\/code> (specified with <code>&#8220;R:USER&#8221;<\/code>), which is something you&#8217;d set up when you add a user.<br \/>\nFinally, to access the newly-created TiddlyWiki described by the above storage scheme (recipe), one would visit <code>http:\/\/TiddlyWikiURI\/recipes\/personal\/tiddlers.wiki<\/code>.<\/p>\n<div class='wp_likes' id='wp_likes_post-254'><a class='like' href=\"javascript:wp_likes.like(254);\" title='' ><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/tech.poojanblog.com\/blog\/wp-content\/plugins\/wp-likes\/images\/like.png\" alt='' border='0'\/><\/a><span class='text'>Be the first to like.<\/span><\/p>\n<div class='like' ><a href=\"javascript:wp_likes.like(254);\">Like<\/a><\/div>\n<div class='unlike' ><a href=\"javascript:wp_likes.unlike(254);\">Unlike<\/a><\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Up to now, I&#8217;ve been using TiddlyWeb as a server-hosted version of TiddlyWiki. This is a fraction of what&#8217;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 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[20],"tags":[93,101,92],"class_list":["post-254","post","type-post","status-publish","format-standard","hentry","category-hosted-web","tag-tiddlyweb","tag-tiddlywebwiki","tag-tiddlywiki"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/tech.poojanblog.com\/blog\/wp-json\/wp\/v2\/posts\/254","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tech.poojanblog.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tech.poojanblog.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tech.poojanblog.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/tech.poojanblog.com\/blog\/wp-json\/wp\/v2\/comments?post=254"}],"version-history":[{"count":16,"href":"https:\/\/tech.poojanblog.com\/blog\/wp-json\/wp\/v2\/posts\/254\/revisions"}],"predecessor-version":[{"id":269,"href":"https:\/\/tech.poojanblog.com\/blog\/wp-json\/wp\/v2\/posts\/254\/revisions\/269"}],"wp:attachment":[{"href":"https:\/\/tech.poojanblog.com\/blog\/wp-json\/wp\/v2\/media?parent=254"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tech.poojanblog.com\/blog\/wp-json\/wp\/v2\/categories?post=254"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tech.poojanblog.com\/blog\/wp-json\/wp\/v2\/tags?post=254"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}