jsreport / jsreport-core

The minimalist jsreport rendering core
GNU Lesser General Public License v3.0
86 stars 24 forks source link

validate the "publicKey" property of entity is not duplicated when creating new entity #36

Closed bjrmatos closed 5 years ago

bjrmatos commented 6 years ago

we should validate that the property that is marked as publicKey: true in definition of entity (almost in all cases is the property name) does not end duplicated in the store.

i think we can do this by using a .beforeInsert listener that is added at .initializeListeners stage, i think that order is important in order to let other logic with more higher priority (like the one in jo) to be able to run first.

we should also review if the extensions are using publicKey: true where it is expected, and what other extensions are not using it at all (like UserType in jsreport-authentication that is not using it)

bjrmatos commented 5 years ago

this was done as part of the folders support, "publicKey" are now validated according to folder level, which means that entity name is unique per folder level, entity name can be duplicated only if the entities belongs to different folder levels