diff --git a/djaosdb/caosdb_client.py b/djaosdb/caosdb_client.py index 5200bd55a220804a4d4d722ccfba6bdda407e7ac..8b1a9ebf90821b8903bf76dcaa63caf66164a472 100644 --- a/djaosdb/caosdb_client.py +++ b/djaosdb/caosdb_client.py @@ -186,9 +186,14 @@ class DefaultCaosDBClientDelegate: def find_auth(self, record_type, *args, **kwargs): if record_type == "caosdb_auth_user": name = kwargs["filter"]["elements"][-1]["v"] - print("find " + name) res = self._caosdb.administration._retrieve_user(name) - print(res) + columns = ["id", "password", "last_login", "is_superuser", + "username", "first_name", "last_name", "email", + "is_staff", "is_active", "date_joined"] + rows = [(0, None, None, True, "tf", "t", "f", "tf@example.com", + True, True, None,)] + return FindResult(rows, columns) + return FindResult([], []) def list_record_type_names(self): res = self._caosdb.execute_query("SELECT name FROM RECORDTYPE") @@ -246,6 +251,9 @@ class DefaultCaosDBClientDelegate: c.insert(unique=False) return InsertManyResult(c) + def update_many_auth(self, record_type: str, filter, update): + return UpdateManyResult([1]) + def update_many(self, record_type: str, filter, update): res = self._find(record_type, filter=filter) update_set = update["$set"] @@ -256,7 +264,8 @@ class DefaultCaosDBClientDelegate: if hasattr(val, "isoformat"): val = val.isoformat() e.get_property(p).value = val - res.update() + if res: + res.update() return UpdateManyResult(res) def add_foreign_key(self, record_type, *args, **kwargs): @@ -432,6 +441,8 @@ class CaosDBClient: ------- """ LOGGER.debug("update_many(%s, %s)", args, kwargs) + if args[0].startswith("caosdb_auth_"): + return self._delegate.update_many_auth(*args, **kwargs) return self._delegate.update_many(*args, **kwargs) def drop_record_type(self, *args, **kwargs):