diff --git a/app/authorization/client/hasPermission.js b/app/authorization/client/hasPermission.js index 8b7fda69bca1..33cee33364fe 100644 --- a/app/authorization/client/hasPermission.js +++ b/app/authorization/client/hasPermission.js @@ -5,11 +5,11 @@ import { ChatPermissions } from './lib/ChatPermissions'; function atLeastOne(permissions = [], scope) { return permissions.some((permissionId) => { - const permission = ChatPermissions.findOne(permissionId); + const permission = ChatPermissions.findOne(permissionId, { fields: { roles: 1 } }); const roles = (permission && permission.roles) || []; return roles.some((roleName) => { - const role = Models.Roles.findOne(roleName); + const role = Models.Roles.findOne(roleName, { fields: { scope: 1 } }); const roleScope = role && role.scope; const model = Models[roleScope]; @@ -20,11 +20,11 @@ function atLeastOne(permissions = [], scope) { function all(permissions = [], scope) { return permissions.every((permissionId) => { - const permission = ChatPermissions.findOne(permissionId); + const permission = ChatPermissions.findOne(permissionId, { fields: { roles: 1 } }); const roles = (permission && permission.roles) || []; return roles.some((roleName) => { - const role = Models.Roles.findOne(roleName); + const role = Models.Roles.findOne(roleName, { fields: { scope: 1 } }); const roleScope = role && role.scope; const model = Models[roleScope]; diff --git a/app/models/client/models/Subscriptions.js b/app/models/client/models/Subscriptions.js index 602f06c5e271..5d2f9198daf0 100644 --- a/app/models/client/models/Subscriptions.js +++ b/app/models/client/models/Subscriptions.js @@ -14,7 +14,7 @@ Object.assign(Subscriptions, { rid: roomId, }; - const subscription = this.findOne(query); + const subscription = this.findOne(query, { fields: { roles: 1 } }); return subscription && Array.isArray(subscription.roles) && subscription.roles.includes(roleName); }, { maxAge: 1000 }), diff --git a/app/threads/client/flextab/thread.html b/app/threads/client/flextab/thread.html index 863ebb2c6751..64d88d2c8735 100644 --- a/app/threads/client/flextab/thread.html +++ b/app/threads/client/flextab/thread.html @@ -14,9 +14,9 @@