From eed869ac9031c63f47c0ecea7d8ddfa9aa8440c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20J=C3=A4gle?= Date: Fri, 17 Nov 2017 18:28:14 +0100 Subject: [PATCH] Allow maintenance of per-setting permissions - first draft, not beautified yet --- package-lock.json | 12 +- package.json | 4 +- .../client/lib/SettingPermissions.js | 8 + .../client/views/permissions.html | 66 ++++--- .../client/views/permissions.js | 75 +++++--- .../lib/rocketchat.js | 4 + packages/rocketchat-authorization/package.js | 1 + .../server/publications/permissions.js | 21 ++- .../server/startup.js | 174 +++++++++++------- .../server/publications/settings.js | 30 +++ .../rocketchat-livechat/app/package-lock.json | 22 +-- packages/rocketchat-ui-admin/client/admin.js | 82 ++++++--- 12 files changed, 337 insertions(+), 162 deletions(-) create mode 100644 packages/rocketchat-authorization/client/lib/SettingPermissions.js diff --git a/package-lock.json b/package-lock.json index 9827c6fdf1d0..139e1f2264cd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -327,7 +327,7 @@ "async": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/async/-/async-2.5.0.tgz", - "integrity": "sha512-e+lJAJeNWuPCNyxZKOBdaJGyLGHugXVQtrAwtuAe2vhxTYxFTKE73p8JuTmdH0qdQZtDvI4dhJwjZc5zsfIsYw==", + "integrity": "sha1-hDGQ/WtzV6C54clW7d3V7IRitU0=", "requires": { "lodash": "4.17.4" } @@ -352,7 +352,7 @@ "autoprefixer": { "version": "7.1.6", "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-7.1.6.tgz", - "integrity": "sha512-C9yv/UF3X+eJTi/zvfxuyfxmLibYrntpF3qoJYrMeQwgUJOZrZvpJiMG2FMQ3qnhWtF/be4pYONBBw95ZGe3vA==", + "integrity": "sha1-+5MwOfdK90qD5xIlznjZ/Vi6hNc=", "dev": true, "requires": { "browserslist": "2.6.1", @@ -6927,7 +6927,7 @@ "postcss-custom-properties": { "version": "6.2.0", "resolved": "https://registry.npmjs.org/postcss-custom-properties/-/postcss-custom-properties-6.2.0.tgz", - "integrity": "sha512-eNR2h9T9ciKMoQEORrPjH33XeN/nuvVuxArOKmHtsFbGbNss631tgTrKou3/pmjAZbA4QQkhLIkPQkIk3WW+8w==", + "integrity": "sha1-XZKafwbpuE4PETNBlMC6mjCs++k=", "dev": true, "requires": { "balanced-match": "1.0.0", @@ -6949,7 +6949,7 @@ "postcss-less": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/postcss-less/-/postcss-less-1.1.1.tgz", - "integrity": "sha512-zl0EEqq8Urh37Ppdv9zzhpZpLHrgkxmt6e3O4ftRa7/b8Uq2LV+/KBVM8/KuzmHNu+mthhOArg1lxbfqQ3NUdg==", + "integrity": "sha1-S9JA21F840B1g9knhYGE9QBF9Ks=", "dev": true, "requires": { "postcss": "5.2.18" @@ -7035,7 +7035,7 @@ "postcss-nesting": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/postcss-nesting/-/postcss-nesting-3.0.0.tgz", - "integrity": "sha512-ijQlEXUcYXXNPdLMFcMEr4i5SEPRKR8fq/Iya4L0mQbNOCz+szTGCBlf0Cvu2HiQLjCNqLnGO4fKFLbNnXe7Ag==", + "integrity": "sha1-sKdJ1+/xHSVQoE3qZCtpXXWC+x0=", "dev": true, "requires": { "postcss": "6.0.13" @@ -7562,7 +7562,7 @@ "retry-request": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/retry-request/-/retry-request-3.1.0.tgz", - "integrity": "sha512-jOwZQlWR/boHhbAfzfOoUn28EDDotW2A7YxV2o5mfBb07H0k/zZAgbxRcckW08GKl/aT0JtPk1NViuk2BfHqVg==", + "integrity": "sha1-+UjKF5JlemSryJoPrXJ90HtisNY=", "requires": { "request": "2.83.0", "through2": "2.0.3" diff --git a/package.json b/package.json index 06fc561dba30..8b92ce12e480 100644 --- a/package.json +++ b/package.json @@ -60,7 +60,9 @@ "chat" ], "scripts": { - "start": "meteor npm i && meteor", + "start": "meteor npm i && meteor run", + "debug": "meteor run --inspect", + "debug-brk": "meteor run --inspect-brk", "lint": "eslint .", "lint-fix": "eslint . --fix", "stylelint": "stylelint packages/**/*.css", diff --git a/packages/rocketchat-authorization/client/lib/SettingPermissions.js b/packages/rocketchat-authorization/client/lib/SettingPermissions.js new file mode 100644 index 000000000000..1ae099a28c64 --- /dev/null +++ b/packages/rocketchat-authorization/client/lib/SettingPermissions.js @@ -0,0 +1,8 @@ +RocketChat.authz.settingCachedCollectiong = new RocketChat.CachedCollection({ + name: 'setting-permissions', + eventType: 'onLogged', + userRelated: false +}); +RocketChat.authz.settingCachedCollectiong.init(); + +this.SettingPermissions = RocketChat.authz.settingCachedCollectiong.collection; diff --git a/packages/rocketchat-authorization/client/views/permissions.html b/packages/rocketchat-authorization/client/views/permissions.html index e0e47d6b426d..8f88f6e3948d 100644 --- a/packages/rocketchat-authorization/client/views/permissions.html +++ b/packages/rocketchat-authorization/client/views/permissions.html @@ -1,34 +1,46 @@ +