Skip to content
Snippets Groups Projects
Commit f02f23b0 authored by Henrik tom Wörden's avatar Henrik tom Wörden
Browse files

ENH: add procedure to collect ACL for a set of entities

parent 26292eb6
No related branches found
No related tags found
No related merge requests found
Pipeline #25800 failed
/*
* This file is a part of the CaosDB Project.
*
* Copyright (C) 2022 IndiScale GmbH
* Copyright (C) 2022 Henrik tom Wörden
*
* 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 Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
/**
* Creates a table with the columns (entity ID, acl) from a given table with
* entity IDs. Here, acl in the string representation of the acl.
* Parameters
* ----------
*
* entitySet: table with list of IDs
*/
DELIMITER //
DROP PROCEDURE IF EXISTS db_5_0.applyPOV;
CREATE OR REPLACE PROCEDURE db_5_0.getACLForEntitySet(in entitySet VARCHAR(255))
BEGIN
-- TODO in future one might want to retrieve only a distinct set of acl
-- with (acl_id, acl) and a table with (entity_id, acl_id) to reduce the
-- amount of data being transfered
-- TODO Double check: Versioning is not an issue here since acl is not
-- versioned.
SET @stmtStr = CONCAT('SELECT entity_n_acl.id, entity_acl.acl from ',
'(select entities.id, entities.acl from entities where id in (select id from `',
entitySet,
'`) ) as entity_n_acl inner join entity_acl on entity_n_acl.acl=entity_acl.id;',)
PREPARE stmt FROM @stmtStr;
EXECUTE stmt;
END
//
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment