This repository has been archived on 2025-01-28. You can view files and clone it, but cannot push or open issues or pull requests.
misuzu-interim/assets/js/misuzu/perms.js

16 lines
792 B
JavaScript
Raw Normal View History

2022-09-13 15:14:49 +02:00
Misuzu.Perms = function(perms) {
this.perms = perms || {};
};
Misuzu.Perms.prototype.perms = undefined;
Misuzu.Perms.check = function(section, value) {
return function() { return this.perms[section] && (this.perms[section] & value) > 0; };
};
// Comment permissions
Misuzu.Perms.prototype.canCreateComment = Misuzu.Perms.check('comments', 0x01);
Misuzu.Perms.prototype.canDeleteOwnComment = Misuzu.Perms.check('comments', 0x08 | 0x10);
Misuzu.Perms.prototype.canDeleteAnyComment = Misuzu.Perms.check('comments', 0x10);
Misuzu.Perms.prototype.canLockCommentSection = Misuzu.Perms.check('comments', 0x20);
Misuzu.Perms.prototype.canPinComment = Misuzu.Perms.check('comments', 0x40);
Misuzu.Perms.prototype.canVoteOnComment = Misuzu.Perms.check('comments', 0x80);