|
@@ -1518,7 +1518,7 @@ if (Meteor.isServer) {
|
|
impersonate(userId) {
|
|
impersonate(userId) {
|
|
check(userId, String);
|
|
check(userId, String);
|
|
|
|
|
|
- if (!Meteor.users.findOne(userId))
|
|
|
|
|
|
+ if (!ReactiveCache.getUser(userId))
|
|
throw new Meteor.Error(404, 'User not found');
|
|
throw new Meteor.Error(404, 'User not found');
|
|
if (!ReactiveCache.getCurrentUser().isAdmin)
|
|
if (!ReactiveCache.getCurrentUser().isAdmin)
|
|
throw new Meteor.Error(403, 'Permission denied');
|
|
throw new Meteor.Error(403, 'Permission denied');
|
|
@@ -1621,7 +1621,7 @@ if (Meteor.isServer) {
|
|
user.authenticationMethod = 'oauth2';
|
|
user.authenticationMethod = 'oauth2';
|
|
|
|
|
|
// see if any existing user has this email address or username, otherwise create new
|
|
// see if any existing user has this email address or username, otherwise create new
|
|
- const existingUser = Meteor.users.findOne({
|
|
|
|
|
|
+ const existingUser = ReactiveCache.getUser({
|
|
$or: [
|
|
$or: [
|
|
{
|
|
{
|
|
'emails.address': email,
|
|
'emails.address': email,
|
|
@@ -2025,7 +2025,7 @@ if (Meteor.isServer) {
|
|
JsonRoutes.add('GET', '/api/user', function (req, res) {
|
|
JsonRoutes.add('GET', '/api/user', function (req, res) {
|
|
try {
|
|
try {
|
|
Authentication.checkLoggedIn(req.userId);
|
|
Authentication.checkLoggedIn(req.userId);
|
|
- const data = Meteor.users.findOne({
|
|
|
|
|
|
+ const data = ReactiveCache.getUser({
|
|
_id: req.userId,
|
|
_id: req.userId,
|
|
});
|
|
});
|
|
delete data.services;
|
|
delete data.services;
|
|
@@ -2106,11 +2106,11 @@ if (Meteor.isServer) {
|
|
try {
|
|
try {
|
|
Authentication.checkUserId(req.userId);
|
|
Authentication.checkUserId(req.userId);
|
|
let id = req.params.userId;
|
|
let id = req.params.userId;
|
|
- let user = Meteor.users.findOne({
|
|
|
|
|
|
+ let user = ReactiveCache.getUser({
|
|
_id: id,
|
|
_id: id,
|
|
});
|
|
});
|
|
if (!user) {
|
|
if (!user) {
|
|
- user = Meteor.users.findOne({
|
|
|
|
|
|
+ user = ReactiveCache.getUser({
|
|
username: id,
|
|
username: id,
|
|
});
|
|
});
|
|
id = user._id;
|
|
id = user._id;
|
|
@@ -2171,7 +2171,7 @@ if (Meteor.isServer) {
|
|
Authentication.checkUserId(req.userId);
|
|
Authentication.checkUserId(req.userId);
|
|
const id = req.params.userId;
|
|
const id = req.params.userId;
|
|
const action = req.body.action;
|
|
const action = req.body.action;
|
|
- let data = Meteor.users.findOne({
|
|
|
|
|
|
+ let data = ReactiveCache.getUser({
|
|
_id: id,
|
|
_id: id,
|
|
});
|
|
});
|
|
if (data !== undefined) {
|
|
if (data !== undefined) {
|
|
@@ -2221,9 +2221,7 @@ if (Meteor.isServer) {
|
|
},
|
|
},
|
|
);
|
|
);
|
|
}
|
|
}
|
|
- data = Meteor.users.findOne({
|
|
|
|
- _id: id,
|
|
|
|
- });
|
|
|
|
|
|
+ data = ReactiveCache.getUser(id);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
JsonRoutes.sendResult(res, {
|
|
JsonRoutes.sendResult(res, {
|
|
@@ -2269,9 +2267,7 @@ if (Meteor.isServer) {
|
|
const boardId = req.params.boardId;
|
|
const boardId = req.params.boardId;
|
|
const action = req.body.action;
|
|
const action = req.body.action;
|
|
const { isAdmin, isNoComments, isCommentOnly, isWorker } = req.body;
|
|
const { isAdmin, isNoComments, isCommentOnly, isWorker } = req.body;
|
|
- let data = Meteor.users.findOne({
|
|
|
|
- _id: userId,
|
|
|
|
- });
|
|
|
|
|
|
+ let data = ReactiveCache.getUser(userId);
|
|
if (data !== undefined) {
|
|
if (data !== undefined) {
|
|
if (action === 'add') {
|
|
if (action === 'add') {
|
|
data = Boards.find({
|
|
data = Boards.find({
|
|
@@ -2332,9 +2328,7 @@ if (Meteor.isServer) {
|
|
const userId = req.params.userId;
|
|
const userId = req.params.userId;
|
|
const boardId = req.params.boardId;
|
|
const boardId = req.params.boardId;
|
|
const action = req.body.action;
|
|
const action = req.body.action;
|
|
- let data = Meteor.users.findOne({
|
|
|
|
- _id: userId,
|
|
|
|
- });
|
|
|
|
|
|
+ let data = ReactiveCache.getUser(userId);
|
|
if (data !== undefined) {
|
|
if (data !== undefined) {
|
|
if (action === 'remove') {
|
|
if (action === 'remove') {
|
|
data = Boards.find({
|
|
data = Boards.find({
|