mirror of
https://github.com/rr-/szurubooru.git
synced 2025-07-17 08:26:24 +00:00
Fixed privileges
This commit is contained in:
@ -5,6 +5,7 @@ App.Auth = function(_, jQuery, util, api, appState, promise) {
|
||||
var privileges = {
|
||||
register: 'register',
|
||||
listUsers: 'listUsers',
|
||||
viewUsers: 'viewUsers',
|
||||
viewAllEmailAddresses: 'viewAllEmailAddresses',
|
||||
changeAccessRank: 'changeAccessRank',
|
||||
changeOwnAvatarStyle: 'changeOwnAvatarStyle',
|
||||
@ -19,9 +20,8 @@ App.Auth = function(_, jQuery, util, api, appState, promise) {
|
||||
deleteAllAccounts: 'deleteAllAccounts',
|
||||
ban: 'ban',
|
||||
|
||||
listSafePosts: 'listSafePosts',
|
||||
listSketchyPosts: 'listSketchyPosts',
|
||||
listUnsafePosts: 'listUnsafePosts',
|
||||
listPosts: 'listPosts',
|
||||
viewPosts: 'viewPosts',
|
||||
uploadPosts: 'uploadPosts',
|
||||
uploadPostsAnonymously: 'uploadPostsAnonymously',
|
||||
deletePosts: 'deletePosts',
|
||||
|
@ -7,6 +7,7 @@ App.Presenters.HomePresenter = function(
|
||||
util,
|
||||
promise,
|
||||
api,
|
||||
auth,
|
||||
topNavigationPresenter,
|
||||
messagePresenter) {
|
||||
|
||||
@ -50,6 +51,8 @@ App.Presenters.HomePresenter = function(
|
||||
postContentTemplate: postContentTemplate,
|
||||
globals: globals,
|
||||
title: topNavigationPresenter.getBaseTitle(),
|
||||
canViewUsers: auth.hasPrivilege(auth.privileges.viewUsers),
|
||||
canViewPosts: auth.hasPrivilege(auth.privileges.viewPosts),
|
||||
formatRelativeTime: util.formatRelativeTime,
|
||||
formatFileSize: util.formatFileSize,
|
||||
}));
|
||||
@ -62,4 +65,4 @@ App.Presenters.HomePresenter = function(
|
||||
|
||||
};
|
||||
|
||||
App.DI.register('homePresenter', ['_', 'jQuery', 'util', 'promise', 'api', 'topNavigationPresenter', 'messagePresenter'], App.Presenters.HomePresenter);
|
||||
App.DI.register('homePresenter', ['_', 'jQuery', 'util', 'promise', 'api', 'auth', 'topNavigationPresenter', 'messagePresenter'], App.Presenters.HomePresenter);
|
||||
|
@ -79,7 +79,7 @@ App.Presenters.PostPresenter = function(
|
||||
topNavigationPresenter.changeTitle('@' + post.id);
|
||||
render();
|
||||
loaded();
|
||||
});
|
||||
}).fail(loaded);
|
||||
}
|
||||
|
||||
function refreshPost() {
|
||||
@ -344,6 +344,9 @@ App.Presenters.PostPresenter = function(
|
||||
}
|
||||
|
||||
function showGenericError(response) {
|
||||
if ($messages === $el) {
|
||||
$el.empty();
|
||||
}
|
||||
messagePresenter.showError($messages, response.json && response.json.error || response);
|
||||
}
|
||||
|
||||
|
@ -38,9 +38,7 @@ App.Presenters.TopNavigationPresenter = function(
|
||||
loggedIn: auth.isLoggedIn(),
|
||||
user: auth.getCurrentUser(),
|
||||
canListUsers: auth.hasPrivilege(auth.privileges.listUsers),
|
||||
canListPosts: auth.hasPrivilege(auth.privileges.listSafePosts) ||
|
||||
auth.hasPrivilege(auth.privileges.listSketchyPosts) ||
|
||||
auth.hasPrivilege(auth.privileges.listUnsafePosts),
|
||||
canListPosts: auth.hasPrivilege(auth.privileges.listPosts),
|
||||
canListTags: auth.hasPrivilege(auth.privileges.listTags),
|
||||
canUploadPosts: auth.hasPrivilege(auth.privileges.uploadPosts),
|
||||
}));
|
||||
|
Reference in New Issue
Block a user