Skip to content
Snippets Groups Projects
Commit a16fb3cf authored by florian's avatar florian
Browse files

WIP: Copy retrieve and update functions for ACL from other repo

parent 7a5e7b08
Branches
Tags
1 merge request!3F entity permissions
/* /*
* This file is a part of the CaosDB Project. * This file is a part of the CaosDB Project.
* *
* Copyright (C) 2021 IndiScale GmbH <info@indiscale.com> * Copyright (C) 2021-2023 IndiScale GmbH <info@indiscale.com>
* Copyright (C) 2021 Florian Spreckelsen <f.spreckelsen@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 * 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 * the terms of the GNU Affero General Public License as published by the Free
...@@ -84,4 +85,26 @@ export class TransactionService { ...@@ -84,4 +85,26 @@ export class TransactionService {
const queryRequest = this._CreateQueryRequest(query); const queryRequest = this._CreateQueryRequest(query);
return new Promise(this._PrepareTransaction(queryRequest)); 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;
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment