Next: , Previous: Publishing Calendars, Up: Publishing


6.9.3 Authz Access Restriction

planner-authz.el was written by Andrew J. Korty in order to allow the easy restriction of portions of published pages. It uses the HTML::Mason module available on CPAN (http://www.cpan.org). Setting up HTML::Mason is outside the scope of this document. Make sure that it works before trying out planner-authz.el.

planner-authz.el modifies the behavior of muse-project-publish so that published pages follow access modifiers.

This library lets you publish your planner pages while controlling access to certain portions of them to users you specify. When you load this library, you gain access to two additional markup directives to use in your planner pages. The ‘<authz>’ tag lets you restrict access to arbitrary content as follows:

     Here is a sentence everyone should see.  This sentence also
     contains no sensitive data whatsoever.  <authz users="ajk">This
     sentence, however, talks about my predilection for that French
     vanilla instant coffee that comes in the little tin, and I'm
     embarrassed for anyone else to know about that.</authz> And
     here's some more perfectly innocuous content.

You can use ‘<authz>’ tags to mark up entire paragraphs, tasks, notes, and anything else. The tags are replaced with Mason code in the published pages.

The ‘#authz’ directive restricts access to an entire page. A Mason call is added to this page to generate a 403 error when someone not listed tries to access it. Any notes or tasks on a ‘#authz’-protected page are also wrapped in Mason code on linked pages. To add a ‘#authz’ directive to a Muse page, place ‘#authz’ followed by a space-delimited list of users on one line. For example:

     #authz ajk sacha

Getting started

Add the following to your .emacs file to cause M-x muse-project-publish to automatically use planner-authz features.

     (require 'planner-authz)

Diary markup

If your pages have a section with diary entries maintained by planner-appt.el (or by any other means), you can control access to these entries. First, customize planner-section-tagnames to map your diary section ("* Schedule", in this example) to a tag called "diary-section". An example follows.

     (add-to-list 'planner-section-tagnames '("Schedule" . "diary-section"))

If the name of your diary section is "* Diary", you will not need to customize planner-section-tagnames by default.

Then make sure the diary entries you want restricted contain a corresponding plan page name in parentheses, as in the following example.

     10:00 10:30 Meeting with boss (WorkStuff)

Options

— User Option: planner-authz-project-default

Default access list for project pages (not day pages). If a given project page doesn't contain a ‘#authz’ tag, it will receive the access list defined here. If this variable is nil, all users will be allowed to view the page. No corresponding variable is provided for day pages because it doesn't seem like you'd ever want to control access based on what day it was. (But I will accept patches. :) Notes and tasks referencing pages without ‘#authz’ tags will also be restricted to the users listed here.

— User Option: planner-authz-day-note-default

Default access list for notes on day pages not associated with any project. There is way to set a default for notes on project pages for the reason above; they would only be associated with date pages anyway.

— User Option: planner-authz-day-task-default

Same as planner-authz-day-note-default, but for tasks.

Functions

— Function: planner-authz-publish-index

Publish an index for the planner marked up with Mason code. Only those links to pages which the remote user is authorized to access will be shown.