Add privilege for accessing user information (#7859)

* Add view users info global privilege

* Show user ip only to global mods and admins

* fix missing comma

* Hide link for users without correct privilege

* move getting privilege information to getAllData

* Hide the link from Global Moderators as well

* Give Global Moderator view:users:info privilege

* Restrict ip in post menu to view:users:info

* add some trailing commas....

* Add privilege to categories test

* Add group privilege to categories test

* add upgrade script

* fix style for TravisCI

* more styling - change spaces to tabs

* some more styling fixes (hopefully final one)

* fix style for Travis CI

* hide ip in chat messages

* Don't show even hidden ips on user profile page
This commit is contained in:
Opliko
2019-09-17 18:02:52 +00:00
committed by Barış Soner Uşaklı
parent 781b3f1a9a
commit b9583ed838
10 changed files with 69 additions and 8 deletions

View File

@@ -31,6 +31,7 @@ module.exports = function (SocketPosts) {
tools: plugins.fireHook('filter:post.tools', { pid: data.pid, uid: socket.uid, tools: [] }),
postSharing: social.getActivePostSharing(),
history: posts.diffs.exists(data.pid),
canViewInfo: privileges.global.can('view:users:info', socket.uid),
});
const postData = results.posts;
@@ -48,7 +49,7 @@ module.exports = function (SocketPosts) {
postData.display_history = results.history;
postData.toolsVisible = postData.tools.length || postData.display_moderator_tools;
if (!results.isAdmin && !results.isGlobalMod && !results.isModerator) {
if (!results.isAdmin && !results.canViewInfo) {
postData.ip = undefined;
}
return results;