Merge branch 'release'
This commit is contained in:
commit
907d78daff
|
|
@ -668,14 +668,11 @@ class RelationAuth {
|
||||||
const filters = actionAuths.filter(ele => ele.path.destEntity === entity).map((ele) => {
|
const filters = actionAuths.filter(ele => ele.path.destEntity === entity).map((ele) => {
|
||||||
const { path, relation, relationId } = ele;
|
const { path, relation, relationId } = ele;
|
||||||
if (relationId) {
|
if (relationId) {
|
||||||
(0, assert_1.default)(relation);
|
|
||||||
const { userRelation$relation: userRelations } = relation;
|
|
||||||
(0, assert_1.default)(userRelations.length > 0);
|
|
||||||
const entityIds = (0, lodash_1.uniq)(userRelations.map(ele => ele.entityId));
|
|
||||||
const pathFilter = this.makePathFilter(entity, path, this.schema, {
|
const pathFilter = this.makePathFilter(entity, path, this.schema, {
|
||||||
id: entityIds.length > 0 ? {
|
userRelation$entity: {
|
||||||
$in: entityIds,
|
userId: context.getCurrentUserId(),
|
||||||
} : entityIds[0],
|
relationId,
|
||||||
|
}
|
||||||
});
|
});
|
||||||
return pathFilter;
|
return pathFilter;
|
||||||
}
|
}
|
||||||
|
|
@ -727,20 +724,7 @@ class RelationAuth {
|
||||||
recursive: 1,
|
recursive: 1,
|
||||||
},
|
},
|
||||||
deActions: 1,
|
deActions: 1,
|
||||||
relation: {
|
relationId: 1,
|
||||||
id: 1,
|
|
||||||
userRelation$relation: {
|
|
||||||
$entity: 'userRelation',
|
|
||||||
data: {
|
|
||||||
id: 1,
|
|
||||||
entity: 1,
|
|
||||||
entityId: 1,
|
|
||||||
},
|
|
||||||
filter: {
|
|
||||||
userId: context.getCurrentUserId(),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
filter: {
|
filter: {
|
||||||
deActions: {
|
deActions: {
|
||||||
|
|
@ -751,20 +735,6 @@ class RelationAuth {
|
||||||
$in: allEntities,
|
$in: allEntities,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
$or: [
|
|
||||||
{
|
|
||||||
relation: {
|
|
||||||
userRelation$relation: {
|
|
||||||
userId: context.getCurrentUserId(),
|
|
||||||
},
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
relationId: {
|
|
||||||
$exists: false,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
}, { dontCollect: true, ignoreAttrMiss: true });
|
}, { dontCollect: true, ignoreAttrMiss: true });
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "oak-domain",
|
"name": "oak-domain",
|
||||||
"version": "4.2.0",
|
"version": "4.2.1",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "XuChang"
|
"name": "XuChang"
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -839,14 +839,11 @@ export class RelationAuth<ED extends EntityDict & BaseEntityDict> {
|
||||||
(ele) => {
|
(ele) => {
|
||||||
const { path, relation, relationId } = ele;
|
const { path, relation, relationId } = ele;
|
||||||
if (relationId) {
|
if (relationId) {
|
||||||
assert(relation);
|
|
||||||
const { userRelation$relation: userRelations } = relation;
|
|
||||||
assert(userRelations!.length > 0);
|
|
||||||
const entityIds = uniq(userRelations!.map(ele => ele.entityId));
|
|
||||||
const pathFilter = this.makePathFilter(entity, path, this.schema, {
|
const pathFilter = this.makePathFilter(entity, path, this.schema, {
|
||||||
id: entityIds.length > 0 ? {
|
userRelation$entity: {
|
||||||
$in: entityIds,
|
userId: context.getCurrentUserId()!,
|
||||||
} : entityIds[0],
|
relationId,
|
||||||
|
}
|
||||||
});
|
});
|
||||||
return pathFilter;
|
return pathFilter;
|
||||||
}
|
}
|
||||||
|
|
@ -924,20 +921,7 @@ export class RelationAuth<ED extends EntityDict & BaseEntityDict> {
|
||||||
recursive: 1,
|
recursive: 1,
|
||||||
},
|
},
|
||||||
deActions: 1,
|
deActions: 1,
|
||||||
relation: {
|
relationId: 1,
|
||||||
id: 1,
|
|
||||||
userRelation$relation: {
|
|
||||||
$entity: 'userRelation',
|
|
||||||
data: {
|
|
||||||
id: 1,
|
|
||||||
entity: 1,
|
|
||||||
entityId: 1,
|
|
||||||
},
|
|
||||||
filter: {
|
|
||||||
userId: context.getCurrentUserId(),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
filter: {
|
filter: {
|
||||||
deActions: {
|
deActions: {
|
||||||
|
|
@ -948,20 +932,6 @@ export class RelationAuth<ED extends EntityDict & BaseEntityDict> {
|
||||||
$in: allEntities as string[],
|
$in: allEntities as string[],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
$or: [
|
|
||||||
{
|
|
||||||
relation: {
|
|
||||||
userRelation$relation: {
|
|
||||||
userId: context.getCurrentUserId(),
|
|
||||||
},
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
relationId: {
|
|
||||||
$exists: false,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
}, { dontCollect: true, ignoreAttrMiss: true });
|
}, { dontCollect: true, ignoreAttrMiss: true });
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue