mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-12 12:47:45 +02:00
UBERF-7428: Fix memory issues (#5940)
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
@@ -109,7 +109,17 @@ export class SpacePermissionsMiddleware extends BaseMiddleware implements Middle
|
||||
space,
|
||||
spaceType.targetClass
|
||||
) as unknown as RolesAssignment
|
||||
this.assignmentBySpace[space._id] = asMixin
|
||||
|
||||
const allPossibleRoles = this.storage.modelDb.findAllSync(core.class.Role, {})
|
||||
const requiredValues: Record<string, any> = {}
|
||||
for (const role of allPossibleRoles) {
|
||||
const v = asMixin[role._id]
|
||||
if (v !== undefined) {
|
||||
requiredValues[role._id] = asMixin[role._id]
|
||||
}
|
||||
}
|
||||
|
||||
this.assignmentBySpace[space._id] = requiredValues
|
||||
|
||||
await this.setPermissions(space._id, await this.getRoles(spaceType._id), asMixin)
|
||||
}
|
||||
@@ -193,7 +203,17 @@ export class SpacePermissionsMiddleware extends BaseMiddleware implements Middle
|
||||
// Note: currently the whole assignment is always included into the mixin update
|
||||
// so we can just rebuild the permissions
|
||||
const assignment: RolesAssignment = mixinDoc.attributes as RolesAssignment
|
||||
this.assignmentBySpace[spaceId] = assignment
|
||||
|
||||
const allPossibleRoles = this.storage.modelDb.findAllSync(core.class.Role, {})
|
||||
const requiredValues: Record<string, any> = {}
|
||||
for (const role of allPossibleRoles) {
|
||||
const v = assignment[role._id]
|
||||
if (v !== undefined) {
|
||||
requiredValues[role._id] = assignment[role._id]
|
||||
}
|
||||
}
|
||||
|
||||
this.assignmentBySpace[spaceId] = requiredValues
|
||||
|
||||
this.permissionsBySpace[tx.objectId] = {}
|
||||
await this.setPermissions(spaceId, await this.getRoles(spaceType._id), assignment)
|
||||
|
||||
Reference in New Issue
Block a user