From 658896eeb1b57366f1e8f561ab55238b2f011ec5 Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Thu, 13 Aug 2015 12:52:43 +0930 Subject: [PATCH] Add permission setting for editing tags --- extensions/tags/js/admin/src/addTagPermission.js | 11 +++++++++++ extensions/tags/js/admin/src/main.js | 2 ++ 2 files changed, 13 insertions(+) create mode 100644 extensions/tags/js/admin/src/addTagPermission.js diff --git a/extensions/tags/js/admin/src/addTagPermission.js b/extensions/tags/js/admin/src/addTagPermission.js new file mode 100644 index 000000000..498c4ce2b --- /dev/null +++ b/extensions/tags/js/admin/src/addTagPermission.js @@ -0,0 +1,11 @@ +import { extend } from 'flarum/extend'; +import PermissionGrid from 'flarum/components/PermissionGrid'; + +export default function() { + extend(PermissionGrid.prototype, 'moderateItems', items => { + items.add('tag', { + label: 'Edit tags', + permission: 'discussion.tag' + }); + }); +} diff --git a/extensions/tags/js/admin/src/main.js b/extensions/tags/js/admin/src/main.js index c7f47901d..e0679f943 100644 --- a/extensions/tags/js/admin/src/main.js +++ b/extensions/tags/js/admin/src/main.js @@ -1,10 +1,12 @@ import Tag from 'tags/models/Tag'; import addTagsPermissionScope from 'tags/addTagsPermissionScope'; +import addTagPermission from 'tags/addTagPermission'; import addTagsPane from 'tags/addTagsPane'; app.initializers.add('tags', app => { app.store.models.tags = Tag; addTagsPermissionScope(); + addTagPermission(); addTagsPane(); });