mirror of
https://github.com/wassname/talk.git
synced 2026-07-02 07:05:41 +08:00
22 lines
611 B
JavaScript
22 lines
611 B
JavaScript
const {check} = require('../utils');
|
|
const types = require('../constants');
|
|
|
|
module.exports = (user, perm) => {
|
|
switch (perm) {
|
|
case types.SEARCH_ASSETS:
|
|
case types.SEARCH_OTHER_USERS:
|
|
case types.SEARCH_ACTIONS:
|
|
case types.SEARCH_NON_NULL_OR_ACCEPTED_COMMENTS:
|
|
case types.SEARCH_OTHERS_COMMENTS:
|
|
return check(user, ['ADMIN', 'MODERATOR']);
|
|
case types.SEARCH_COMMENT_STATUS_HISTORY:
|
|
case types.VIEW_USER_STATUS:
|
|
case types.VIEW_PROTECTED_SETTINGS:
|
|
return check(user, ['ADMIN', 'MODERATOR']);
|
|
case types.LIST_OWN_TOKENS:
|
|
return check(user, ['ADMIN']);
|
|
default:
|
|
break;
|
|
}
|
|
};
|