[#5741] use random string as id for non-system collections and fields

This commit is contained in:
Gani Georgiev
2024-10-29 20:08:16 +02:00
parent 658f0c4177
commit 5a94ec9918
9 changed files with 236 additions and 150 deletions

View File

@@ -660,8 +660,13 @@ func onCollectionDeleteExecute(e *CollectionEvent) error {
// -------------------------------------------------------------------
func (c *Collection) initDefaultId() {
if c.Id == "" && c.Name != "" {
c.Id = "_pbc_" + crc32Checksum(c.Name)
if c.Id == "" {
if c.System && c.Name != "" {
// for system collections we use crc32 checksum for consistency because they cannot be renamed
c.Id = "_pbc_" + crc32Checksum(c.Name)
} else {
c.Id = "_pbc_" + security.RandomStringWithAlphabet(10, DefaultIdAlphabet)
}
}
}