node-casbin
node-casbin copied to clipboard
coreEnforcer.buildRoleLinksInternal calls model.buildRoleLinks(rmMap) on values of rmMap
https://github.com/casbin/node-casbin/blob/f859d105b31668a93f965f1e2d6c3c5cb7f22f3d/src/coreEnforcer.ts#L367
Due to a refactor ~6 months ago, model.buildRoleLinks(rmMap) is called within a loop over rmMap.values() in coreEnforcer.buildRoleLinksInternal(). Not only is this inefficient, but if rmMap is empty then model.buildRoleLinks() will never be called.
@Gabriel-403 @Zxilly @kingiw @nodece
@richard-sim do you have any suggestions on how it can be improved?
@fabian4 @nodece
@Shivansh-yadav13: It's been a while since I opened this issue, but IIRC it should not be in the loop at all (as it was prior to the refactor that I referred to).
Not only is this inefficient, but if rmMap is empty then model.buildRoleLinks() will never be called.
but we will have Default Role Manager? if we use role definition in the model