From a16fb3cf8e2ab965de75f977ea6789d3193b7d16 Mon Sep 17 00:00:00 2001
From: florian <f.spreckelsen@inidscale.com>
Date: Mon, 24 Apr 2023 16:26:48 +0200
Subject: [PATCH] WIP: Copy retrieve and update functions for ACL from other
 repo

---
 src/TransactionService.js | 27 +++++++++++++++++++++++++--
 1 file changed, 25 insertions(+), 2 deletions(-)

diff --git a/src/TransactionService.js b/src/TransactionService.js
index 53e5cd5..a242e6f 100644
--- a/src/TransactionService.js
+++ b/src/TransactionService.js
@@ -1,8 +1,9 @@
 /*
  * This file is a part of the CaosDB Project.
  *
- * Copyright (C) 2021 IndiScale GmbH <info@indiscale.com>
- * Copyright (C) 2021 Florian Spreckelsen <f.spreckelsen@indiscale.com>
+ * Copyright (C) 2021-2023 IndiScale GmbH <info@indiscale.com>
+ * Copyright (C) 2021-2023 Florian Spreckelsen <f.spreckelsen@indiscale.com>
+ * Copyright (C) 2021-2023 Timm Fitschen <t.fitschen@indiscale.com>
  *
  * This program is free software: you can redistribute it and/or modify it under
  * the terms of the GNU Affero General Public License as published by the Free
@@ -84,4 +85,26 @@ export class TransactionService {
         const queryRequest = this._CreateQueryRequest(query);
         return new Promise(this._PrepareTransaction(queryRequest));
     }
+
+    async retrieveEntityAcl(id) {
+        const client = new api.v1.EntityTransactionServicePromiseClient(this.uri, null, null);
+        const request = new api.v1.MultiRetrieveEntityACLRequest();
+        request.addId(id);
+        const response = await client.multiRetrieveEntityACL(request, {});
+
+        return convertMessageToEntityACL(response.getAclsList()[0]);
+    }
+
+    async updateEntityAcl(acl) {
+        const updateAcl = convertEntityAclToMessage(acl);
+
+        const client = new api.v1.EntityTransactionServicePromiseClient(this.uri, null, null);
+        const request = new api.v1.MultiUpdateEntityACLRequest();
+        request.setAclsList([updateAcl]);
+
+        const response = await client.multiUpdateEntityACL(request, {});
+        return response;
+    }
+
+
 }
-- 
GitLab