Skip to content
This repository has been archived by the owner on Oct 3, 2022. It is now read-only.

Commit

Permalink
Change: Remove DJ ability to moderate
Browse files Browse the repository at this point in the history
  • Loading branch information
bakape committed Dec 5, 2015
1 parent caeeb76 commit c04079b
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 12 deletions.
4 changes: 2 additions & 2 deletions client/mod/toolbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const ToolboxView = Backbone.View.extend({
this.render();
},
render() {
const specs = this.specs = [
let specs = this.specs = [
'clearSelection',
'spoilerImages',
'deleteImages',
Expand All @@ -34,7 +34,7 @@ const ToolboxView = Backbone.View.extend({

// Add aditional panel buttons by priveledge level
if (main.ident.auth === 'dj')
specs.push('djPanel')
specs = this.specs = ['djPanel']
const accessLevels = [
['dj', ['toggleMnemonics']],
['moderator', ['lockThreads', 'ban']],
Expand Down
2 changes: 1 addition & 1 deletion common/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ exports.commaList = commaList;

// Acertains client has the proper authorisation level or higher
function checkAuth(type, ident) {
const levels = ['janitor', 'dj', 'moderator', 'admin'];
const levels = ['dj', 'janitor', 'moderator', 'admin'];
return levels.indexOf(type) <= levels.indexOf(ident.auth);
}
exports.checkAuth = checkAuth;
9 changes: 4 additions & 5 deletions db.js
Original file line number Diff line number Diff line change
Expand Up @@ -1181,11 +1181,10 @@ exports.Yakusoku = Yakusoku;
class Reader extends events.EventEmitter {
constructor(ident) {
// Call the EventEmitter's constructor
super();
if (common.checkAuth('janitor', ident)) {
this.canSeeModeration = true;
this.canSeeMnemonics = common.checkAuth('dj', ident);
}
super()
this.canSeeMnemonics = ident.auth === 'dj'
|| common.checkAuth('moderator', ident)
this.canSeeModeration = common.checkAuth('janitor', ident)
}
get_thread(num, opts) {
const key = 'thread:' + num;
Expand Down
4 changes: 2 additions & 2 deletions server/persona.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ function verify_auth(resp, packet) {
if (packet.expires && packet.expires < Date.now())
return respond_error(resp, 'Login attempt expired.');

const email = packet.email;
const auth = _.find(['admin', 'moderator', 'dj', 'janitor'], type =>
const {email} = packet
const auth = _.find(['admin', 'moderator', 'janitor', 'dj'], type =>
config.staff[type] && email in config.staff[type])
if (!auth) {
winston.error("Login attempt by " + email);
Expand Down
2 changes: 1 addition & 1 deletion server/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ class RenderBase {

// Make script loader load moderation bundle
const {ident} = this.req;
if (common.checkAuth('janitor', ident)) {
if (common.checkAuth('dj', ident)) {
const keys = JSON.stringify(_.pick(ident, 'auth', 'csrf', 'email'));
html += `var IDENT = ${keys};`;
}
Expand Down
2 changes: 1 addition & 1 deletion server/web/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const router = module.exports = express.Router();
router.get('/mod.js', function (req, res) {
// Admin/Moderator privelege is injected on page render and verified
// serverside. Thus, we can serve the same bundle for both admins and mods.
if (!common.checkAuth('janitor', req.ident))
if (!common.checkAuth('dj', req.ident))
return res.sendStatus(404);

const modJS = resources.modJs;
Expand Down

0 comments on commit c04079b

Please sign in to comment.