Remove implicit mod privs. closes #6345 (#7648)

* feat: add upgrade script to give mods privs

* feat: give all privileges when making a moderator

* feat: remove implicit privs

* feat: give global mods default privs

* feat: more priv fixes

* feat: use lodash

* fix: remove implicit mod priv from topic delete

* fix: more privs

* fix: posts.canEdit

* fix: canDelete and canEdit

* fix: tests, remove console.log

* feat: shorter functions

* feat: add tests

* fix: uids

* fix: redis random test fail
This commit is contained in:
Barış Soner Uşaklı
2019-05-30 19:30:47 -04:00
committed by GitHub
parent ebb32e7891
commit 035f624758
15 changed files with 319 additions and 227 deletions

View File

@@ -265,6 +265,32 @@ describe('Post\'s', function () {
});
});
it('should not see post content if global mod does not have posts:view_deleted privilege', function (done) {
async.waterfall([
function (next) {
user.create({ username: 'global mod', password: '123456' }, next);
},
function (uid, next) {
groups.join('Global Moderators', uid, next);
},
function (next) {
privileges.categories.rescind(['posts:view_deleted'], cid, 'Global Moderators', next);
},
function (next) {
helpers.loginUser('global mod', '123456', function (err, _jar) {
assert.ifError(err);
var jar = _jar;
request(nconf.get('url') + '/api/topic/' + tid, { jar: jar, json: true }, function (err, res, body) {
assert.ifError(err);
assert.equal(body.posts[1].content, '[[topic:post_is_deleted]]');
privileges.categories.give(['posts:view_deleted'], cid, 'Global Moderators', next);
});
});
},
], done);
});
it('should restore a post', function (done) {
socketPosts.restore({ uid: voterUid }, { pid: replyPid, tid: tid }, function (err) {
assert.ifError(err);