[annotator-dev] default permissions

Nick Stenning nick at whiteink.com
Mon Apr 2 21:59:29 UTC 2012

Hi Amir,

The first thing to note is that the Permissions plugin is completely
configurable: see the source code for documentation on what you can
configure, in particular the "userAuthorize" option.

If you want to set the default annotation permissions, you can do so
when you initialise the plugin:

   .annotator('addPlugin', 'Permissions', {
       permissions: { 'read': ['alice'], 'update': ['alice'], ... }

As to the confusion between userId and username, note that AnnotateIt
uses usernames as userIds. As far as Annotator itself is concerned,
there is the user object (set with Permissions#setUser()) which can be
absolutely anything, and the userId and userString, which are
*defined* as the result of running Permissions.options.userId(<user
object>) or Permissions.options.userString(<user object>).

Lastly, note that the default userAuthorize function assumes the
entries in the permissions lists will be userIds.

Does that clarify the situation at all?


On Mon, Apr 2, 2012 at 21:01, Amir More <habeanf at gmail.com> wrote:
> hey nick,
> while working on deletion functionality in the marginviewer i noticed that
> by default, an annotation created by the default editor (while the
> permissions and store plugins are in use) does not by default list the
> creating user as the admin (or any permission) of the annotation the user
> created.
> is this on purpose?
> i'm trying to understand what needs to be done so that the user has a
> certain set of permissions by default.
> i read up on the permissions/store plugins in the github wiki but i can't
> figure out the idiomatic method of adding a permission (by default or
> otherwise).
> in some examples the user's id is used, while in others the user's username
> is used (?)
> am i missing something?
> thanks
> -a

More information about the annotator-dev mailing list