Commit e737a3a5 authored by Aron Carroll's avatar Aron Carroll

Update permissions plugin

Now allows permissions rules to be provided in the
beforeAnnotationCreated hook.
parent 459c0c83
// Generated by CoffeeScript 1.6.3
/*
** Annotator 1.2.6-dev-9e0eff3
** Annotator 1.2.6-dev-7c7b224
** https://github.com/okfn/annotator/
**
** Copyright 2012 Aron Carroll, Rufus Pollock, and Nick Stenning.
** Dual licensed under the MIT and GPLv3 licenses.
** https://github.com/okfn/annotator/blob/master/LICENSE
**
** Built at: 2014-09-25 22:40:57Z
** Built at: 2014-10-22 19:46:29Z
*/
......@@ -145,8 +145,18 @@
};
Permissions.prototype.addFieldsToAnnotation = function(annotation) {
var key, _i, _len, _ref;
if (annotation) {
annotation.permissions = this.options.permissions;
if (!annotation.permissions) {
annotation.permissions = {};
}
_ref = ['read', 'update', 'delete', 'admin'];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
key = _ref[_i];
if (!annotation.permissions.hasOwnProperty(key)) {
annotation.permissions[key] = this.options.permissions[key];
}
}
if (this.user) {
return annotation.user = this.user;
}
......@@ -220,3 +230,6 @@
})(Annotator.Plugin);
}).call(this);
//
//# sourceMappingURL=annotator.permissions.map
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment