细化了自建userRelation的情况
This commit is contained in:
parent
977db59168
commit
c9023868dd
|
|
@ -738,16 +738,16 @@ var RelationAuth = /** @class */ (function () {
|
|||
}); });
|
||||
return aas;
|
||||
};
|
||||
/**
|
||||
* 搜索判定是否允许自建对象,自建的条件是 path = '',destEntity === entity
|
||||
* @param actionAuths
|
||||
* @returns
|
||||
*/
|
||||
var findOwnCreateUserRelation = function (actionAuths) {
|
||||
if (userRelations) {
|
||||
var ars = actionAuths.filter(function (ar) { return !!userRelations.find(function (ur) { return ur.relationId === ar.relationId; }); });
|
||||
(0, assert_1.default)(action === 'create');
|
||||
var ars = actionAuths.filter(function (ar) { return !!userRelations.find(function (ur) { return ur.relationId === ar.relationId; }) && ar.paths.includes('') && ar.destEntity === entity; });
|
||||
if (ars.length > 0) {
|
||||
// 这里能找到actionAuth,其必然是本对象上的授权
|
||||
// 下面这个看不懂,跑到了再说
|
||||
// assert(!ars.find(
|
||||
// ele => ele.path !== '' || ele.destEntity !== entity
|
||||
// ));
|
||||
console.log('跑到你要看的代码了');
|
||||
return ars;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -905,21 +905,21 @@ export class RelationAuth<ED extends EntityDict & BaseEntityDict>{
|
|||
return aas;
|
||||
};
|
||||
|
||||
/**
|
||||
* 搜索判定是否允许自建对象,自建的条件是 path = '',destEntity === entity
|
||||
* @param actionAuths
|
||||
* @returns
|
||||
*/
|
||||
const findOwnCreateUserRelation = (actionAuths: ED['actionAuth']['Schema'][]) => {
|
||||
if (userRelations) {
|
||||
assert(action === 'create');
|
||||
const ars = actionAuths.filter(
|
||||
(ar) => !!userRelations.find(
|
||||
(ur) => ur.relationId === ar.relationId
|
||||
)
|
||||
) && ar.paths.includes('') && ar.destEntity === entity
|
||||
);
|
||||
|
||||
if (ars.length > 0) {
|
||||
// 这里能找到actionAuth,其必然是本对象上的授权
|
||||
// 下面这个看不懂,跑到了再说
|
||||
// assert(!ars.find(
|
||||
// ele => ele.path !== '' || ele.destEntity !== entity
|
||||
// ));
|
||||
console.log('跑到你要看的代码了');
|
||||
return ars;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue