Skip to content
This repository has been archived by the owner on Apr 22, 2024. It is now read-only.

Commit

Permalink
Avoid extending group list
Browse files Browse the repository at this point in the history
  • Loading branch information
stephan271 committed Jul 28, 2021
1 parent d634076 commit e7677da
Showing 1 changed file with 3 additions and 25 deletions.
28 changes: 3 additions & 25 deletions server/boot/0-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ module.exports = function (app) {
const UserIdentity = app.models.UserIdentity;
const RoleMapping = app.models.RoleMapping;
const Role = app.models.Role;
const ShareGroup = app.models.ShareGroup;
// first check if email in User
User.findById(ctx.args.options.accessToken.userId, function (
err,
Expand Down Expand Up @@ -168,30 +167,9 @@ module.exports = function (app) {
if (typeof groups === "undefined") {
groups = [];
}
const regex = "/" + u.profile.email + "/i";
// get users share groups and add to the current groups context
ShareGroup.find({
where: {
members: {
regexp: regex
}
}
},
function (err, share) {
if (err) return next(err);
groups = [
...groups,
...share.map(({
id
}) => {
return String(id);
})
];
ctx.args.options.currentGroups = groups;
// console.log("============ Phase:", ctx.args.options.currentGroups)
return next();
}
);
ctx.args.options.currentGroups = groups;
// console.log("============ Phase:", ctx.args.options.currentGroups)
return next();
} else {
ctx.args.options.currentGroups = [];
return next();
Expand Down

0 comments on commit e7677da

Please sign in to comment.