123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081(*********************************************************************************)(* OCaml-RDF *)(* *)(* Copyright (C) 2012-2021 Institut National de Recherche en Informatique *)(* et en Automatique. All rights reserved. *)(* *)(* This program is free software; you can redistribute it and/or modify *)(* it under the terms of the GNU Lesser General Public License version *)(* 3 as published by the Free Software Foundation. *)(* *)(* 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 General Public License for more details. *)(* *)(* You should have received a copy of the GNU General Public License *)(* along with this program; if not, write to the Free Software *)(* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA *)(* 02111-1307 USA *)(* *)(* Contact: Maxence.Guesdon@inria.fr *)(* *)(*********************************************************************************)(** *)(** See {{:https://github.com/solid/web-access-control-spec#individual-resource-acls} Solid WAC} *)openAcl.Opentyperights=intletno_right=0letadd_read=(lor)1letrem_read=(land)(lnot1)lethas_readr=rland1<>0letadd_write=(lor)2letrem_write=(land)(lnot2)lethas_writer=rland2<>0letadd_append=(lor)4letrem_append=(land)(lnot4)lethas_appendr=rland4<>0letadd_control=(lor)8letrem_control=(land)(lnot8)lethas_controlr=rland8<>0letall_rights=add_read(add_write(add_append(add_controlno_right)))letadd_rights_of_modes=List.fold_left(funaccmode->ifIri.equalmodeacl_c_Readthenadd_readaccelseifIri.equalmodeacl_c_Writethenadd_writeaccelseifIri.equalmodeacl_c_Appendthenadd_appendaccelseifIri.equalmodeacl_c_Controlthenadd_controlaccelseacc)letrights_to_stringr=letb=Buffer.create4inletpc=Buffer.add_charbcinp'[';ifhas_readrthenp'r';ifhas_writerthenp'w';ifhas_appendrthenp'a';ifhas_controlrthenp'c';p']';Buffer.contentsbletmodes_of_rightsr=letacc=[]inletacc=ifhas_readrthenacl_c_Read::accelseaccinletacc=ifhas_writerthenacl_c_Write::accelseaccinletacc=ifhas_appendrthenacl_c_Append::accelseaccinletacc=ifhas_controlrthenacl_c_Control::accelseaccinacc