Skip to content

Can't update ACL in case of duplicate names

In case of updating the ACL of a Record with a not unique name, update_acl terminates with a

TransactionError: TransactionError: One or more entities are not qualified. None of them have been inserted/updated/deleted.
    +--| REASONS |--
    |  -> RECORD (id: 749, name: 'Social Sciences') CAUSED     |UniqueNamesError: Name is already in use. Choose a different name or reuse an existing entity.
    +----------------

To reproduce:

import caosdb as db
rt1 = db.RecordType(name="TestType1")
rt2 = db.RecordType(name="TestType2")
rec1 = db.Record(name="Test").add_parent(rt1)
rec2 = db.Record(name="Test").add_parent(rt2)

db.Container().extend([rt1, rt2, rec1, rec2]).insert(unique=False)

rec1.retrieve(flags={"ACL": None})
rec1.grant(role="anonymous", permission="RETRIEVE:*", priority=False)
rec1.update_acl()  # Results in UniqueNamesError

Maybe also a Pylib bug?

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information