From c8e2011901fab935b3da08503c99d517fcd5511b Mon Sep 17 00:00:00 2001
From: Zhangyanrui123 <2844259537@qq.com>
Date: Thu, 5 Nov 2026 00:23:34 +0800
Subject: [PATCH 1/3] build: prepare Apache Casbin C++ 1.68.0
---
.clang-format | 17 +
.github/scripts/release.py | 149 +++++
.github/scripts/test_release.py | 186 ++++++
.github/semantic.yml | 17 +
.github/vcpkg/casbin/portfile.cmake | 51 +-
.github/vcpkg/casbin/vcpkg.json | 6 +-
.github/workflows/benchmark.yml | 38 +-
.github/workflows/ci.yml | 52 +-
.github/workflows/memcheck.yml | 38 +-
.github/workflows/python_binding.yml | 37 +-
.github/workflows/release.yml | 248 +++-----
.gitignore | 8 +
CMakeLists.txt | 47 +-
CONTRIBUTING.md | 19 +
DISCLAIMER | 8 +
LICENSE | 222 +++++++
MANIFEST.in | 27 +-
NOTICE | 12 +
README.md | 75 ++-
RELEASING.md | 95 +++
THIRD_PARTY.md | 48 ++
casbin/.clang-format | 17 +
casbin/CMakeLists.txt | 29 +-
casbin/config/config.cpp | 25 +-
casbin/config/testdata/testini.ini | 17 +
casbin/effect/default_effector.cpp | 25 +-
casbin/enforcer.cpp | 25 +-
casbin/enforcer_cached.cpp | 25 +-
casbin/enforcer_synced.cpp | 30 +-
casbin/internal_api.cpp | 25 +-
.../ip_parser/exception/parser_exception.cpp | 33 +
casbin/ip_parser/parser/CIDRMask.cpp | 33 +
casbin/ip_parser/parser/IP.cpp | 33 +
casbin/ip_parser/parser/IPNet.cpp | 33 +
casbin/ip_parser/parser/IPv4.cpp | 33 +
casbin/ip_parser/parser/Print.cpp | 33 +
casbin/ip_parser/parser/allFF.cpp | 33 +
casbin/ip_parser/parser/dtoi.cpp | 33 +
casbin/ip_parser/parser/equal.cpp | 33 +
casbin/ip_parser/parser/parseCIDR.cpp | 33 +
casbin/ip_parser/parser/parseIP.cpp | 33 +
casbin/ip_parser/parser/parseIPv4.cpp | 33 +
casbin/ip_parser/parser/parseIPv6.cpp | 33 +
casbin/ip_parser/parser/xtoi.cpp | 33 +
casbin/logger.cpp | 19 +
casbin/management_api.cpp | 25 +-
casbin/model/assertion.cpp | 25 +-
casbin/model/evaluator.cpp | 26 +-
casbin/model/function.cpp | 25 +-
casbin/model/model.cpp | 25 +-
casbin/model/policy_collection.cpp | 25 +-
casbin/pch.cpp | 45 +-
casbin/persist/adapter.cpp | 25 +-
casbin/persist/adapter.h | 25 +-
casbin/persist/batch_adapter.h | 25 +-
casbin/persist/default_watcher.cpp | 25 +-
casbin/persist/default_watcher.h | 25 +-
casbin/persist/default_watcher_ex.cpp | 25 +-
casbin/persist/default_watcher_ex.h | 25 +-
.../file_adapter/batch_file_adapter.cpp | 19 +
.../persist/file_adapter/batch_file_adapter.h | 19 +
casbin/persist/file_adapter/file_adapter.cpp | 19 +
casbin/persist/file_adapter/file_adapter.h | 19 +
.../file_adapter/filtered_file_adapter.cpp | 19 +
.../file_adapter/filtered_file_adapter.h | 19 +
casbin/persist/filtered_adapter.h | 25 +-
casbin/persist/persist.h | 25 +-
casbin/persist/string_adapter.cpp | 19 +
casbin/persist/string_adapter.h | 19 +
casbin/persist/watcher.h | 25 +-
casbin/persist/watcher_ex.h | 25 +-
casbin/persist/watcher_update.h | 25 +-
casbin/rbac/default_role_manager.cpp | 25 +-
casbin/rbac_api.cpp | 25 +-
casbin/rbac_api_with_domains.cpp | 25 +-
casbin/selected_policies.cpp | 25 +-
casbin/util/array_equals.cpp | 25 +-
casbin/util/array_remove_duplicates.cpp | 25 +-
casbin/util/array_to_string.cpp | 25 +-
casbin/util/built_in_functions.cpp | 25 +-
casbin/util/ends_with.cpp | 25 +-
casbin/util/escape_assertion.cpp | 25 +-
casbin/util/eval.cpp | 25 +-
casbin/util/find_all_occurences.cpp | 25 +-
casbin/util/is_instance_of.cpp | 25 +-
casbin/util/join.cpp | 25 +-
casbin/util/join_slice.cpp | 25 +-
casbin/util/remove_comments.cpp | 25 +-
casbin/util/set_subtract.cpp | 25 +-
casbin/util/split.cpp | 25 +-
casbin/util/ticker.cpp | 57 +-
casbin/util/trim.cpp | 25 +-
cmake/casbinConfig.cmake.in | 28 +-
cmake/modules/FindExtPackages.cmake | 28 +-
cmake/modules/Findbenchmark.cmake | 27 +-
cmake/modules/Findgoogletest.cmake | 28 +-
cmake/modules/Findjson.cmake | 19 +-
cmake/modules/Findpybind11.cmake | 27 +-
examples/abac_model.conf | 17 +
examples/abac_rule_model.conf | 17 +
examples/abac_rule_policy.csv | 17 +
examples/basic_inverse_policy.csv | 17 +
examples/basic_model.conf | 17 +
examples/basic_model_without_spaces.conf | 17 +
examples/basic_policy.csv | 17 +
examples/basic_with_root_model.conf | 17 +
examples/basic_without_resources_model.conf | 17 +
examples/basic_without_resources_policy.csv | 17 +
examples/basic_without_users_model.conf | 17 +
examples/basic_without_users_policy.csv | 17 +
examples/comment_model.conf | 17 +
examples/error/error_model.conf | 17 +
examples/error/error_policy.csv | 17 +
examples/glob_model.conf | 17 +
examples/glob_policy.csv | 17 +
examples/ipmatch_model.conf | 17 +
examples/ipmatch_policy.csv | 17 +
examples/keymatch2_model.conf | 17 +
examples/keymatch2_policy.csv | 17 +
examples/keymatch_custom_model.conf | 17 +
examples/keymatch_model.conf | 17 +
examples/keymatch_policy.csv | 17 +
.../rbac_with_pattern_large_scale_model.conf | 17 +
.../rbac_with_pattern_large_scale_policy.csv | 17 +
examples/priority_indeterminate_policy.csv | 17 +
examples/priority_model.conf | 17 +
examples/priority_policy.csv | 17 +
examples/rbac_model.conf | 17 +
examples/rbac_model_in_multi_line.conf | 17 +
examples/rbac_model_matcher_using_in_op.conf | 17 +
examples/rbac_policy.csv | 17 +
examples/rbac_with_all_pattern_model.conf | 17 +
examples/rbac_with_all_pattern_policy.csv | 17 +
examples/rbac_with_deny_model.conf | 17 +
examples/rbac_with_deny_policy.csv | 17 +
examples/rbac_with_domain_pattern_model.conf | 17 +
examples/rbac_with_domain_pattern_policy.csv | 17 +
examples/rbac_with_domains_model.conf | 17 +
examples/rbac_with_domains_policy.csv | 17 +
examples/rbac_with_hierarchy_policy.csv | 17 +
...bac_with_hierarchy_with_domains_policy.csv | 17 +
examples/rbac_with_not_deny_model.conf | 17 +
examples/rbac_with_pattern_model.conf | 17 +
examples/rbac_with_pattern_policy.csv | 17 +
examples/rbac_with_resource_roles_model.conf | 17 +
examples/rbac_with_resource_roles_policy.csv | 17 +
include/casbin/casbin.h | 29 +-
include/casbin/casbin_types.h | 29 +-
include/casbin/config/config.h | 25 +-
include/casbin/config/config_interface.h | 25 +-
include/casbin/config/testdata/testini.ini | 17 +
include/casbin/data_types.h | 25 +-
include/casbin/effect/default_effector.h | 25 +-
include/casbin/effect/effect.h | 25 +-
include/casbin/effect/effector.h | 25 +-
include/casbin/enforcer.h | 569 +++++++++---------
include/casbin/enforcer_cached.h | 25 +-
include/casbin/enforcer_interface.h | 25 +-
include/casbin/enforcer_synced.h | 25 +-
include/casbin/error/error.h | 19 +
.../exception/casbin_adapter_exception.h | 25 +-
.../exception/casbin_enforcer_exception.h | 25 +-
.../casbin/exception/casbin_rbac_exception.h | 25 +-
include/casbin/exception/exception.h | 25 +-
.../exception/illegal_argument_exception.h | 25 +-
include/casbin/exception/io_exception.h | 25 +-
.../exception/missing_required_sections.h | 25 +-
.../unsupported_operation_exception.h | 25 +-
.../ip_parser/exception/parser_exception.h | 33 +
include/casbin/ip_parser/parser/CIDR.h | 33 +
include/casbin/ip_parser/parser/CIDRMask.h | 33 +
include/casbin/ip_parser/parser/IP.h | 33 +
include/casbin/ip_parser/parser/IPMask.h | 33 +
include/casbin/ip_parser/parser/IPNet.h | 33 +
include/casbin/ip_parser/parser/IPv4.h | 33 +
include/casbin/ip_parser/parser/Print.h | 33 +
include/casbin/ip_parser/parser/allFF.h | 33 +
include/casbin/ip_parser/parser/byte.h | 33 +
include/casbin/ip_parser/parser/dtoi.h | 33 +
include/casbin/ip_parser/parser/equal.h | 33 +
include/casbin/ip_parser/parser/parseCIDR.h | 33 +
include/casbin/ip_parser/parser/parseIP.h | 33 +
include/casbin/ip_parser/parser/parseIPv4.h | 33 +
include/casbin/ip_parser/parser/parseIPv6.h | 33 +
include/casbin/ip_parser/parser/xtoi.h | 33 +
include/casbin/log/Logger.h | 19 +
include/casbin/log/default_logger.h | 19 +
include/casbin/log/log_util.h | 19 +
include/casbin/model/assertion.h | 25 +-
include/casbin/model/evaluator.h | 19 +
include/casbin/model/exprtk_config.h | 25 +-
include/casbin/model/function.h | 25 +-
include/casbin/model/model.h | 25 +-
include/casbin/model/policy_collection.hpp | 25 +-
include/casbin/pch.h | 97 +--
include/casbin/persist/adapter.h | 25 +-
include/casbin/persist/batch_adapter.h | 25 +-
include/casbin/persist/default_watcher.h | 25 +-
include/casbin/persist/default_watcher_ex.h | 25 +-
.../persist/file_adapter/batch_file_adapter.h | 19 +
.../persist/file_adapter/file_adapter.h | 19 +
.../file_adapter/filtered_file_adapter.h | 19 +
include/casbin/persist/filtered_adapter.h | 25 +-
include/casbin/persist/persist.h | 25 +-
include/casbin/persist/string_adapter.h | 19 +
include/casbin/persist/watcher.h | 25 +-
include/casbin/persist/watcher_ex.h | 25 +-
include/casbin/persist/watcher_update.h | 25 +-
include/casbin/rbac/default_role_manager.h | 25 +-
include/casbin/rbac/rbac.h | 25 +-
include/casbin/rbac/role_manager.h | 25 +-
include/casbin/selected_policies.h | 25 +-
include/casbin/util/built_in_functions.h | 25 +-
include/casbin/util/ticker.h | 34 +-
include/casbin/util/util.h | 25 +-
licenses/nlohmann-json-LICENSE.txt | 21 +
licenses/pybind11-LICENSE.txt | 29 +
pycasbin/CMakeLists.txt | 27 +-
pycasbin/README.md | 42 +-
pycasbin/src/main.cpp | 35 +-
pycasbin/src/py_adapter.cpp | 31 +-
pycasbin/src/py_cached_enforcer.cpp | 31 +-
pycasbin/src/py_casbin.h | 31 +-
pycasbin/src/py_config.cpp | 31 +-
pycasbin/src/py_enforcer.cpp | 31 +-
pycasbin/src/py_model.cpp | 31 +-
pycasbin/src/py_synced_enforcer.cpp | 31 +-
pycasbin/tests/config_path.py | 25 +-
pycasbin/tests/pycasbin_test_suite.py | 25 +-
pycasbin/tests/test_adapter.py | 25 +-
pycasbin/tests/test_cached_enforcer.py | 25 +-
pycasbin/tests/test_config.py | 25 +-
pycasbin/tests/test_enforcer.py | 25 +-
pycasbin/tests/test_model.py | 25 +-
pycasbin/tests/test_synced_enforcer.py | 25 +-
setup.py | 51 +-
tests/CMakeLists.txt | 28 +-
tests/benchmarks/CMakeLists.txt | 25 +-
tests/benchmarks/config_path.h | 29 +-
tests/benchmarks/enforcer_cached_b.cpp | 29 +-
tests/benchmarks/enforcer_cached_b_inten.cpp | 29 +-
tests/benchmarks/main.cpp | 29 +-
tests/benchmarks/management_api_b.cpp | 29 +-
tests/benchmarks/management_api_b_inten.cpp | 29 +-
tests/benchmarks/model_b.cpp | 29 +-
tests/benchmarks/model_b_inten.cpp | 29 +-
tests/benchmarks/role_manager_b.cpp | 29 +-
tests/benchmarks/role_manager_b_inten.cpp | 29 +-
tests/built_in_functions_test.cpp | 29 +-
tests/config_path.h | 29 +-
tests/config_test.cpp | 36 +-
tests/enforcer_cached_test.cpp | 29 +-
tests/enforcer_synced_test.cpp | 29 +-
tests/enforcer_test.cpp | 29 +-
tests/management_api_test.cpp | 29 +-
tests/matcher_release_test.cpp | 144 +++++
tests/model_enforcer_test.cpp | 29 +-
tests/model_test.cpp | 29 +-
tests/rbac_api_test.cpp | 29 +-
tests/rbac_api_with_domains_test.cpp | 29 +-
tests/role_manager_test.cpp | 29 +-
tests/util_test.cpp | 29 +-
262 files changed, 5972 insertions(+), 2205 deletions(-)
create mode 100644 .github/scripts/release.py
create mode 100644 .github/scripts/test_release.py
create mode 100644 DISCLAIMER
create mode 100644 NOTICE
create mode 100644 RELEASING.md
create mode 100644 THIRD_PARTY.md
create mode 100644 licenses/nlohmann-json-LICENSE.txt
create mode 100644 licenses/pybind11-LICENSE.txt
create mode 100644 tests/matcher_release_test.cpp
diff --git a/.clang-format b/.clang-format
index 86eced8a..eea6ec28 100644
--- a/.clang-format
+++ b/.clang-format
@@ -1,3 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
BasedOnStyle: Google
Language: Cpp
PointerAlignment: Right
diff --git a/.github/scripts/release.py b/.github/scripts/release.py
new file mode 100644
index 00000000..3eb328e6
--- /dev/null
+++ b/.github/scripts/release.py
@@ -0,0 +1,149 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+import argparse
+import gzip
+import hashlib
+import io
+import re
+import subprocess
+import tarfile
+import tempfile
+import urllib.parse
+import urllib.request
+from pathlib import Path
+
+PROJECT = "casbin-cpp"
+COMPONENT = "cpp"
+MANIFEST = "CMakeLists.txt"
+ASF_BASE = "https://downloads.apache.org/incubator/casbin"
+
+
+def git(*args):
+ return subprocess.check_output(["git", *args])
+
+
+def metadata(tag):
+ match = re.fullmatch(r"v(\d+\.\d+\.\d+)(-rc[1-9]\d*)?", tag)
+ if not match:
+ raise ValueError("Use vX.Y.Z or vX.Y.Z-rcN (N >= 1)")
+ version, rc = match.groups()
+ manifest = git("show", f"{tag}:{MANIFEST}")
+ committed = re.search(rb"\bVERSION\s+(\d+\.\d+\.\d+)", manifest)
+ if not committed:
+ raise ValueError("Missing committed CMake project version")
+ actual = committed.group(1).decode("ascii")
+ if actual != version:
+ raise ValueError(f"Commit version {actual} does not match {version}; no version stamping")
+ name = f"apache-{PROJECT}-{version}-incubating-src"
+ return version, bool(rc), name
+
+
+def inventory(data, name):
+ result = {}
+ with tarfile.open(fileobj=io.BytesIO(data), mode="r:*") as archive:
+ for member in archive:
+ parts = Path(member.name).parts
+ if not parts or parts[0] != name or ".." in parts or "\\" in member.name:
+ raise ValueError(f"Unexpected archive path: {member.name}")
+ if member.isdir():
+ continue
+ if not member.isfile() or member.name in result:
+ raise ValueError(f"Link, special file or duplicate: {member.name}")
+ result[member.name] = (archive.extractfile(member).read(), member.mode & 0o777)
+ for required in ("LICENSE", "NOTICE", "DISCLAIMER", MANIFEST):
+ if f"{name}/{required}" not in result:
+ raise ValueError(f"Missing {required}")
+ return result
+
+
+def source(tag, name):
+ data = git("archive", "--format=tar", f"--prefix={name}/", tag)
+ inventory(data, name)
+ return data
+
+
+def download(url):
+ with urllib.request.urlopen(url, timeout=90) as response:
+ destination = urllib.parse.urlparse(response.url)
+ if (
+ destination.scheme != "https"
+ or destination.hostname not in ("downloads.apache.org", "dlcdn.apache.org")
+ or not destination.path.startswith("/incubator/casbin/")
+ ):
+ raise ValueError("Download redirected outside the project's approved ASF release area")
+ return response.read()
+
+
+def verify_signature(key_data, target, signature):
+ with tempfile.TemporaryDirectory() as scratch:
+ keyhome = Path(scratch) / "gnupg"
+ keyhome.mkdir(mode=0o700)
+ keys = Path(scratch) / "KEYS"
+ keys.write_bytes(key_data)
+ subprocess.run(["gpg", "--batch", "--homedir", str(keyhome), "--import", str(keys)], check=True)
+ subprocess.run(
+ ["gpg", "--batch", "--homedir", str(keyhome), "--verify", str(signature), str(target)], check=True
+ )
+
+
+def main():
+ parser = argparse.ArgumentParser()
+ parser.add_argument("command", choices=["meta", "archive", "verify"])
+ parser.add_argument("tag")
+ parser.add_argument("output", nargs="?", default="dist-release")
+ args = parser.parse_args()
+ version, rc, name = metadata(args.tag)
+ if args.command == "meta":
+ print(f"version={version}\nis_rc={str(rc).lower()}\nname={name}")
+ return
+ output = Path(args.output)
+ if output.exists() and any(output.iterdir()):
+ raise ValueError("Refusing to replace existing release files; choose an empty output directory")
+ output.mkdir(parents=True, exist_ok=True)
+ expected = source(args.tag, name)
+ filename = name + ".tar.gz"
+ target = output / filename
+ if args.command == "archive":
+ if not rc:
+ raise ValueError("Final releases must reuse approved ASF originals, not rebuild source archives")
+ target.write_bytes(gzip.compress(expected, mtime=0))
+ (output / (filename + ".sha512")).write_text(
+ hashlib.sha512(target.read_bytes()).hexdigest() + " " + filename + "\n", encoding="ascii"
+ )
+ else:
+ if rc:
+ raise ValueError("An RC cannot enter final publication")
+ url = f"{ASF_BASE}/{COMPONENT}-{version}-incubating/{filename}"
+ for suffix in ("", ".sha512", ".asc"):
+ (output / (filename + suffix)).write_bytes(download(url + suffix))
+ checksum = (output / (filename + ".sha512")).read_text(encoding="utf8").split()
+ if len(checksum) != 2 or checksum[1].lstrip("*") != filename:
+ raise ValueError("Unexpected checksum record")
+ if hashlib.sha512(target.read_bytes()).hexdigest() != checksum[0].lower():
+ raise ValueError("SHA-512 mismatch")
+ verify_signature(download(ASF_BASE + "/KEYS"), target, output / (filename + ".asc"))
+ if inventory(target.read_bytes(), name) != inventory(expected, name):
+ raise ValueError("Approved source contents/modes differ from the selected Git tag")
+ # Build package registries only from the approved source, never a fresh checkout.
+ with tarfile.open(target) as archive:
+ archive.extractall(output / "source", filter="data")
+ print(f"Verified {target}; {'local unsigned candidate' if rc else 'approved ASF original'}")
+
+
+if __name__ == "__main__":
+ main()
diff --git a/.github/scripts/test_release.py b/.github/scripts/test_release.py
new file mode 100644
index 00000000..4fb760c3
--- /dev/null
+++ b/.github/scripts/test_release.py
@@ -0,0 +1,186 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+import contextlib
+import gzip
+import hashlib
+import io
+import os
+import subprocess
+import sys
+import tarfile
+import tempfile
+import unittest
+from pathlib import Path
+from unittest.mock import patch
+
+import release
+
+
+class ReleaseSafetyTest(unittest.TestCase):
+ def setUp(self):
+ self.previous = Path.cwd()
+ self.directory = tempfile.TemporaryDirectory()
+ os.chdir(self.directory.name)
+ subprocess.run(["git", "init", "-q"], check=True)
+ for key, value in (("user.name", "Fixture"), ("user.email", "fixture@example.invalid")):
+ subprocess.run(["git", "config", key, value], check=True)
+ text = 'project(casbin VERSION 1.2.3 LANGUAGES CXX)\n'
+ Path(release.MANIFEST).write_text(text, encoding="utf8")
+ for filename in ("LICENSE", "NOTICE", "DISCLAIMER", "README.md"):
+ Path(filename).write_text(
+ "Fixture for command safety, not a legal compliance assessment.\n", encoding="utf8"
+ )
+ self.commit()
+ for tag in ("v1.2.3", "v1.2.3-rc1"):
+ subprocess.run(["git", "tag", tag], check=True)
+ self.name = release.metadata("v1.2.3")[2]
+ # A different gzip compression level proves verify preserves originals.
+ self.original = gzip.compress(release.source("v1.2.3", self.name), compresslevel=1, mtime=0)
+
+
+ def tearDown(self):
+ os.chdir(self.previous)
+ self.directory.cleanup()
+
+
+ def commit(self):
+ subprocess.run(["git", "add", "-A"], check=True)
+ subprocess.run(["git", "commit", "-qm", "fixture"], check=True)
+
+
+ def invoke(self, *args):
+ with patch.object(sys, "argv", ["release.py", *args]), contextlib.redirect_stdout(io.StringIO()):
+ release.main()
+
+
+ def downloaded(self, url):
+ if url.endswith("KEYS"):
+ return b"MOCK KEY: cryptographic verification is covered by later real RC checks"
+ if url.endswith(".sha512"):
+ return (hashlib.sha512(self.original).hexdigest() + " " + self.name + ".tar.gz\n").encode()
+ if url.endswith(".asc"):
+ return b"MOCK SIGNATURE"
+ return self.original
+
+
+ def test_strict_tags(self):
+ for tag in ("master", "v1", "v1.2.3-rc0", "v1.2.3-beta1", "v1.2.3-rc1/x", "v1.2.3 "):
+ with self.subTest(tag=tag), self.assertRaises(ValueError):
+ release.metadata(tag)
+
+
+ def test_version_must_be_committed(self):
+ subprocess.run(["git", "tag", "v1.2.4-rc1"], check=True)
+ with self.assertRaises(ValueError):
+ release.metadata("v1.2.4-rc1")
+
+
+ def test_reproducible_candidate(self):
+ self.invoke("archive", "v1.2.3-rc1", "one")
+ self.invoke("archive", "v1.2.3-rc1", "two")
+ filename = self.name + ".tar.gz"
+ self.assertEqual((Path("one") / filename).read_bytes(), (Path("two") / filename).read_bytes())
+
+
+ def test_refuses_overwrite(self):
+ Path("existing").mkdir()
+ Path("existing/sentinel").write_bytes(b"preserve")
+ with self.assertRaises(ValueError):
+ self.invoke("archive", "v1.2.3-rc1", "existing")
+ self.assertEqual(Path("existing/sentinel").read_bytes(), b"preserve")
+
+
+ def test_final_cannot_be_rebuilt(self):
+ with self.assertRaises(ValueError):
+ self.invoke("archive", "v1.2.3", "final")
+
+
+ def test_rc_cannot_be_promoted(self):
+ with self.assertRaises(ValueError), patch.object(release, "download") as download:
+ self.invoke("verify", "v1.2.3-rc1", "promotion")
+ download.assert_not_called()
+
+
+ def test_missing_legal_file(self):
+ Path("NOTICE").unlink()
+ self.commit()
+ subprocess.run(["git", "tag", "v1.2.3-rc2"], check=True)
+ with self.assertRaises(ValueError):
+ self.invoke("archive", "v1.2.3-rc2", "missing")
+
+
+ def test_rejects_unsafe_archive_entries(self):
+ for path, link in (("../escape", False), (self.name + "/../escape", False), (self.name + "/link", True)):
+ buffer = io.BytesIO()
+ with tarfile.open(fileobj=buffer, mode="w") as archive:
+ entry = tarfile.TarInfo(path)
+ if link:
+ entry.type = tarfile.SYMTYPE
+ entry.linkname = "../../escape"
+ archive.addfile(entry)
+ with self.subTest(path=path), self.assertRaises(ValueError):
+ release.inventory(buffer.getvalue(), self.name)
+
+
+ def test_preserves_original_bytes_after_mock_verification(self):
+ with (
+ patch.object(release, "download", side_effect=self.downloaded),
+ patch.object(release, "verify_signature") as gpg,
+ ):
+ self.invoke("verify", "v1.2.3", "approved")
+ self.assertEqual(gpg.call_count, 1)
+ self.assertEqual((Path("approved") / (self.name + ".tar.gz")).read_bytes(), self.original)
+ self.assertTrue((Path("approved/source") / self.name / release.MANIFEST).is_file())
+
+
+ def test_checksum_failure_stops_before_gpg_and_build(self):
+ def bad(url):
+ return (
+ ("0" * 128 + " " + self.name + ".tar.gz\n").encode()
+ if url.endswith(".sha512")
+ else self.downloaded(url)
+ )
+
+ with patch.object(release, "download", side_effect=bad), patch.object(release, "verify_signature") as gpg:
+ with self.assertRaises(ValueError):
+ self.invoke("verify", "v1.2.3", "bad-checksum")
+ gpg.assert_not_called()
+ self.assertFalse(Path("bad-checksum/source").exists())
+
+
+ def test_signature_failure_stops_before_build(self):
+ with patch.object(release, "download", side_effect=self.downloaded):
+ with patch.object(release, "verify_signature", side_effect=subprocess.CalledProcessError(1, "gpg")):
+ with self.assertRaises(subprocess.CalledProcessError):
+ self.invoke("verify", "v1.2.3", "bad-signature")
+ self.assertFalse(Path("bad-signature/source").exists())
+
+
+ def test_different_approved_source_is_rejected(self):
+ Path("README.md").write_text("Changed source\n", encoding="utf8")
+ self.commit()
+ subprocess.run(["git", "tag", "-f", "v1.2.3"], check=True, stdout=subprocess.DEVNULL)
+ with patch.object(release, "download", side_effect=self.downloaded), patch.object(release, "verify_signature"):
+ with self.assertRaises(ValueError):
+ self.invoke("verify", "v1.2.3", "different-source")
+ self.assertFalse(Path("different-source/source").exists())
+
+
+
+if __name__ == "__main__":
+ unittest.main()
diff --git a/.github/semantic.yml b/.github/semantic.yml
index c400ee1d..43853d66 100644
--- a/.github/semantic.yml
+++ b/.github/semantic.yml
@@ -1,2 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
# Always validate the PR titles and the commits messages
titleAndCommits: true
\ No newline at end of file
diff --git a/.github/vcpkg/casbin/portfile.cmake b/.github/vcpkg/casbin/portfile.cmake
index c5bd87be..d1841e2a 100644
--- a/.github/vcpkg/casbin/portfile.cmake
+++ b/.github/vcpkg/casbin/portfile.cmake
@@ -1,33 +1,32 @@
-# Template for the vcpkg `casbin` port. The Release workflow substitutes
-# @VERSION@ and @SHA512@ and opens a pull request against microsoft/vcpkg;
-# this file is never consumed by vcpkg directly from here.
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# Template: replace @VERSION@ and @SHA512@ only after Apache approval.
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
-
-vcpkg_from_github(
- OUT_SOURCE_PATH SOURCE_PATH
- REPO casbin/casbin-cpp
- REF "v${VERSION}"
+vcpkg_download_distfile(ARCHIVE
+ URLS "https://downloads.apache.org/incubator/casbin/cpp-@VERSION@-incubating/apache-casbin-cpp-@VERSION@-incubating-src.tar.gz"
+ FILENAME "apache-casbin-cpp-@VERSION@-incubating-src.tar.gz"
SHA512 @SHA512@
- HEAD_REF master
-)
-
-vcpkg_cmake_configure(
- SOURCE_PATH "${SOURCE_PATH}"
- OPTIONS
- # Everything below pulls its dependencies in with FetchContent, which a
- # port build has no network for. nlohmann_json is the one real
- # dependency and comes from vcpkg instead.
- -DCASBIN_BUILD_TEST=OFF
- -DCASBIN_BUILD_BENCHMARK=OFF
- -DCASBIN_BUILD_PYTHON_BINDINGS=OFF
- -DCASBIN_INSTALL=ON
)
-
+vcpkg_extract_source_archive(SOURCE_PATH ARCHIVE "${ARCHIVE}")
+vcpkg_cmake_configure(SOURCE_PATH "${SOURCE_PATH}" OPTIONS
+ -DCASBIN_BUILD_TEST=OFF -DCASBIN_BUILD_BENCHMARK=OFF
+ -DCASBIN_BUILD_PYTHON_BINDINGS=OFF -DCASBIN_INSTALL=ON)
vcpkg_cmake_install()
-
vcpkg_cmake_config_fixup(PACKAGE_NAME casbin CONFIG_PATH lib/cmake/casbin)
-
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
-
-vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
+vcpkg_install_copyright(FILE_LIST "${CURRENT_PACKAGES_DIR}/share/casbin/LICENSE" "${CURRENT_PACKAGES_DIR}/share/casbin/NOTICE" "${CURRENT_PACKAGES_DIR}/share/casbin/DISCLAIMER")
diff --git a/.github/vcpkg/casbin/vcpkg.json b/.github/vcpkg/casbin/vcpkg.json
index 79263191..86a127f6 100644
--- a/.github/vcpkg/casbin/vcpkg.json
+++ b/.github/vcpkg/casbin/vcpkg.json
@@ -1,9 +1,9 @@
{
"name": "casbin",
"version": "@VERSION@",
- "description": "An authorization library that supports access control models like ACL, RBAC, ABAC in C/C++",
- "homepage": "https://github.com/casbin/casbin-cpp",
- "license": "Apache-2.0",
+ "description": "Apache Casbin (Incubating) C++ authorization library. Apache Casbin is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF.",
+ "homepage": "https://github.com/apache/casbin-cpp",
+ "license": "Apache-2.0 AND MIT AND BSD-3-Clause",
"dependencies": [
"nlohmann-json",
{
diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml
index f4f7565a..4d2748ce 100644
--- a/.github/workflows/benchmark.yml
+++ b/.github/workflows/benchmark.yml
@@ -1,16 +1,19 @@
-# Copyright 2021 The casbin Authors. All Rights Reserved.
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-# http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
name: Benchmark
@@ -20,6 +23,9 @@ on:
- master
pull_request:
+permissions:
+ contents: read
+
jobs:
benchmark:
name: Benchmark
@@ -27,9 +33,11 @@ jobs:
steps:
- name: Checkout
id: checkout
- uses: actions/checkout@v7
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
+ with:
+ persist-credentials: false
- name: Setup Python
- uses: actions/setup-python@v7
+ uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7
with:
python-version: '3.x'
- name: Setup CMake
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index bd6f7bb6..35c3b006 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -1,16 +1,19 @@
-# Copyright 2021 The casbin Authors. All Rights Reserved.
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-# http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
name: CI
@@ -20,6 +23,9 @@ on:
- master
pull_request:
+permissions:
+ contents: read
+
jobs:
linux:
name: "Ubuntu Latest (GCC)"
@@ -27,9 +33,13 @@ jobs:
steps:
- name: Checkout
id: checkout
- uses: actions/checkout@v7
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
+ with:
+ persist-credentials: false
+ - name: Release helper safeguards
+ run: python .github/scripts/test_release.py
- name: Setup Python
- uses: actions/setup-python@v7
+ uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7
with:
python-version: '3.x'
- name: Setup CMake
@@ -58,9 +68,11 @@ jobs:
steps:
- name: Checkout
id: checkout
- uses: actions/checkout@v7
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
+ with:
+ persist-credentials: false
- name: Setup Python
- uses: actions/setup-python@v7
+ uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7
with:
python-version: '3.x'
- name: Setup CMake
@@ -88,9 +100,11 @@ jobs:
steps:
- name: Checkout
id: checkout
- uses: actions/checkout@v7
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
+ with:
+ persist-credentials: false
- name: Setup Python
- uses: actions/setup-python@v7
+ uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7
with:
python-version: '3.x'
- name: Setup CMake
diff --git a/.github/workflows/memcheck.yml b/.github/workflows/memcheck.yml
index 405c2fa2..3001e0cd 100644
--- a/.github/workflows/memcheck.yml
+++ b/.github/workflows/memcheck.yml
@@ -1,16 +1,19 @@
-# Copyright 2021 The casbin Authors. All Rights Reserved.
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-# http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
name: Memcheck
@@ -20,6 +23,9 @@ on:
- master
pull_request:
+permissions:
+ contents: read
+
jobs:
linux:
name: "Ubuntu Latest (GCC)"
@@ -27,9 +33,11 @@ jobs:
steps:
- name: Checkout
id: checkout
- uses: actions/checkout@v7
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
+ with:
+ persist-credentials: false
- name: Setup Python
- uses: actions/setup-python@v7
+ uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7
with:
python-version: '3.x'
- name: Setup CMake
diff --git a/.github/workflows/python_binding.yml b/.github/workflows/python_binding.yml
index 814d0647..eabd79b3 100644
--- a/.github/workflows/python_binding.yml
+++ b/.github/workflows/python_binding.yml
@@ -1,16 +1,19 @@
-# Copyright 2021 The casbin Authors. All Rights Reserved.
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-# http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
name: Python Bindings Test
@@ -20,6 +23,9 @@ on:
- master
pull_request:
+permissions:
+ contents: read
+
jobs:
build:
strategy:
@@ -31,10 +37,11 @@ jobs:
runs-on: ${{ matrix.platform }}
steps:
- - uses: actions/checkout@v7
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
submodules: true
- - uses: actions/setup-python@v7
+ persist-credentials: false
+ - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7
with:
python-version: ${{ matrix.python-version }}
- name: Add requirements
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 989dbedc..84f68a8f 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -1,199 +1,119 @@
-# Copyright 2026 The casbin Authors. All Rights Reserved.
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-# http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# Releases are cut by hand: the release manager pushes a tag, and this workflow
-# turns that tag into a GitHub release. Nothing is published on a plain merge to
-# master, because an Apache release has to be voted on before it exists.
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
#
-# v1.4.0-rc1 -> GitHub *pre-release*, for the release manager to sign and
-# put up for a vote.
-# v1.4.0 -> GitHub release plus a pull request against the vcpkg
-# registry, once that vote has passed.
+# https://www.apache.org/licenses/LICENSE-2.0
#
-# Both cases attach the same source package, named and laid out the way an
-# Apache release vote expects. The release manager downloads it, signs it
-# locally, and votes with it; the signature never comes back through here.
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
name: Release
on:
push:
- tags:
- - 'v*'
+ tags: ['v*-rc*']
+ workflow_dispatch:
+ inputs:
+ tag:
+ description: 'Existing final tag vX.Y.Z, pointing at the approved candidate commit'
+ required: true
+ type: string
+ project_result:
+ description: 'Public project vote result URL (lists.apache.org/thread/...)'
+ required: true
+ type: string
+ incubator_result:
+ description: 'Public IPMC vote result URL (lists.apache.org/thread/...)'
+ required: true
+ type: string
permissions:
contents: write
+concurrency:
+ group: release-${{ github.repository }}-${{ inputs.tag || github.ref_name }}
+ cancel-in-progress: false
+
jobs:
- github-release:
- name: GitHub release
- if: github.repository == 'apache/casbin-cpp'
+ release:
+ if: github.repository == 'apache/casbin-cpp' && (github.event_name == 'push' || github.ref == 'refs/heads/master')
runs-on: ubuntu-latest
- outputs:
- version: ${{ steps.meta.outputs.version }}
- prerelease: ${{ steps.meta.outputs.prerelease }}
steps:
- - name: Checkout
- uses: actions/checkout@v7
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
+ ref: ${{ inputs.tag || github.ref }}
fetch-depth: 0
-
- - name: Read the version out of the tag
+ persist-credentials: false
+ - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7
+ with:
+ python-version: '3.12'
+ - name: Validate mode and committed version
id: meta
+ env:
+ TAG: ${{ inputs.tag || github.ref_name }}
+ EVENT: ${{ github.event_name }}
+ PROJECT_RESULT: ${{ inputs.project_result }}
+ INCUBATOR_RESULT: ${{ inputs.incubator_result }}
run: |
set -euo pipefail
- tag="${GITHUB_REF_NAME}"
- full="${tag#v}"
- # The package always carries the final version, even for a release
- # candidate, so the exact bits that were voted on can be promoted
- # without being repackaged: v1.4.0-rc1 also packages as 1.4.0.
- version="${full%%-rc*}"
- if [ "$full" = "$version" ]; then
- prerelease=false
+ python .github/scripts/release.py meta "$TAG" >> "$GITHUB_OUTPUT"
+ if [[ "$EVENT" == workflow_dispatch ]]; then
+ [[ "$TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]
+ [[ "$PROJECT_RESULT" =~ ^https://lists\.apache\.org/thread/[a-z0-9]+$ ]]
+ [[ "$INCUBATOR_RESULT" =~ ^https://lists\.apache\.org/thread/[a-z0-9]+$ ]]
else
- prerelease=true
+ [[ "$TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+-rc[1-9][0-9]*$ ]]
fi
- {
- echo "version=${version}"
- echo "prerelease=${prerelease}"
- } >> "$GITHUB_OUTPUT"
- echo "::notice::${tag} -> version ${version}, prerelease=${prerelease}"
-
- - name: Build the source release package
- id: package
+ - name: Export unsigned source candidate
+ if: steps.meta.outputs.is_rc == 'true'
env:
- VERSION: ${{ steps.meta.outputs.version }}
- run: |
- set -euo pipefail
- name="apache-casbin-cpp-${VERSION}-src"
- # git archive ships exactly what is tracked at the tag: no .git, no
- # build output, no bundled binaries, everything under a single
- # versioned top-level directory.
- git archive --format=tar.gz --prefix="${name}/" -o "${name}.tar.gz" "${GITHUB_REF_NAME}"
- sha512sum "${name}.tar.gz" > "${name}.tar.gz.sha512"
- echo "tarball=${name}.tar.gz" >> "$GITHUB_OUTPUT"
-
- - name: Check the package carries the required legal files
+ TAG: ${{ github.ref_name }}
+ run: python .github/scripts/release.py archive "$TAG"
+ - name: Verify approved ASF originals against the final tag
+ if: steps.meta.outputs.is_rc == 'false'
env:
- TARBALL: ${{ steps.package.outputs.tarball }}
- run: |
- set -euo pipefail
- prefix="${TARBALL%.tar.gz}"
- # Listed once into a variable: piping tar into `grep -q` would leave
- # tar killed by SIGPIPE, which pipefail reports as a failed check.
- listing="$(tar -tzf "${TARBALL}")"
- for legal in LICENSE NOTICE; do
- if ! grep -qx "${prefix}/${legal}" <<< "${listing}"; then
- echo "::error::${legal} is missing from ${TARBALL}; the release vote would fail on it"
- exit 1
- fi
- done
-
- - name: Publish the release
+ TAG: ${{ inputs.tag }}
+ run: python .github/scripts/release.py verify "$TAG"
+ - name: Refuse replacement of an existing GitHub release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- TARBALL: ${{ steps.package.outputs.tarball }}
- PRERELEASE: ${{ steps.meta.outputs.prerelease }}
+ TAG: ${{ inputs.tag || github.ref_name }}
run: |
set -euo pipefail
- args=(--title "${GITHUB_REF_NAME}" --generate-notes)
- if [ "${PRERELEASE}" = "true" ]; then
- args+=(--prerelease)
+ if gh release view "$TAG" >/dev/null 2>&1; then
+ echo '::error::Release exists; assets will not be overwritten. Inspect partial publication before retrying.'
+ exit 1
fi
- gh release create "${GITHUB_REF_NAME}" "${args[@]}" "${TARBALL}" "${TARBALL}.sha512"
-
- vcpkg:
- name: Submit to vcpkg
- needs: github-release
- # Release candidates exist only for the vote; they never reach a registry.
- if: needs.github-release.outputs.prerelease == 'false'
- runs-on: ubuntu-latest
- env:
- VERSION: ${{ needs.github-release.outputs.version }}
- # A fork of microsoft/vcpkg that the token below can push to.
- FORK: ${{ vars.VCPKG_FORK || 'casbin/vcpkg' }}
- steps:
- - name: Check the vcpkg fork token is configured
- id: gate
+ - name: Write release notes
env:
- VCPKG_PR_TOKEN: ${{ secrets.VCPKG_PR_TOKEN }}
+ IS_RC: ${{ steps.meta.outputs.is_rc }}
+ VERSION: ${{ steps.meta.outputs.version }}
+ PROJECT_RESULT: ${{ inputs.project_result }}
+ INCUBATOR_RESULT: ${{ inputs.incubator_result }}
run: |
- if [ -n "${VCPKG_PR_TOKEN}" ]; then
- echo "enabled=true" >> "$GITHUB_OUTPUT"
+ printf 'Apache Casbin (Incubating) — C++ %s\n\n' "$VERSION" > release-notes.md
+ cat DISCLAIMER >> release-notes.md
+ if [[ "$IS_RC" == true ]]; then
+ printf '\n\nUnsigned source candidate for review; the RM must sign and stage it before voting. This is not an approved release.\n' >> release-notes.md
else
- echo "enabled=false" >> "$GITHUB_OUTPUT"
- echo "::warning::VCPKG_PR_TOKEN is not set, so no vcpkg pull request was opened for ${VERSION}."
+ printf '\n\nProject result: %s\nIPMC result: %s\nSource assets are the approved ASF originals.\n' "$PROJECT_RESULT" "$INCUBATOR_RESULT" >> release-notes.md
+ printf '\nSource: https://downloads.apache.org/incubator/casbin/cpp-%s-incubating/\nKEYS: https://downloads.apache.org/incubator/casbin/KEYS\nVerification: https://www.apache.org/info/verification.html\n' "$VERSION" >> release-notes.md
fi
-
- - name: Checkout casbin-cpp
- if: steps.gate.outputs.enabled == 'true'
- uses: actions/checkout@v7
- with:
- path: casbin-cpp
-
- - name: Checkout vcpkg
- if: steps.gate.outputs.enabled == 'true'
- uses: actions/checkout@v7
- with:
- repository: microsoft/vcpkg
- path: vcpkg
- fetch-depth: 0
-
- - name: Render the casbin port
- if: steps.gate.outputs.enabled == 'true'
- run: |
- set -euo pipefail
- # vcpkg_from_github pins the tarball GitHub generates for the tag, so
- # that is the file whose checksum goes into the port.
- curl -fsSL -o source.tar.gz \
- "https://github.com/${GITHUB_REPOSITORY}/archive/refs/tags/v${VERSION}.tar.gz"
- sha512="$(sha512sum source.tar.gz | cut -d' ' -f1)"
- mkdir -p vcpkg/ports/casbin
- for file in portfile.cmake vcpkg.json; do
- sed -e "s|@VERSION@|${VERSION}|g" -e "s|@SHA512@|${sha512}|g" \
- "casbin-cpp/.github/vcpkg/casbin/${file}" > "vcpkg/ports/casbin/${file}"
- done
-
- - name: Update the vcpkg version database
- if: steps.gate.outputs.enabled == 'true'
- working-directory: vcpkg
- run: |
- set -euo pipefail
- git config user.name "casbin-bot"
- git config user.email "casbin-bot@users.noreply.github.com"
- git add ports/casbin
- git commit -m "[casbin] Update to ${VERSION}"
- ./bootstrap-vcpkg.sh -disableMetrics
- # x-add-version reads the port out of the commit above, so it has to
- # run after it; the result is folded back into the same commit.
- ./vcpkg x-add-version casbin --overwrite-version
- git add versions
- git commit --amend --no-edit
-
- - name: Open the pull request against microsoft/vcpkg
- if: steps.gate.outputs.enabled == 'true'
- working-directory: vcpkg
+ - name: Create GitHub release without replacing assets
env:
- GH_TOKEN: ${{ secrets.VCPKG_PR_TOKEN }}
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ TAG: ${{ inputs.tag || github.ref_name }}
+ IS_RC: ${{ steps.meta.outputs.is_rc }}
run: |
set -euo pipefail
- branch="casbin-${VERSION}"
- git remote add fork "https://x-access-token:${GH_TOKEN}@github.com/${FORK}.git"
- git push --force fork "HEAD:${branch}"
- gh pr create \
- --repo microsoft/vcpkg \
- --base master \
- --head "${FORK%%/*}:${branch}" \
- --title "[casbin] Update to ${VERSION}" \
- --body "Updates the \`casbin\` port to ${VERSION}, released at https://github.com/${GITHUB_REPOSITORY}/releases/tag/v${VERSION}."
+ kind=(--latest)
+ if [[ "$IS_RC" == true ]]; then kind=(--prerelease --latest=false); fi
+ gh release create "$TAG" --title "$TAG (Apache Casbin Incubating)" --notes-file release-notes.md "${kind[@]}" dist-release/*.tar.gz dist-release/*.sha512 $(find dist-release -maxdepth 1 -name '*.asc' -print)
diff --git a/.gitignore b/.gitignore
index 4ad8ebf0..fe684068 100644
--- a/.gitignore
+++ b/.gitignore
@@ -368,3 +368,11 @@ build_support/
# clang-format
build_support/clang_format_exclusions.txt
+
+# Local CMake/Python/release verification outputs
+/build*/
+/dist/
+/dist-release/
+*.egg-info/
+__pycache__/
+*.py[cod]
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 917862da..4b2f0be8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,21 +1,23 @@
-# Copyright 2020 The casbin Authors. All Rights Reserved.
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# https://www.apache.org/licenses/LICENSE-2.0
#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
cmake_minimum_required(VERSION 3.19)
-set(CMAKE_WARN_DEPRECATED ON)
-set(PY_CASBIN_VERSION 1.1)
+set(PY_CASBIN_VERSION 1.68.0)
if(APPLE AND NOT DEFINED CMAKE_OSX_DEPLOYMENT_TARGET)
# The value of this variable should be set prior to the first project() command invocation
@@ -28,9 +30,9 @@ endif()
project(
casbin
- VERSION 1.53.2
+ VERSION 1.68.0
DESCRIPTION "An authorization library that supports access control models like ACL, RBAC, ABAC in C/C++"
- HOMEPAGE_URL https://github.com/casbin/casbin-cpp
+ HOMEPAGE_URL https://github.com/apache/casbin-cpp
LANGUAGES CXX C
)
@@ -111,7 +113,7 @@ endif()
# "make check-format"
# Only support clang format for unix like operating system.
-if(UNIX)
+if(UNIX AND EXISTS "${CMAKE_SOURCE_DIR}/build_support/run_clang_format.py")
# Expected directory structure.
set(CASBIN_BUILD_SUPPORT_DIR "${CMAKE_SOURCE_DIR}/build_support")
set(CASBIN_CLANG_SEARCH_PATH "/usr/local/bin" "/usr/bin" "/usr/local/opt/llvm/bin" "/usr/local/opt/llvm@8/bin"
@@ -186,6 +188,19 @@ if(CASBIN_INSTALL)
set(CASBIN_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/casbin"
CACHE STRING "Path to the installed casbin CMake package files")
+ # Carry the exact source legal material into installed C++ packages.
+ file(READ "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE" CASBIN_BINARY_LICENSE)
+ string(FIND "${CASBIN_BINARY_LICENSE}" "setup.py contains build helper code" CASBIN_SOURCE_ONLY_LICENSE)
+ if(CASBIN_SOURCE_ONLY_LICENSE GREATER -1)
+ string(SUBSTRING "${CASBIN_BINARY_LICENSE}" 0 ${CASBIN_SOURCE_ONLY_LICENSE} CASBIN_BINARY_LICENSE)
+ endif()
+ file(READ "${CMAKE_CURRENT_SOURCE_DIR}/licenses/nlohmann-json-LICENSE.txt" CASBIN_JSON_LICENSE)
+ file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/LICENSE-installed"
+ "${CASBIN_BINARY_LICENSE}\nThe installed library includes code compiled from nlohmann/json (MIT):\n\n${CASBIN_JSON_LICENSE}")
+ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/LICENSE-installed"
+ DESTINATION ${CMAKE_INSTALL_DATADIR}/casbin RENAME LICENSE)
+ install(FILES NOTICE DISCLAIMER DESTINATION ${CMAKE_INSTALL_DATADIR}/casbin)
+
# Installing headers
install(
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/casbin
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 9ad6326a..d3a306fa 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -1,3 +1,22 @@
+
+
# How to contribute
The following is a set of guidelines for contributing to casbin and its libraries, which are hosted at [casbin organization at Github](https://github.com/casbin).
diff --git a/DISCLAIMER b/DISCLAIMER
new file mode 100644
index 00000000..8631ee2c
--- /dev/null
+++ b/DISCLAIMER
@@ -0,0 +1,8 @@
+Apache Casbin is an effort undergoing incubation at The Apache Software
+Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of
+all newly accepted projects until a further review indicates that the
+infrastructure, communications, and decision making process have stabilized
+in a manner consistent with other successful ASF projects. While incubation
+status is not necessarily a reflection of the completeness or stability of
+the code, it does indicate that the project has yet to be fully endorsed by
+the ASF.
diff --git a/LICENSE b/LICENSE
index 261eeb9e..8610fc34 100644
--- a/LICENSE
+++ b/LICENSE
@@ -199,3 +199,225 @@
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
+
+----------------------------------------------------------------------
+Bundled third-party material
+----------------------------------------------------------------------
+
+include/casbin/exprtk/exprtk.hpp contains ExprTk by Arash Partow, under the
+MIT license below. The upstream header and its attribution are preserved.
+
+Copyright (C) 1999-2024 Arash Partow
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to
+do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
+----------------------------------------------------------------------
+casbin/ip_parser/ and include/casbin/ip_parser/ contain C++ adaptations of
+the Go net IP parsing code. The Go-derived portions use the following BSD
+license; Casbin's contributions remain under Apache-2.0.
+
+Copyright (c) 2009 The Go Authors. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+ * Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above
+copyright notice, this list of conditions and the following disclaimer
+in the documentation and/or other materials provided with the
+distribution.
+ * Neither the name of Google Inc. nor the names of its
+contributors may be used to endorse or promote products derived from
+this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+----------------------------------------------------------------------
+setup.py contains build helper code derived from pybind/cmake_example.
+Its applicable license follows (Casbin metadata changes are Apache-2.0).
+
+Copyright (c) 2016 The Pybind Development Team, All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+3. Neither the name of the copyright holder nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+You are under no obligation whatsoever to provide any bug fixes, patches, or
+upgrades to the features, functionality or performance of the source code
+("Enhancements") to anyone; however, if you choose to make your Enhancements
+available either publicly, or directly to the author of this software, without
+imposing a separate written license agreement for such Enhancements, then you
+hereby grant the following license: a non-exclusive, royalty-free perpetual
+license to install, use, modify, prepare derivative works, incorporate into
+other computer software, distribute, and sublicense such enhancements or
+derivative works thereof, in binary and source code form.
+
+----------------------------------------------------------------------
+.gitignore incorporates the github/gitignore VisualStudio.gitignore template
+under CC0 1.0 Universal:
+
+CC0 1.0 Universal
+
+Statement of Purpose
+
+The laws of most jurisdictions throughout the world automatically confer
+exclusive Copyright and Related Rights (defined below) upon the creator and
+subsequent owner(s) (each and all, an "owner") of an original work of
+authorship and/or a database (each, a "Work").
+
+Certain owners wish to permanently relinquish those rights to a Work for the
+purpose of contributing to a commons of creative, cultural and scientific
+works ("Commons") that the public can reliably and without fear of later
+claims of infringement build upon, modify, incorporate in other works, reuse
+and redistribute as freely as possible in any form whatsoever and for any
+purposes, including without limitation commercial purposes. These owners may
+contribute to the Commons to promote the ideal of a free culture and the
+further production of creative, cultural and scientific works, or to gain
+reputation or greater distribution for their Work in part through the use and
+efforts of others.
+
+For these and/or other purposes and motivations, and without any expectation
+of additional consideration or compensation, the person associating CC0 with a
+Work (the "Affirmer"), to the extent that he or she is an owner of Copyright
+and Related Rights in the Work, voluntarily elects to apply CC0 to the Work
+and publicly distribute the Work under its terms, with knowledge of his or her
+Copyright and Related Rights in the Work and the meaning and intended legal
+effect of CC0 on those rights.
+
+1. Copyright and Related Rights. A Work made available under CC0 may be
+protected by copyright and related or neighboring rights ("Copyright and
+Related Rights"). Copyright and Related Rights include, but are not limited
+to, the following:
+
+ i. the right to reproduce, adapt, distribute, perform, display, communicate,
+ and translate a Work;
+
+ ii. moral rights retained by the original author(s) and/or performer(s);
+
+ iii. publicity and privacy rights pertaining to a person's image or likeness
+ depicted in a Work;
+
+ iv. rights protecting against unfair competition in regards to a Work,
+ subject to the limitations in paragraph 4(a), below;
+
+ v. rights protecting the extraction, dissemination, use and reuse of data in
+ a Work;
+
+ vi. database rights (such as those arising under Directive 96/9/EC of the
+ European Parliament and of the Council of 11 March 1996 on the legal
+ protection of databases, and under any national implementation thereof,
+ including any amended or successor version of such directive); and
+
+ vii. other similar, equivalent or corresponding rights throughout the world
+ based on applicable law or treaty, and any national implementations thereof.
+
+2. Waiver. To the greatest extent permitted by, but not in contravention of,
+applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and
+unconditionally waives, abandons, and surrenders all of Affirmer's Copyright
+and Related Rights and associated claims and causes of action, whether now
+known or unknown (including existing as well as future claims and causes of
+action), in the Work (i) in all territories worldwide, (ii) for the maximum
+duration provided by applicable law or treaty (including future time
+extensions), (iii) in any current or future medium and for any number of
+copies, and (iv) for any purpose whatsoever, including without limitation
+commercial, advertising or promotional purposes (the "Waiver"). Affirmer makes
+the Waiver for the benefit of each member of the public at large and to the
+detriment of Affirmer's heirs and successors, fully intending that such Waiver
+shall not be subject to revocation, rescission, cancellation, termination, or
+any other legal or equitable action to disrupt the quiet enjoyment of the Work
+by the public as contemplated by Affirmer's express Statement of Purpose.
+
+3. Public License Fallback. Should any part of the Waiver for any reason be
+judged legally invalid or ineffective under applicable law, then the Waiver
+shall be preserved to the maximum extent permitted taking into account
+Affirmer's express Statement of Purpose. In addition, to the extent the Waiver
+is so judged Affirmer hereby grants to each affected person a royalty-free,
+non transferable, non sublicensable, non exclusive, irrevocable and
+unconditional license to exercise Affirmer's Copyright and Related Rights in
+the Work (i) in all territories worldwide, (ii) for the maximum duration
+provided by applicable law or treaty (including future time extensions), (iii)
+in any current or future medium and for any number of copies, and (iv) for any
+purpose whatsoever, including without limitation commercial, advertising or
+promotional purposes (the "License"). The License shall be deemed effective as
+of the date CC0 was applied by Affirmer to the Work. Should any part of the
+License for any reason be judged legally invalid or ineffective under
+applicable law, such partial invalidity or ineffectiveness shall not
+invalidate the remainder of the License, and in such case Affirmer hereby
+affirms that he or she will not (i) exercise any of his or her remaining
+Copyright and Related Rights in the Work or (ii) assert any associated claims
+and causes of action with respect to the Work, in either case contrary to
+Affirmer's express Statement of Purpose.
+
+4. Limitations and Disclaimers.
+
+ a. No trademark or patent rights held by Affirmer are waived, abandoned,
+ surrendered, licensed or otherwise affected by this document.
+
+ b. Affirmer offers the Work as-is and makes no representations or warranties
+ of any kind concerning the Work, express, implied, statutory or otherwise,
+ including without limitation warranties of title, merchantability, fitness
+ for a particular purpose, non infringement, or the absence of latent or
+ other defects, accuracy, or the present or absence of errors, whether or not
+ discoverable, all to the greatest extent permissible under applicable law.
+
+ c. Affirmer disclaims responsibility for clearing rights of other persons
+ that may apply to the Work or any use thereof, including without limitation
+ any person's Copyright and Related Rights in the Work. Further, Affirmer
+ disclaims responsibility for obtaining any necessary consents, permissions
+ or other rights required for any use of the Work.
+
+ d. Affirmer understands and acknowledges that Creative Commons is not a
+ party to this document and has no duty or obligation with respect to this
+ CC0 or use of the Work.
+
+For more information, please see
+
diff --git a/MANIFEST.in b/MANIFEST.in
index 3d6b5be1..0ab0d3ed 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,5 +1,26 @@
-include README.md LICENSE
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+include README.md LICENSE NOTICE DISCLAIMER CMakeLists.txt .gitignore
+recursive-include cmake *.cmake *.in
+graft licenses
graft include
graft casbin
-graft pycasbin/
-global-include CMakeLists.txt *.cmake
+graft pycasbin
+graft tests
+graft examples
+global-exclude __pycache__ *.py[cod] *.pyd *.so *.o *.obj
diff --git a/NOTICE b/NOTICE
new file mode 100644
index 00000000..65de9302
--- /dev/null
+++ b/NOTICE
@@ -0,0 +1,12 @@
+Apache Casbin (Incubating) - C++
+Copyright 2026 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (https://www.apache.org/).
+
+Historical notices from contributed Casbin source files:
+Copyright 2020 The casbin Authors. All Rights Reserved.
+Copyright 2021 The casbin Authors. All Rights Reserved.
+Copyright 2022 The casbin Authors. All Rights Reserved.
+Copyright 2023 The casbin Authors. All Rights Reserved.
+Copyright 2026 The casbin Authors. All Rights Reserved.
diff --git a/README.md b/README.md
index 34c78a61..5ee6a680 100644
--- a/README.md
+++ b/README.md
@@ -1,8 +1,36 @@
-Casbin-CPP
-====
-
-[](https://github.com/casbin/casbin-cpp/actions/workflows/ci.yml)
-[](https://github.com/casbin/casbin-cpp/releases/latest)
+
+
+# Apache Casbin (Incubating) - C++
+
+Apache Casbin is an effort undergoing incubation at The Apache Software
+Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of
+all newly accepted projects until a further review indicates that the
+infrastructure, communications, and decision making process have stabilized
+in a manner consistent with other successful ASF projects. While incubation
+status is not necessarily a reflection of the completeness or stability of
+the code, it does indicate that the project has yet to be fully endorsed by
+the ASF.
+
+
+[](https://github.com/apache/casbin-cpp/actions/workflows/ci.yml)
+[](https://github.com/apache/casbin-cpp/releases/latest)
[](https://discord.gg/S5UjpzGZjN)
**News**: Are you still worried about how to write the correct Casbin policy? ``Casbin online editor`` is coming to help! Try it at: http://casbin.org/editor/
@@ -27,12 +55,12 @@ macOS | :heavy_check_mark: Available
[Casbin](https://github.com/casbin/casbin) | [jCasbin](https://github.com/casbin/jcasbin) | [node-Casbin](https://github.com/casbin/node-casbin) | [PHP-Casbin](https://github.com/php-casbin/php-casbin)
production-ready | production-ready | production-ready | production-ready
-[](https://github.com/casbin/pycasbin) | [](https://github.com/casbin-net/Casbin.NET) | [](https://github.com/casbin/casbin-cpp) | [](https://github.com/casbin/casbin-rs)
+[](https://github.com/casbin/pycasbin) | [](https://github.com/casbin-net/Casbin.NET) | [](https://github.com/apache/casbin-cpp) | [](https://github.com/casbin/casbin-rs)
----|----|----|----
-[PyCasbin](https://github.com/casbin/pycasbin) | [Casbin.NET](https://github.com/casbin-net/Casbin.NET) | [Casbin-CPP](https://github.com/casbin/casbin-cpp) | [Casbin-RS](https://github.com/casbin/casbin-rs)
+[PyCasbin](https://github.com/casbin/pycasbin) | [Casbin.NET](https://github.com/casbin-net/Casbin.NET) | [Casbin-CPP](https://github.com/apache/casbin-cpp) | [Casbin-RS](https://github.com/casbin/casbin-rs)
production-ready | production-ready | beta-test | production-ready
-**Note**: PyCasbin-on-CPP is available to use. Refer to the [documentation](./bindings/README.md) for installation and usage.
+**Note**: PyCasbin-on-CPP is available to use. Refer to the [documentation](./pycasbin/README.md) for installation and usage.
## Supported models
@@ -129,8 +157,8 @@ include(FetchContent)
FetchContent_Declare(
casbin
- GIT_REPOSITORY https://github.com/casbin/casbin-cpp.git
- GIT_TAG v1.38.1
+ GIT_REPOSITORY https://github.com/apache/casbin-cpp.git
+ GIT_TAG v1.68.0 # Use only after the approved release is available
)
set(CASBIN_BUILD_TEST OFF) # If you don't need to build tests for casbin
@@ -169,7 +197,7 @@ You may integrate casbin into your CMake project through `find_package`.
1. Clone/checkout to [`casbin/casbin-cpp:master`](https://github.com/EmperorYP7/casbin-cpp/tree/ctest-setup)
```bash
- git clone https://github.com/casbin/casbin-cpp.git
+ git clone https://github.com/apache/casbin-cpp.git
```
2. Open terminal/cmd in the root directory of the project:
@@ -217,7 +245,7 @@ You may integrate casbin into your CMake project through `find_package`.
1. Clone/checkout to [`casbin/casbin-cpp:master`](https://github.com/EmperorYP7/casbin-cpp/tree/ctest-setup)
```bash
- git clone https://github.com/casbin/casbin-cpp.git
+ git clone https://github.com/apache/casbin-cpp.git
```
2. Open terminal/cmd in the root directory of the project:
@@ -366,7 +394,7 @@ Please read the [contributing guide](CONTRIBUTING.md).
## Contributors
This project exists thanks to all the people who contribute.
-
+
## Star History
@@ -379,5 +407,24 @@ This project is licensed under the [Apache 2.0 license](LICENSE).
## Contact
If you have any issues or feature requests, please contact us. PR is welcomed.
-- https://github.com/casbin/casbin-cpp/issues
+- https://github.com/apache/casbin-cpp/issues
- https://discord.gg/S5UjpzGZjN
+
+
+## Releases and verification
+
+This preparation targets 1.68.0. Source candidates and formal releases have
+independent review and approval stages; see [RELEASING.md](RELEASING.md).
+Obtain approved source distributions from the
+[Apache download area](https://downloads.apache.org/incubator/casbin/), and
+verify them using the project's KEYS and the
+[Apache verification instructions](https://www.apache.org/info/verification.html).
+GitHub tags or a successful CI run do not establish release approval.
+Historical GitHub versions are not evidence of an approved Apache release.
+
+The public CMake package/target `casbin` / `casbin::casbin`, C++ namespace
+`casbin`, and the vcpkg port name `casbin` remain compatible. The optional
+`pycasbin` module is a local binding, with no PyPI publication workflow here.
+Policy models, matcher expressions and custom regular expressions are trusted
+configuration; applications must validate request data and handle exceptions
+for malformed inputs at their boundary.
diff --git a/RELEASING.md b/RELEASING.md
new file mode 100644
index 00000000..298adeaf
--- /dev/null
+++ b/RELEASING.md
@@ -0,0 +1,95 @@
+
+
+# Releasing Apache Casbin (Incubating) C++
+
+The current preparation targets 1.68.0. Keep CMake, the optional local Python
+binding and the release tag at the same version. Source archives are named
+`apache-casbin-cpp-X.Y.Z-incubating-src.tar.gz`; installed CMake consumers keep
+using `find_package(casbin)` and `casbin::casbin`.
+
+## Prepare and review
+
+Complete the source, dependency, licensing, packaging and workflow review in
+one preparation change. Build and test a clean extraction, install it into a
+temporary prefix and test a separate C++17 consumer. Test the optional local
+Python binding independently. See LICENSE for the exact third-party scopes;
+downloaded CMake dependencies are not vendored in the source distribution.
+
+The source includes local binding build metadata named `pycasbin`; the module
+is also imported as `pycasbin`. This is distinct from the pure Python Casbin
+implementation. No PyPI upload is configured here. The binding wheel must
+include LICENSE, NOTICE and DISCLAIMER and must derive from reviewed source.
+
+## Candidate
+
+After review and merge, verify the exact commit and CI before the release
+manager creates `vX.Y.Z-rcN` (N starts at 1). The release workflow exports that
+commit without version stamping, adds SHA-512 and creates a GitHub prerelease
+with `latest=false` and the incubation disclaimer. This is an unsigned
+candidate, not a formal release. It never publishes a package registry or
+opens a vcpkg PR.
+
+The release manager reviews these exact archives, signs them, verifies the
+signatures with the published project KEYS, and stages the originals in the
+Apache development distribution area. Supply all source archive, signature,
+checksum, commit/tag, KEYS and verification links for review. Candidate and
+formal source filenames include `incubating`.
+
+## Votes and formal publication
+
+Seek public project/PPMC endorsement and Incubator PMC approval for these
+exact source bytes. They can be coordinated with other Casbin components,
+but candidate scope, votes and results stay explicit for each component and
+voting body. See the current
+[Incubation Policy](https://incubator.apache.org/policy/incubation.html#releases)
+and [ASF release policy](https://www.apache.org/legal/release-policy.html).
+Changed source requires a new candidate and fresh applicable votes.
+
+Once approved and publication is authorized, promote the reviewed ASF
+originals, including their existing signatures and checksums, into
+`https://downloads.apache.org/incubator/casbin/cpp-X.Y.Z-incubating/`.
+Do not rebuild or replace the approved archives. Create the final tag pointing
+at the approved candidate commit; a final tag push does not publish anything.
+
+The optional final GitHub publication is a manual workflow dispatch from
+master, with the existing final tag and the public project and IPMC result
+URLs. It downloads the approved ASF source and sidecars, validates SHA-512,
+verifies the signature in an isolated keyring populated from the project KEYS,
+and compares every file's content and mode with the tag before attaching the
+original files. URL validation is not a substitute for a human checking vote
+scope, voter qualification or approval. The workflow refuses existing GitHub
+releases and nonempty output directories; it does not overwrite assets.
+
+Check partial publication before any retry. A successful upload in one channel
+does not establish completion of another. No signing private keys enter CI.
+
+## vcpkg
+
+The existing compatible port identity is `casbin`. After the source release,
+render `.github/vcpkg/casbin/portfile.cmake` and `vcpkg.json` with the approved
+version and the SHA-512 of the ASF original. The port downloads that original,
+builds with external nlohmann-json and installs the matching legal files.
+Validate the port, its installed consumer and version database against the
+current vcpkg tooling before opening a separate registry PR. There is no
+automatic registry PR or force-push in this release workflow.
+
+Publish the final download links and announcement only after their respective
+checks and authorizations. Inspect the incubation display on GitHub and the
+registry separately; local README changes do not update historical releases.
diff --git a/THIRD_PARTY.md b/THIRD_PARTY.md
new file mode 100644
index 00000000..bf62b3c4
--- /dev/null
+++ b/THIRD_PARTY.md
@@ -0,0 +1,48 @@
+
+
+# Third-party source and build inputs
+
+The complete license texts and their exact file scopes are in LICENSE.
+This inventory distinguishes bundled source from dependencies obtained during
+a build; a dependency's build directory is not part of the source release.
+
+| Material | Source scope | Treatment |
+| --- | --- | --- |
+| ExprTk, Arash Partow | include/casbin/exprtk/exprtk.hpp | Retain the original MIT header and add its complete grant in LICENSE. The checked-in file is the project's historical copy introduced with its 0.0.3 update, not asserted to be byte-identical to today's upstream tag. |
+| Go net IP parsing adaptations | casbin/ip_parser/ and include/casbin/ip_parser/ | Preserve/restore the Go copyright and BSD terms for the derived portions; Casbin-specific contributions retain their own Apache terms. Compare the historical introduction with Go net/ip.go and net/parse.go when reviewing provenance. |
+| pybind/cmake_example build helper | setup.py | Retain its BSD attribution and terms in LICENSE; Casbin package metadata changes are separate contributions. |
+| github/gitignore VisualStudio template | .gitignore | CC0 1.0; preserve the template's origin link and include CC0 in LICENSE. |
+| Casbin logo and policy/test fixtures | assets/images/ and examples/ | Project assets and contributed fixtures; not third-party dependencies. |
+
+The default downloaded build inputs are pinned to these commits:
+
+| Dependency | Version | Commit | Purpose / declared license |
+| --- | --- | --- | --- |
+| nlohmann/json | 3.12.0 | 55f93686c01528224f448c19128836e7df245f72 | Public header dependency / MIT; installed system packages >=3.10.1 remain supported |
+| googletest | 1.18.0 | 063de7e9578f82b369302001269680b4b1553359 | Tests only / BSD-3-Clause |
+| google/benchmark | 1.10.0 | a6b4a9f00b36c19af9997d68a1cf6e0b5b3d032c | Optional benchmarks / Apache-2.0; inspect its own NOTICE for separate binary distribution |
+| pybind11 | 3.1.0 | 97bf890db679505a14dfe547a5e77bb2bd05dc90 | Optional local Python binding / BSD-3-Clause |
+
+An installed static library and the optional Python extension contain compiled
+Casbin and ExprTk/IP parsing code; distribute the matching LICENSE, NOTICE and
+DISCLAIMER with them. If packaging additional third-party binaries, account
+for those actual contents independently.
+
+License texts under `licenses/` accompany local convenience builds that compile nlohmann/json and pybind11; their implementations are fetched separately and are not bundled in this source release. Installed C++ legal material includes the compiled JSON dependency and omits source-only build-helper/template terms.
diff --git a/casbin/.clang-format b/casbin/.clang-format
index df0c5b87..f7774949 100644
--- a/casbin/.clang-format
+++ b/casbin/.clang-format
@@ -1,3 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
BasedOnStyle: Google
PointerAlignment: Right
AccessModifierOffset: -4
diff --git a/casbin/CMakeLists.txt b/casbin/CMakeLists.txt
index 55fe2f9b..7f24705c 100644
--- a/casbin/CMakeLists.txt
+++ b/casbin/CMakeLists.txt
@@ -1,16 +1,19 @@
-# Copyright 2021 The casbin Authors. All Rights Reserved.
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# https://www.apache.org/licenses/LICENSE-2.0
#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
set(CASBIN_SOURCE_FILES
enforcer.cpp
@@ -88,7 +91,9 @@ target_include_directories(casbin
$
$
)
-target_link_libraries(casbin PUBLIC nlohmann_json::nlohmann_json)
+find_package(Threads REQUIRED)
+target_compile_features(casbin PUBLIC cxx_std_17)
+target_link_libraries(casbin PUBLIC nlohmann_json::nlohmann_json Threads::Threads)
# Keep the platform default naming (libcasbin.a / casbin.lib) so that the
# installed library looks like every other system library and can be picked up
diff --git a/casbin/config/config.cpp b/casbin/config/config.cpp
index 7c4b9495..3d72b719 100644
--- a/casbin/config/config.cpp
+++ b/casbin/config/config.cpp
@@ -1,17 +1,20 @@
/*
- * Copyright 2020 The casbin Authors. All Rights Reserved.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#include "casbin/pch.h"
diff --git a/casbin/config/testdata/testini.ini b/casbin/config/testdata/testini.ini
index df6ff65f..fea424a9 100644
--- a/casbin/config/testdata/testini.ini
+++ b/casbin/config/testdata/testini.ini
@@ -1,3 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
# test config
debug = true
url = act.wiki
diff --git a/casbin/effect/default_effector.cpp b/casbin/effect/default_effector.cpp
index 78bd5681..cd6f18fd 100644
--- a/casbin/effect/default_effector.cpp
+++ b/casbin/effect/default_effector.cpp
@@ -1,17 +1,20 @@
/*
- * Copyright 2020 The casbin Authors. All Rights Reserved.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#include "casbin/pch.h"
diff --git a/casbin/enforcer.cpp b/casbin/enforcer.cpp
index d7447e5f..2dfb46a9 100644
--- a/casbin/enforcer.cpp
+++ b/casbin/enforcer.cpp
@@ -1,17 +1,20 @@
/*
- * Copyright 2020 The casbin Authors. All Rights Reserved.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#include "casbin/pch.h"
diff --git a/casbin/enforcer_cached.cpp b/casbin/enforcer_cached.cpp
index d67b79a8..42b86302 100644
--- a/casbin/enforcer_cached.cpp
+++ b/casbin/enforcer_cached.cpp
@@ -1,17 +1,20 @@
/*
- * Copyright 2020 The casbin Authors. All Rights Reserved.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#include "casbin/pch.h"
diff --git a/casbin/enforcer_synced.cpp b/casbin/enforcer_synced.cpp
index cf8c1c7d..ed5d7e77 100644
--- a/casbin/enforcer_synced.cpp
+++ b/casbin/enforcer_synced.cpp
@@ -1,17 +1,20 @@
/*
- * Copyright 2020 The casbin Authors. All Rights Reserved.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#include "casbin/pch.h"
@@ -122,7 +125,8 @@ bool SyncedEnforcer ::IsAutoLoadingRunning() {
// StopAutoLoadPolicy causes the thread to exit
void SyncedEnforcer ::StopAutoLoadPolicy() {
- ticker->stop();
+ if (ticker)
+ ticker->stop();
autoLoadRunning = false;
}
@@ -590,4 +594,4 @@ bool SyncedEnforcer::SyncedEnforceWithMatcher(const std::string& matcher, const
} // namespace casbin
-#endif // ENFORCER_SYNCED_CPP
\ No newline at end of file
+#endif // ENFORCER_SYNCED_CPP
diff --git a/casbin/internal_api.cpp b/casbin/internal_api.cpp
index 164f6f52..7235e85e 100644
--- a/casbin/internal_api.cpp
+++ b/casbin/internal_api.cpp
@@ -1,17 +1,20 @@
/*
- * Copyright 2020 The casbin Authors. All Rights Reserved.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#include "casbin/pch.h"
diff --git a/casbin/ip_parser/exception/parser_exception.cpp b/casbin/ip_parser/exception/parser_exception.cpp
index 4a1b3131..6dfd86a4 100644
--- a/casbin/ip_parser/exception/parser_exception.cpp
+++ b/casbin/ip_parser/exception/parser_exception.cpp
@@ -1,3 +1,36 @@
+/*
+ * Copyright (c) 2009 The Go Authors. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Go-derived portions retain the BSD terms above.
+ * Casbin-specific contributions are under Apache-2.0; see LICENSE.
+ */
+
#include "casbin/pch.h"
#ifndef PARSER_EXCEPTION_CPP
diff --git a/casbin/ip_parser/parser/CIDRMask.cpp b/casbin/ip_parser/parser/CIDRMask.cpp
index 414028bc..5c551080 100644
--- a/casbin/ip_parser/parser/CIDRMask.cpp
+++ b/casbin/ip_parser/parser/CIDRMask.cpp
@@ -1,3 +1,36 @@
+/*
+ * Copyright (c) 2009 The Go Authors. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Go-derived portions retain the BSD terms above.
+ * Casbin-specific contributions are under Apache-2.0; see LICENSE.
+ */
+
#include "casbin/pch.h"
#ifndef CIDRMASK_CPP
diff --git a/casbin/ip_parser/parser/IP.cpp b/casbin/ip_parser/parser/IP.cpp
index eff98a1e..a4b550f4 100644
--- a/casbin/ip_parser/parser/IP.cpp
+++ b/casbin/ip_parser/parser/IP.cpp
@@ -1,3 +1,36 @@
+/*
+ * Copyright (c) 2009 The Go Authors. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Go-derived portions retain the BSD terms above.
+ * Casbin-specific contributions are under Apache-2.0; see LICENSE.
+ */
+
#include "casbin/pch.h"
#ifndef IP_CPP
diff --git a/casbin/ip_parser/parser/IPNet.cpp b/casbin/ip_parser/parser/IPNet.cpp
index f2cca08c..a29345d8 100644
--- a/casbin/ip_parser/parser/IPNet.cpp
+++ b/casbin/ip_parser/parser/IPNet.cpp
@@ -1,3 +1,36 @@
+/*
+ * Copyright (c) 2009 The Go Authors. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Go-derived portions retain the BSD terms above.
+ * Casbin-specific contributions are under Apache-2.0; see LICENSE.
+ */
+
#include "casbin/pch.h"
#ifndef IPNET_CPP
diff --git a/casbin/ip_parser/parser/IPv4.cpp b/casbin/ip_parser/parser/IPv4.cpp
index ac62e628..b0eb54ae 100644
--- a/casbin/ip_parser/parser/IPv4.cpp
+++ b/casbin/ip_parser/parser/IPv4.cpp
@@ -1,3 +1,36 @@
+/*
+ * Copyright (c) 2009 The Go Authors. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Go-derived portions retain the BSD terms above.
+ * Casbin-specific contributions are under Apache-2.0; see LICENSE.
+ */
+
#include "casbin/pch.h"
#ifndef IPV4_CPP
diff --git a/casbin/ip_parser/parser/Print.cpp b/casbin/ip_parser/parser/Print.cpp
index 47ba136b..a5da51d1 100644
--- a/casbin/ip_parser/parser/Print.cpp
+++ b/casbin/ip_parser/parser/Print.cpp
@@ -1,3 +1,36 @@
+/*
+ * Copyright (c) 2009 The Go Authors. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Go-derived portions retain the BSD terms above.
+ * Casbin-specific contributions are under Apache-2.0; see LICENSE.
+ */
+
#include "casbin/pch.h"
#ifndef PRINT_CPP
diff --git a/casbin/ip_parser/parser/allFF.cpp b/casbin/ip_parser/parser/allFF.cpp
index 33e8d020..1e3394d2 100644
--- a/casbin/ip_parser/parser/allFF.cpp
+++ b/casbin/ip_parser/parser/allFF.cpp
@@ -1,3 +1,36 @@
+/*
+ * Copyright (c) 2009 The Go Authors. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Go-derived portions retain the BSD terms above.
+ * Casbin-specific contributions are under Apache-2.0; see LICENSE.
+ */
+
#include "casbin/pch.h"
#ifndef ALLFF_CPP
diff --git a/casbin/ip_parser/parser/dtoi.cpp b/casbin/ip_parser/parser/dtoi.cpp
index 93ded3ce..eaf7b26b 100644
--- a/casbin/ip_parser/parser/dtoi.cpp
+++ b/casbin/ip_parser/parser/dtoi.cpp
@@ -1,3 +1,36 @@
+/*
+ * Copyright (c) 2009 The Go Authors. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Go-derived portions retain the BSD terms above.
+ * Casbin-specific contributions are under Apache-2.0; see LICENSE.
+ */
+
#include "casbin/pch.h"
#ifndef DTOI_CPP
diff --git a/casbin/ip_parser/parser/equal.cpp b/casbin/ip_parser/parser/equal.cpp
index 8f6a4f80..7fa3aba4 100644
--- a/casbin/ip_parser/parser/equal.cpp
+++ b/casbin/ip_parser/parser/equal.cpp
@@ -1,3 +1,36 @@
+/*
+ * Copyright (c) 2009 The Go Authors. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Go-derived portions retain the BSD terms above.
+ * Casbin-specific contributions are under Apache-2.0; see LICENSE.
+ */
+
#include "casbin/pch.h"
#ifndef EQUAL_CPP
diff --git a/casbin/ip_parser/parser/parseCIDR.cpp b/casbin/ip_parser/parser/parseCIDR.cpp
index 1cff14c1..4248c78b 100644
--- a/casbin/ip_parser/parser/parseCIDR.cpp
+++ b/casbin/ip_parser/parser/parseCIDR.cpp
@@ -1,3 +1,36 @@
+/*
+ * Copyright (c) 2009 The Go Authors. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Go-derived portions retain the BSD terms above.
+ * Casbin-specific contributions are under Apache-2.0; see LICENSE.
+ */
+
#include "casbin/pch.h"
#ifndef PARSECIDR_CPP
diff --git a/casbin/ip_parser/parser/parseIP.cpp b/casbin/ip_parser/parser/parseIP.cpp
index 97130e6e..5d3fb9f6 100644
--- a/casbin/ip_parser/parser/parseIP.cpp
+++ b/casbin/ip_parser/parser/parseIP.cpp
@@ -1,3 +1,36 @@
+/*
+ * Copyright (c) 2009 The Go Authors. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Go-derived portions retain the BSD terms above.
+ * Casbin-specific contributions are under Apache-2.0; see LICENSE.
+ */
+
#include "casbin/pch.h"
#ifndef PARSEIP_CPP
diff --git a/casbin/ip_parser/parser/parseIPv4.cpp b/casbin/ip_parser/parser/parseIPv4.cpp
index 298f4da9..d6ad96ac 100644
--- a/casbin/ip_parser/parser/parseIPv4.cpp
+++ b/casbin/ip_parser/parser/parseIPv4.cpp
@@ -1,3 +1,36 @@
+/*
+ * Copyright (c) 2009 The Go Authors. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Go-derived portions retain the BSD terms above.
+ * Casbin-specific contributions are under Apache-2.0; see LICENSE.
+ */
+
#include "casbin/pch.h"
#ifndef PARSEIPV4_CPP
diff --git a/casbin/ip_parser/parser/parseIPv6.cpp b/casbin/ip_parser/parser/parseIPv6.cpp
index 00943924..e46a16b6 100644
--- a/casbin/ip_parser/parser/parseIPv6.cpp
+++ b/casbin/ip_parser/parser/parseIPv6.cpp
@@ -1,3 +1,36 @@
+/*
+ * Copyright (c) 2009 The Go Authors. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Go-derived portions retain the BSD terms above.
+ * Casbin-specific contributions are under Apache-2.0; see LICENSE.
+ */
+
#include "casbin/pch.h"
#ifndef PARSEIPV6_CPP
diff --git a/casbin/ip_parser/parser/xtoi.cpp b/casbin/ip_parser/parser/xtoi.cpp
index a2605beb..48520f7c 100644
--- a/casbin/ip_parser/parser/xtoi.cpp
+++ b/casbin/ip_parser/parser/xtoi.cpp
@@ -1,3 +1,36 @@
+/*
+ * Copyright (c) 2009 The Go Authors. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Go-derived portions retain the BSD terms above.
+ * Casbin-specific contributions are under Apache-2.0; see LICENSE.
+ */
+
#include "casbin/pch.h"
#ifndef XTOI_CPP
diff --git a/casbin/logger.cpp b/casbin/logger.cpp
index b5b56d63..cce6200b 100644
--- a/casbin/logger.cpp
+++ b/casbin/logger.cpp
@@ -1,3 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
#include "casbin/pch.h"
#ifndef LOGGER_CPP
diff --git a/casbin/management_api.cpp b/casbin/management_api.cpp
index 927280f8..5f3c7bd5 100644
--- a/casbin/management_api.cpp
+++ b/casbin/management_api.cpp
@@ -1,17 +1,20 @@
/*
- * Copyright 2020 The casbin Authors. All Rights Reserved.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#include "casbin/pch.h"
diff --git a/casbin/model/assertion.cpp b/casbin/model/assertion.cpp
index 8f914ca0..4df1ffd5 100644
--- a/casbin/model/assertion.cpp
+++ b/casbin/model/assertion.cpp
@@ -1,17 +1,20 @@
/*
- * Copyright 2020 The casbin Authors. All Rights Reserved.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#include "casbin/pch.h"
diff --git a/casbin/model/evaluator.cpp b/casbin/model/evaluator.cpp
index 69dbe2dc..76b2ab96 100644
--- a/casbin/model/evaluator.cpp
+++ b/casbin/model/evaluator.cpp
@@ -1,18 +1,22 @@
/*
- * Copyright 2022 The casbin Authors. All Rights Reserved.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
+
#include "casbin/model/evaluator.h"
#include
diff --git a/casbin/model/function.cpp b/casbin/model/function.cpp
index 758cad5e..74ee6be5 100644
--- a/casbin/model/function.cpp
+++ b/casbin/model/function.cpp
@@ -1,17 +1,20 @@
/*
- * Copyright 2020 The casbin Authors. All Rights Reserved.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#include "casbin/pch.h"
diff --git a/casbin/model/model.cpp b/casbin/model/model.cpp
index 609d3166..dc831a67 100644
--- a/casbin/model/model.cpp
+++ b/casbin/model/model.cpp
@@ -1,17 +1,20 @@
/*
- * Copyright 2020 The casbin Authors. All Rights Reserved.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#include "casbin/pch.h"
diff --git a/casbin/model/policy_collection.cpp b/casbin/model/policy_collection.cpp
index 54c12363..d141af50 100644
--- a/casbin/model/policy_collection.cpp
+++ b/casbin/model/policy_collection.cpp
@@ -1,17 +1,20 @@
/*
- * Copyright 2020 The casbin Authors. All Rights Reserved.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#include "casbin/model/policy_collection.hpp"
diff --git a/casbin/pch.cpp b/casbin/pch.cpp
index 8d08d161..9cf3a2cc 100644
--- a/casbin/pch.cpp
+++ b/casbin/pch.cpp
@@ -1,21 +1,24 @@
-/*
- * Copyright 2020 The casbin Authors. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// casbin/pch.h.cpp: source file corresponding to the pre-compiled header
-
-#include "casbin/pch.h"
-
-// When you are using pre-compiled headers, this source file is necessary for compilation to succeed.
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+// casbin/pch.h.cpp: source file corresponding to the pre-compiled header
+
+#include "casbin/pch.h"
+
+// When you are using pre-compiled headers, this source file is necessary for compilation to succeed.
diff --git a/casbin/persist/adapter.cpp b/casbin/persist/adapter.cpp
index 4b0c9b2e..29a3752d 100644
--- a/casbin/persist/adapter.cpp
+++ b/casbin/persist/adapter.cpp
@@ -1,17 +1,20 @@
/*
- * Copyright 2020 The casbin Authors. All Rights Reserved.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#include "casbin/pch.h"
diff --git a/casbin/persist/adapter.h b/casbin/persist/adapter.h
index 9e7ec039..1457eace 100644
--- a/casbin/persist/adapter.h
+++ b/casbin/persist/adapter.h
@@ -1,17 +1,20 @@
/*
- * Copyright 2020 The casbin Authors. All Rights Reserved.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#ifndef CASBIN_CPP_PERSIST_ADAPTER
diff --git a/casbin/persist/batch_adapter.h b/casbin/persist/batch_adapter.h
index 96ca53ff..cb5ff15b 100644
--- a/casbin/persist/batch_adapter.h
+++ b/casbin/persist/batch_adapter.h
@@ -1,17 +1,20 @@
/*
- * Copyright 2020 The casbin Authors. All Rights Reserved.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#ifndef CASBIN_CPP_PERSIST_BATCH_ADAPTER
diff --git a/casbin/persist/default_watcher.cpp b/casbin/persist/default_watcher.cpp
index 1effb5c7..38608b8e 100644
--- a/casbin/persist/default_watcher.cpp
+++ b/casbin/persist/default_watcher.cpp
@@ -1,17 +1,20 @@
/*
- * Copyright 2020 The casbin Authors. All Rights Reserved.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#include "casbin/pch.h"
diff --git a/casbin/persist/default_watcher.h b/casbin/persist/default_watcher.h
index b2c8c9b0..1aa36015 100644
--- a/casbin/persist/default_watcher.h
+++ b/casbin/persist/default_watcher.h
@@ -1,17 +1,20 @@
/*
- * Copyright 2020 The casbin Authors. All Rights Reserved.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#ifndef CASBIN_CPP_PERSIST_DEFAULT_WATCHER
diff --git a/casbin/persist/default_watcher_ex.cpp b/casbin/persist/default_watcher_ex.cpp
index a6d73ee1..fd6ad062 100644
--- a/casbin/persist/default_watcher_ex.cpp
+++ b/casbin/persist/default_watcher_ex.cpp
@@ -1,17 +1,20 @@
/*
- * Copyright 2020 The casbin Authors. All Rights Reserved.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#include "casbin/pch.h"
diff --git a/casbin/persist/default_watcher_ex.h b/casbin/persist/default_watcher_ex.h
index a1a54378..77a51bd4 100644
--- a/casbin/persist/default_watcher_ex.h
+++ b/casbin/persist/default_watcher_ex.h
@@ -1,17 +1,20 @@
/*
- * Copyright 2020 The casbin Authors. All Rights Reserved.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#ifndef CASBIN_CPP_PERSIST_DEFAULT_WATCHER_EX
diff --git a/casbin/persist/file_adapter/batch_file_adapter.cpp b/casbin/persist/file_adapter/batch_file_adapter.cpp
index 3b5f9ba8..873e04a2 100644
--- a/casbin/persist/file_adapter/batch_file_adapter.cpp
+++ b/casbin/persist/file_adapter/batch_file_adapter.cpp
@@ -1,3 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
#include "casbin/pch.h"
#ifndef BATCH_FILE_ADAPTER_CPP
diff --git a/casbin/persist/file_adapter/batch_file_adapter.h b/casbin/persist/file_adapter/batch_file_adapter.h
index 5197b6f1..65a8bdd1 100644
--- a/casbin/persist/file_adapter/batch_file_adapter.h
+++ b/casbin/persist/file_adapter/batch_file_adapter.h
@@ -1,3 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
#ifndef CASBIN_CPP_PERSIST_FILE_ADAPTER_BATCH_FILE_ADAPTER
#define CASBIN_CPP_PERSIST_FILE_ADAPTER_BATCH_FILE_ADAPTER
diff --git a/casbin/persist/file_adapter/file_adapter.cpp b/casbin/persist/file_adapter/file_adapter.cpp
index 944077c8..b8813975 100644
--- a/casbin/persist/file_adapter/file_adapter.cpp
+++ b/casbin/persist/file_adapter/file_adapter.cpp
@@ -1,3 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
#include "casbin/pch.h"
#ifndef FILE_ADAPTER_CPP
diff --git a/casbin/persist/file_adapter/file_adapter.h b/casbin/persist/file_adapter/file_adapter.h
index 04e27006..c2f0c27c 100644
--- a/casbin/persist/file_adapter/file_adapter.h
+++ b/casbin/persist/file_adapter/file_adapter.h
@@ -1,3 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
#ifndef CASBIN_CPP_PERSIST_FILE_ADAPTER_FILE_ADAPTER
#define CASBIN_CPP_PERSIST_FILE_ADAPTER_FILE_ADAPTER
diff --git a/casbin/persist/file_adapter/filtered_file_adapter.cpp b/casbin/persist/file_adapter/filtered_file_adapter.cpp
index 011cf805..07c286c8 100644
--- a/casbin/persist/file_adapter/filtered_file_adapter.cpp
+++ b/casbin/persist/file_adapter/filtered_file_adapter.cpp
@@ -1,3 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
#include "casbin/pch.h"
#ifndef FILTERED_FILE_ADAPTER_CPP
diff --git a/casbin/persist/file_adapter/filtered_file_adapter.h b/casbin/persist/file_adapter/filtered_file_adapter.h
index 29e5cb92..d46d9d79 100644
--- a/casbin/persist/file_adapter/filtered_file_adapter.h
+++ b/casbin/persist/file_adapter/filtered_file_adapter.h
@@ -1,3 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
#ifndef CASBIN_CPP_PERSIST_FILE_ADAPTER_FILTERED_ADAPTER
#define CASBIN_CPP_PERSIST_FILE_ADAPTER_FILTERED_ADAPTER
diff --git a/casbin/persist/filtered_adapter.h b/casbin/persist/filtered_adapter.h
index 01c1df02..6e327165 100644
--- a/casbin/persist/filtered_adapter.h
+++ b/casbin/persist/filtered_adapter.h
@@ -1,17 +1,20 @@
/*
- * Copyright 2020 The casbin Authors. All Rights Reserved.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#ifndef CASBIN_CPP_PERSIST_ADAPTER_FILTERED
diff --git a/casbin/persist/persist.h b/casbin/persist/persist.h
index 9eddd22c..63041639 100644
--- a/casbin/persist/persist.h
+++ b/casbin/persist/persist.h
@@ -1,17 +1,20 @@
/*
- * Copyright 2020 The casbin Authors. All Rights Reserved.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#ifndef CASBIN_CPP_PERSIST
diff --git a/casbin/persist/string_adapter.cpp b/casbin/persist/string_adapter.cpp
index fd7710fb..51b203e0 100644
--- a/casbin/persist/string_adapter.cpp
+++ b/casbin/persist/string_adapter.cpp
@@ -1,3 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
#include "casbin/pch.h"
#ifndef STRING_ADAPTER_CPP
diff --git a/casbin/persist/string_adapter.h b/casbin/persist/string_adapter.h
index 2b933502..4faad71e 100644
--- a/casbin/persist/string_adapter.h
+++ b/casbin/persist/string_adapter.h
@@ -1,3 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
#ifndef CASBIN_CPP_PERSIST_STRING_ADAPTER_STRING_ADAPTER
#define CASBIN_CPP_PERSIST_STRING_ADAPTER_STRING_ADAPTER
diff --git a/casbin/persist/watcher.h b/casbin/persist/watcher.h
index d59a344a..82dd572a 100644
--- a/casbin/persist/watcher.h
+++ b/casbin/persist/watcher.h
@@ -1,17 +1,20 @@
/*
- * Copyright 2020 The casbin Authors. All Rights Reserved.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#ifndef CASBIN_CPP_PERSIST_WATCHER
diff --git a/casbin/persist/watcher_ex.h b/casbin/persist/watcher_ex.h
index dd72af2a..7028aba7 100644
--- a/casbin/persist/watcher_ex.h
+++ b/casbin/persist/watcher_ex.h
@@ -1,17 +1,20 @@
/*
- * Copyright 2020 The casbin Authors. All Rights Reserved.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#ifndef CASBIN_CPP_PERSIST_WATCHER_EX
diff --git a/casbin/persist/watcher_update.h b/casbin/persist/watcher_update.h
index 327241e7..a7c06ea6 100644
--- a/casbin/persist/watcher_update.h
+++ b/casbin/persist/watcher_update.h
@@ -1,17 +1,20 @@
/*
- * Copyright 2020 The casbin Authors. All Rights Reserved.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#ifndef WATCHER_UPDATE_H
diff --git a/casbin/rbac/default_role_manager.cpp b/casbin/rbac/default_role_manager.cpp
index 6d3ca78a..32947fd7 100644
--- a/casbin/rbac/default_role_manager.cpp
+++ b/casbin/rbac/default_role_manager.cpp
@@ -1,17 +1,20 @@
/*
- * Copyright 2020 The casbin Authors. All Rights Reserved.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#ifndef DEFAULT_ROLE_MANAGER_CPP
diff --git a/casbin/rbac_api.cpp b/casbin/rbac_api.cpp
index d4c17d11..10bb9c71 100644
--- a/casbin/rbac_api.cpp
+++ b/casbin/rbac_api.cpp
@@ -1,17 +1,20 @@
/*
- * Copyright 2020 The casbin Authors. All Rights Reserved.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#include "casbin/pch.h"
diff --git a/casbin/rbac_api_with_domains.cpp b/casbin/rbac_api_with_domains.cpp
index 6d60375e..c15d5eb6 100644
--- a/casbin/rbac_api_with_domains.cpp
+++ b/casbin/rbac_api_with_domains.cpp
@@ -1,17 +1,20 @@
/*
- * Copyright 2020 The casbin Authors. All Rights Reserved.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#include "casbin/pch.h"
diff --git a/casbin/selected_policies.cpp b/casbin/selected_policies.cpp
index c90afc8d..3aee07ad 100644
--- a/casbin/selected_policies.cpp
+++ b/casbin/selected_policies.cpp
@@ -1,17 +1,20 @@
/*
- * Copyright 2020 The casbin Authors. All Rights Reserved.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#include "casbin/selected_policies.h"
diff --git a/casbin/util/array_equals.cpp b/casbin/util/array_equals.cpp
index 3784ed5d..f9c6954d 100644
--- a/casbin/util/array_equals.cpp
+++ b/casbin/util/array_equals.cpp
@@ -1,17 +1,20 @@
/*
- * Copyright 2020 The casbin Authors. All Rights Reserved.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#include "casbin/pch.h"
diff --git a/casbin/util/array_remove_duplicates.cpp b/casbin/util/array_remove_duplicates.cpp
index 3a29c9ec..093e7128 100644
--- a/casbin/util/array_remove_duplicates.cpp
+++ b/casbin/util/array_remove_duplicates.cpp
@@ -1,17 +1,20 @@
/*
- * Copyright 2020 The casbin Authors. All Rights Reserved.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#include "casbin/pch.h"
diff --git a/casbin/util/array_to_string.cpp b/casbin/util/array_to_string.cpp
index 452f5dc0..f7a2a6e2 100644
--- a/casbin/util/array_to_string.cpp
+++ b/casbin/util/array_to_string.cpp
@@ -1,17 +1,20 @@
/*
- * Copyright 2020 The casbin Authors. All Rights Reserved.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#include "casbin/pch.h"
diff --git a/casbin/util/built_in_functions.cpp b/casbin/util/built_in_functions.cpp
index 5cb61e53..231e7e4f 100644
--- a/casbin/util/built_in_functions.cpp
+++ b/casbin/util/built_in_functions.cpp
@@ -1,17 +1,20 @@
/*
- * Copyright 2020 The casbin Authors. All Rights Reserved.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#include "casbin/pch.h"
diff --git a/casbin/util/ends_with.cpp b/casbin/util/ends_with.cpp
index da93727d..76fefdb8 100644
--- a/casbin/util/ends_with.cpp
+++ b/casbin/util/ends_with.cpp
@@ -1,17 +1,20 @@
/*
- * Copyright 2020 The casbin Authors. All Rights Reserved.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#include "casbin/pch.h"
diff --git a/casbin/util/escape_assertion.cpp b/casbin/util/escape_assertion.cpp
index a766c104..da55921e 100644
--- a/casbin/util/escape_assertion.cpp
+++ b/casbin/util/escape_assertion.cpp
@@ -1,17 +1,20 @@
/*
- * Copyright 2020 The casbin Authors. All Rights Reserved.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#include "casbin/pch.h"
diff --git a/casbin/util/eval.cpp b/casbin/util/eval.cpp
index 76c6ff79..488aa2e3 100644
--- a/casbin/util/eval.cpp
+++ b/casbin/util/eval.cpp
@@ -1,17 +1,20 @@
/*
- * Copyright 2020 The casbin Authors. All Rights Reserved.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#include "casbin/pch.h"
diff --git a/casbin/util/find_all_occurences.cpp b/casbin/util/find_all_occurences.cpp
index ef4f6dea..eb066ba3 100644
--- a/casbin/util/find_all_occurences.cpp
+++ b/casbin/util/find_all_occurences.cpp
@@ -1,17 +1,20 @@
/*
- * Copyright 2020 The casbin Authors. All Rights Reserved.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#include "casbin/pch.h"
diff --git a/casbin/util/is_instance_of.cpp b/casbin/util/is_instance_of.cpp
index 648785c4..9ba09ec5 100644
--- a/casbin/util/is_instance_of.cpp
+++ b/casbin/util/is_instance_of.cpp
@@ -1,17 +1,20 @@
/*
- * Copyright 2020 The casbin Authors. All Rights Reserved.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#include "casbin/pch.h"
diff --git a/casbin/util/join.cpp b/casbin/util/join.cpp
index 2388be83..6baad1fe 100644
--- a/casbin/util/join.cpp
+++ b/casbin/util/join.cpp
@@ -1,17 +1,20 @@
/*
- * Copyright 2020 The casbin Authors. All Rights Reserved.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#include "casbin/pch.h"
diff --git a/casbin/util/join_slice.cpp b/casbin/util/join_slice.cpp
index 21af9376..dcc1ad79 100644
--- a/casbin/util/join_slice.cpp
+++ b/casbin/util/join_slice.cpp
@@ -1,17 +1,20 @@
/*
- * Copyright 2020 The casbin Authors. All Rights Reserved.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#include "casbin/pch.h"
diff --git a/casbin/util/remove_comments.cpp b/casbin/util/remove_comments.cpp
index f457298d..e616f930 100644
--- a/casbin/util/remove_comments.cpp
+++ b/casbin/util/remove_comments.cpp
@@ -1,17 +1,20 @@
/*
- * Copyright 2020 The casbin Authors. All Rights Reserved.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#include "casbin/pch.h"
diff --git a/casbin/util/set_subtract.cpp b/casbin/util/set_subtract.cpp
index 0a600dd8..5c6459e4 100644
--- a/casbin/util/set_subtract.cpp
+++ b/casbin/util/set_subtract.cpp
@@ -1,17 +1,20 @@
/*
- * Copyright 2020 The casbin Authors. All Rights Reserved.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#include "casbin/pch.h"
diff --git a/casbin/util/split.cpp b/casbin/util/split.cpp
index 310efe3c..c93d74fe 100644
--- a/casbin/util/split.cpp
+++ b/casbin/util/split.cpp
@@ -1,17 +1,20 @@
/*
- * Copyright 2020 The casbin Authors. All Rights Reserved.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#include "casbin/pch.h"
diff --git a/casbin/util/ticker.cpp b/casbin/util/ticker.cpp
index 90dfecaa..baa5dea8 100644
--- a/casbin/util/ticker.cpp
+++ b/casbin/util/ticker.cpp
@@ -1,17 +1,20 @@
/*
- * Copyright 2020 The casbin Authors. All Rights Reserved.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#include "casbin/pch.h"
@@ -33,29 +36,37 @@ Ticker::~Ticker() {
}
void Ticker::start() {
+ std::lock_guard lifecycle(_lifecycleMutex);
if (_running) return;
+ if (_worker.joinable())
+ _worker.join();
_running = true;
- _futures1.push_back(std::async(std::launch::async, &Ticker::timer_loop, this));
+ _worker = std::thread(&Ticker::timer_loop, this);
}
void Ticker::stop() {
- _running = false;
- std::lock_guard lock(_tickIntervalMutex);
- for (auto&& f : _futures1) {
- f.wait();
- }
- for (auto&& f : _futures2) {
- f.wait();
+ std::lock_guard lifecycle(_lifecycleMutex);
+ {
+ std::lock_guard lock(_tickIntervalMutex);
+ _running = false;
}
+ _wake.notify_all();
+ if (_worker.joinable() && _worker.get_id() != std::this_thread::get_id())
+ _worker.join();
}
void Ticker::timer_loop() {
+ std::unique_lock lock(_tickIntervalMutex);
while (_running) {
- {
- std::lock_guard lock(_tickIntervalMutex);
- _futures2.push_back(std::async(std::launch::async, _onTick));
- std::this_thread::sleep_for(_tickInterval);
+ lock.unlock();
+ try {
+ _onTick();
+ } catch (...) {
+ // The previous async callbacks also kept exceptions in their
+ // futures. Keep a callback failure from terminating the scheduler.
}
+ lock.lock();
+ _wake.wait_for(lock, _tickInterval, [this] { return !_running.load(); });
}
}
diff --git a/casbin/util/trim.cpp b/casbin/util/trim.cpp
index cdc76723..63c1ea8f 100644
--- a/casbin/util/trim.cpp
+++ b/casbin/util/trim.cpp
@@ -1,17 +1,20 @@
/*
- * Copyright 2020 The casbin Authors. All Rights Reserved.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#include "casbin/pch.h"
diff --git a/cmake/casbinConfig.cmake.in b/cmake/casbinConfig.cmake.in
index 8b0b9354..3327e390 100644
--- a/cmake/casbinConfig.cmake.in
+++ b/cmake/casbinConfig.cmake.in
@@ -1,23 +1,27 @@
-# Copyright 2023 The casbin Authors. All Rights Reserved.
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# https://www.apache.org/licenses/LICENSE-2.0
#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
@PACKAGE_INIT@
include(CMakeFindDependencyMacro)
# casbin::casbin links nlohmann_json publicly, so consumers need it as well.
-find_dependency(nlohmann_json 3.10.1)
+find_dependency(nlohmann_json 3.10.1 CONFIG)
+find_dependency(Threads)
include("${CMAKE_CURRENT_LIST_DIR}/casbinTargets.cmake")
diff --git a/cmake/modules/FindExtPackages.cmake b/cmake/modules/FindExtPackages.cmake
index 974d83c1..2fbc2f4d 100644
--- a/cmake/modules/FindExtPackages.cmake
+++ b/cmake/modules/FindExtPackages.cmake
@@ -1,19 +1,19 @@
-# Copyright 2021 The casbin Authors. All Rights Reserved.
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# https://www.apache.org/licenses/LICENSE-2.0
#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-###############################################################################
-### Global package options ###
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
set(CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY ON CACHE BOOL
"Disable CMake User Package Registry when finding packages")
diff --git a/cmake/modules/Findbenchmark.cmake b/cmake/modules/Findbenchmark.cmake
index 6716d197..4baac67a 100644
--- a/cmake/modules/Findbenchmark.cmake
+++ b/cmake/modules/Findbenchmark.cmake
@@ -1,23 +1,26 @@
-# Copyright 2021 The casbin Authors. All Rights Reserved.
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# https://www.apache.org/licenses/LICENSE-2.0
#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
include(FetchContent)
FetchContent_Declare(
benchmark
GIT_REPOSITORY https://github.com/google/benchmark.git
- GIT_TAG v1.10.0
+ GIT_TAG a6b4a9f00b36c19af9997d68a1cf6e0b5b3d032c # v1.10.0
DOWNLOAD_EXTRACT_TIMESTAMP FALSE
)
diff --git a/cmake/modules/Findgoogletest.cmake b/cmake/modules/Findgoogletest.cmake
index b59015e6..86714dac 100644
--- a/cmake/modules/Findgoogletest.cmake
+++ b/cmake/modules/Findgoogletest.cmake
@@ -1,27 +1,31 @@
-# Copyright 2021 The casbin Authors. All Rights Reserved.
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# https://www.apache.org/licenses/LICENSE-2.0
#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
include(FetchContent)
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
- GIT_TAG v1.18.0
+ GIT_TAG 063de7e9578f82b369302001269680b4b1553359 # v1.18.0
DOWNLOAD_EXTRACT_TIMESTAMP FALSE
)
# For Windows: Prevent overriding the parent project's compiler/linker settings
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
+set(INSTALL_GTEST OFF CACHE BOOL "Do not install test-only libraries" FORCE)
FetchContent_MakeAvailable(googletest)
diff --git a/cmake/modules/Findjson.cmake b/cmake/modules/Findjson.cmake
index 61798fde..e38f1ac1 100644
--- a/cmake/modules/Findjson.cmake
+++ b/cmake/modules/Findjson.cmake
@@ -1,3 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
# Copyright 2021 The casbin Authors. All Rights Reserved.
#
@@ -29,7 +46,7 @@ if(NOT nlohmann_json_FOUND)
FetchContent_Declare(
json
GIT_REPOSITORY https://github.com/nlohmann/json.git
- GIT_TAG v3.12.0
+ GIT_TAG 55f93686c01528224f448c19128836e7df245f72 # v3.12.0
DOWNLOAD_EXTRACT_TIMESTAMP FALSE
)
diff --git a/cmake/modules/Findpybind11.cmake b/cmake/modules/Findpybind11.cmake
index b8850921..15bc53e6 100644
--- a/cmake/modules/Findpybind11.cmake
+++ b/cmake/modules/Findpybind11.cmake
@@ -1,23 +1,26 @@
-# Copyright 2021 The casbin Authors. All Rights Reserved.
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# https://www.apache.org/licenses/LICENSE-2.0
#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
include(FetchContent)
FetchContent_Declare(
pybind11
GIT_REPOSITORY https://github.com/pybind/pybind11.git
- GIT_TAG v3.1.0
+ GIT_TAG 97bf890db679505a14dfe547a5e77bb2bd05dc90 # v3.1.0
DOWNLOAD_EXTRACT_TIMESTAMP FALSE
)
diff --git a/examples/abac_model.conf b/examples/abac_model.conf
index 4cfaea38..2d766e45 100644
--- a/examples/abac_model.conf
+++ b/examples/abac_model.conf
@@ -1,3 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
[request_definition]
r = sub, obj, act
diff --git a/examples/abac_rule_model.conf b/examples/abac_rule_model.conf
index 591dd3a6..e8601d9b 100644
--- a/examples/abac_rule_model.conf
+++ b/examples/abac_rule_model.conf
@@ -1,3 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
[request_definition]
r = sub, obj, act
diff --git a/examples/abac_rule_policy.csv b/examples/abac_rule_policy.csv
index e3dbc833..7977dd75 100644
--- a/examples/abac_rule_policy.csv
+++ b/examples/abac_rule_policy.csv
@@ -1,2 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
p, r.sub.Age > 18, /data1, read
p, r.sub.Age < 60, /data2, write
\ No newline at end of file
diff --git a/examples/basic_inverse_policy.csv b/examples/basic_inverse_policy.csv
index 276c4403..5224e260 100644
--- a/examples/basic_inverse_policy.csv
+++ b/examples/basic_inverse_policy.csv
@@ -1,2 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
p, alice, data1, write
p, bob, data2, read
\ No newline at end of file
diff --git a/examples/basic_model.conf b/examples/basic_model.conf
index dc6da813..386e02c2 100644
--- a/examples/basic_model.conf
+++ b/examples/basic_model.conf
@@ -1,3 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
[request_definition]
r = sub, obj, act
diff --git a/examples/basic_model_without_spaces.conf b/examples/basic_model_without_spaces.conf
index 5452f954..e85fbe67 100644
--- a/examples/basic_model_without_spaces.conf
+++ b/examples/basic_model_without_spaces.conf
@@ -1,3 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
[request_definition]
r = sub,obj,act
diff --git a/examples/basic_policy.csv b/examples/basic_policy.csv
index 57aaa976..cc3aaf11 100644
--- a/examples/basic_policy.csv
+++ b/examples/basic_policy.csv
@@ -1,2 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
p, alice, data1, read
p, bob, data2, write
\ No newline at end of file
diff --git a/examples/basic_with_root_model.conf b/examples/basic_with_root_model.conf
index 8f13907e..f9579e07 100644
--- a/examples/basic_with_root_model.conf
+++ b/examples/basic_with_root_model.conf
@@ -1,3 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
[request_definition]
r = sub, obj, act
diff --git a/examples/basic_without_resources_model.conf b/examples/basic_without_resources_model.conf
index f61bd710..3e3a2d30 100644
--- a/examples/basic_without_resources_model.conf
+++ b/examples/basic_without_resources_model.conf
@@ -1,3 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
[request_definition]
r = sub, act
diff --git a/examples/basic_without_resources_policy.csv b/examples/basic_without_resources_policy.csv
index c861941b..b3e328cc 100644
--- a/examples/basic_without_resources_policy.csv
+++ b/examples/basic_without_resources_policy.csv
@@ -1,2 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
p, alice, read
p, bob, write
\ No newline at end of file
diff --git a/examples/basic_without_users_model.conf b/examples/basic_without_users_model.conf
index 1fe5993c..dd0c8260 100644
--- a/examples/basic_without_users_model.conf
+++ b/examples/basic_without_users_model.conf
@@ -1,3 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
[request_definition]
r = obj, act
diff --git a/examples/basic_without_users_policy.csv b/examples/basic_without_users_policy.csv
index 79048da6..784dbb04 100644
--- a/examples/basic_without_users_policy.csv
+++ b/examples/basic_without_users_policy.csv
@@ -1,2 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
p, data1, read
p, data2, write
\ No newline at end of file
diff --git a/examples/comment_model.conf b/examples/comment_model.conf
index a4200ebf..7139b53f 100644
--- a/examples/comment_model.conf
+++ b/examples/comment_model.conf
@@ -1,3 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
[request_definition]
r = sub, obj, act ; Request definition
diff --git a/examples/error/error_model.conf b/examples/error/error_model.conf
index 59304dbe..dbd0a5d8 100644
--- a/examples/error/error_model.conf
+++ b/examples/error/error_model.conf
@@ -1,3 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
[request_definition]
r = sub, obj, act
diff --git a/examples/error/error_policy.csv b/examples/error/error_policy.csv
index e490c7d2..761cc562 100644
--- a/examples/error/error_policy.csv
+++ b/examples/error/error_policy.csv
@@ -1,2 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
p, alice, data1, read
bob, data2, write
\ No newline at end of file
diff --git a/examples/glob_model.conf b/examples/glob_model.conf
index b16cad49..bf6b4f17 100644
--- a/examples/glob_model.conf
+++ b/examples/glob_model.conf
@@ -1,3 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
[request_definition]
r = sub, obj, act
diff --git a/examples/glob_policy.csv b/examples/glob_policy.csv
index 86c03b07..c5a0a2c0 100644
--- a/examples/glob_policy.csv
+++ b/examples/glob_policy.csv
@@ -1,3 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
p, u1, /foo/*, read
p, u2, /foo*, read
p, u3, /*/foo/*, read
diff --git a/examples/ipmatch_model.conf b/examples/ipmatch_model.conf
index 26e4b011..76f06d38 100644
--- a/examples/ipmatch_model.conf
+++ b/examples/ipmatch_model.conf
@@ -1,3 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
[request_definition]
r = sub, obj, act
diff --git a/examples/ipmatch_policy.csv b/examples/ipmatch_policy.csv
index ca678a92..eee5e4a5 100644
--- a/examples/ipmatch_policy.csv
+++ b/examples/ipmatch_policy.csv
@@ -1,2 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
p, 192.168.2.0/24, data1, read
p, 10.0.0.0/16, data2, write
\ No newline at end of file
diff --git a/examples/keymatch2_model.conf b/examples/keymatch2_model.conf
index 944123de..101069d7 100644
--- a/examples/keymatch2_model.conf
+++ b/examples/keymatch2_model.conf
@@ -1,3 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
[request_definition]
r = sub, obj, act
diff --git a/examples/keymatch2_policy.csv b/examples/keymatch2_policy.csv
index 941a48f8..9a49c18d 100644
--- a/examples/keymatch2_policy.csv
+++ b/examples/keymatch2_policy.csv
@@ -1,2 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
p, alice, /alice_data/:resource, GET
p, alice, /alice_data2/:id/using/:resId, GET
\ No newline at end of file
diff --git a/examples/keymatch_custom_model.conf b/examples/keymatch_custom_model.conf
index 1cad8bfd..ac86dca3 100644
--- a/examples/keymatch_custom_model.conf
+++ b/examples/keymatch_custom_model.conf
@@ -1,3 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
[request_definition]
r = sub, obj, act
diff --git a/examples/keymatch_model.conf b/examples/keymatch_model.conf
index 4f86ba8f..4d674723 100644
--- a/examples/keymatch_model.conf
+++ b/examples/keymatch_model.conf
@@ -1,3 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
[request_definition]
r = sub, obj, act
diff --git a/examples/keymatch_policy.csv b/examples/keymatch_policy.csv
index d6e9b7d4..6925befc 100644
--- a/examples/keymatch_policy.csv
+++ b/examples/keymatch_policy.csv
@@ -1,3 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
p, alice, /alice_data/*, GET
p, alice, /alice_data/resource1, POST
diff --git a/examples/performance/rbac_with_pattern_large_scale_model.conf b/examples/performance/rbac_with_pattern_large_scale_model.conf
index 19c40522..18d61a18 100644
--- a/examples/performance/rbac_with_pattern_large_scale_model.conf
+++ b/examples/performance/rbac_with_pattern_large_scale_model.conf
@@ -1,3 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
[request_definition]
r = sub, obj, act
diff --git a/examples/performance/rbac_with_pattern_large_scale_policy.csv b/examples/performance/rbac_with_pattern_large_scale_policy.csv
index 5e865a7b..3dcea7dc 100644
--- a/examples/performance/rbac_with_pattern_large_scale_policy.csv
+++ b/examples/performance/rbac_with_pattern_large_scale_policy.csv
@@ -1,3 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
# 132 policies / 3000 grouping policies / 300 subjuects / 6 roles
# Policy - staff001
p, staff001, /orgs/{orgID}/sites/{siteID}, App001.Module001.Action1001
diff --git a/examples/priority_indeterminate_policy.csv b/examples/priority_indeterminate_policy.csv
index 974aa27e..cb8d918a 100644
--- a/examples/priority_indeterminate_policy.csv
+++ b/examples/priority_indeterminate_policy.csv
@@ -1 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
p, alice, data1, read, indeterminate
\ No newline at end of file
diff --git a/examples/priority_model.conf b/examples/priority_model.conf
index ece1562e..5c25d560 100644
--- a/examples/priority_model.conf
+++ b/examples/priority_model.conf
@@ -1,3 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
[request_definition]
r = sub, obj, act
diff --git a/examples/priority_policy.csv b/examples/priority_policy.csv
index 1ec5e5a7..3312de2c 100644
--- a/examples/priority_policy.csv
+++ b/examples/priority_policy.csv
@@ -1,3 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
p, alice, data1, read, allow
p, data1_deny_group, data1, read, deny
p, data1_deny_group, data1, write, deny
diff --git a/examples/rbac_model.conf b/examples/rbac_model.conf
index 71159e38..ab851a2d 100644
--- a/examples/rbac_model.conf
+++ b/examples/rbac_model.conf
@@ -1,3 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
[request_definition]
r = sub, obj, act
diff --git a/examples/rbac_model_in_multi_line.conf b/examples/rbac_model_in_multi_line.conf
index 17771b67..ea7eb5bb 100644
--- a/examples/rbac_model_in_multi_line.conf
+++ b/examples/rbac_model_in_multi_line.conf
@@ -1,3 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
[request_definition]
r = sub, obj, act
diff --git a/examples/rbac_model_matcher_using_in_op.conf b/examples/rbac_model_matcher_using_in_op.conf
index 227d1494..48cf0981 100644
--- a/examples/rbac_model_matcher_using_in_op.conf
+++ b/examples/rbac_model_matcher_using_in_op.conf
@@ -1,3 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
[request_definition]
r = sub, obj, act
diff --git a/examples/rbac_policy.csv b/examples/rbac_policy.csv
index f93d6df8..17b9ee80 100644
--- a/examples/rbac_policy.csv
+++ b/examples/rbac_policy.csv
@@ -1,3 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
p, alice, data1, read
p, bob, data2, write
p, data2_admin, data2, read
diff --git a/examples/rbac_with_all_pattern_model.conf b/examples/rbac_with_all_pattern_model.conf
index 045bfa57..7c152e82 100644
--- a/examples/rbac_with_all_pattern_model.conf
+++ b/examples/rbac_with_all_pattern_model.conf
@@ -1,3 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
[request_definition]
r = sub, dom, obj, act
diff --git a/examples/rbac_with_all_pattern_policy.csv b/examples/rbac_with_all_pattern_policy.csv
index 8097be8a..56513d41 100644
--- a/examples/rbac_with_all_pattern_policy.csv
+++ b/examples/rbac_with_all_pattern_policy.csv
@@ -1,3 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
p, alice, domain1, book_group, read
p, alice, domain2, book_group, write
diff --git a/examples/rbac_with_deny_model.conf b/examples/rbac_with_deny_model.conf
index 33749f00..6b817160 100644
--- a/examples/rbac_with_deny_model.conf
+++ b/examples/rbac_with_deny_model.conf
@@ -1,3 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
[request_definition]
r = sub, obj, act
diff --git a/examples/rbac_with_deny_policy.csv b/examples/rbac_with_deny_policy.csv
index 0603db8d..65e231ec 100644
--- a/examples/rbac_with_deny_policy.csv
+++ b/examples/rbac_with_deny_policy.csv
@@ -1,3 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
p, alice, data1, read, allow
p, bob, data2, write, allow
p, data2_admin, data2, read, allow
diff --git a/examples/rbac_with_domain_pattern_model.conf b/examples/rbac_with_domain_pattern_model.conf
index 774e4418..2638ea61 100644
--- a/examples/rbac_with_domain_pattern_model.conf
+++ b/examples/rbac_with_domain_pattern_model.conf
@@ -1,3 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
[request_definition]
r = sub, dom, obj, act
diff --git a/examples/rbac_with_domain_pattern_policy.csv b/examples/rbac_with_domain_pattern_policy.csv
index c8abd35e..76bf2a9a 100644
--- a/examples/rbac_with_domain_pattern_policy.csv
+++ b/examples/rbac_with_domain_pattern_policy.csv
@@ -1,3 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
p, admin, domain1, data1, read
p, admin, domain1, data1, write
p, admin, domain2, data2, read
diff --git a/examples/rbac_with_domains_model.conf b/examples/rbac_with_domains_model.conf
index 57c37216..56b67c64 100644
--- a/examples/rbac_with_domains_model.conf
+++ b/examples/rbac_with_domains_model.conf
@@ -1,3 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
[request_definition]
r = sub, dom, obj, act
diff --git a/examples/rbac_with_domains_policy.csv b/examples/rbac_with_domains_policy.csv
index 8558d171..01d6ff0a 100644
--- a/examples/rbac_with_domains_policy.csv
+++ b/examples/rbac_with_domains_policy.csv
@@ -1,3 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
p, admin, domain1, data1, read
p, admin, domain1, data1, write
p, admin, domain2, data2, read
diff --git a/examples/rbac_with_hierarchy_policy.csv b/examples/rbac_with_hierarchy_policy.csv
index f7229986..ad5827ff 100644
--- a/examples/rbac_with_hierarchy_policy.csv
+++ b/examples/rbac_with_hierarchy_policy.csv
@@ -1,3 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
p, alice, data1, read
p, bob, data2, write
p, data1_admin, data1, read
diff --git a/examples/rbac_with_hierarchy_with_domains_policy.csv b/examples/rbac_with_hierarchy_with_domains_policy.csv
index 45d91739..4ae76096 100644
--- a/examples/rbac_with_hierarchy_with_domains_policy.csv
+++ b/examples/rbac_with_hierarchy_with_domains_policy.csv
@@ -1,3 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
p, role:reader, domain1, data1, read
p, role:writer, domain1, data1, write
diff --git a/examples/rbac_with_not_deny_model.conf b/examples/rbac_with_not_deny_model.conf
index 1e8a3e68..a2a4494c 100644
--- a/examples/rbac_with_not_deny_model.conf
+++ b/examples/rbac_with_not_deny_model.conf
@@ -1,3 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
[request_definition]
r = sub, obj, act
diff --git a/examples/rbac_with_pattern_model.conf b/examples/rbac_with_pattern_model.conf
index 84580d90..916928e3 100644
--- a/examples/rbac_with_pattern_model.conf
+++ b/examples/rbac_with_pattern_model.conf
@@ -1,3 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
[request_definition]
r = sub, obj, act
diff --git a/examples/rbac_with_pattern_policy.csv b/examples/rbac_with_pattern_policy.csv
index 31316e90..3f164868 100644
--- a/examples/rbac_with_pattern_policy.csv
+++ b/examples/rbac_with_pattern_policy.csv
@@ -1,3 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
p, alice, /pen/1, GET
p, alice, /pen2/1, GET
p, book_admin, book_group, GET
diff --git a/examples/rbac_with_resource_roles_model.conf b/examples/rbac_with_resource_roles_model.conf
index 845bc6c7..c6acac96 100644
--- a/examples/rbac_with_resource_roles_model.conf
+++ b/examples/rbac_with_resource_roles_model.conf
@@ -1,3 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
[request_definition]
r = sub, obj, act
diff --git a/examples/rbac_with_resource_roles_policy.csv b/examples/rbac_with_resource_roles_policy.csv
index b1d36daf..45ce4c2f 100644
--- a/examples/rbac_with_resource_roles_policy.csv
+++ b/examples/rbac_with_resource_roles_policy.csv
@@ -1,3 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
p, alice, data1, read
p, bob, data2, write
p, data_group_admin, data_group, write
diff --git a/include/casbin/casbin.h b/include/casbin/casbin.h
index fa8ff4af..88964c68 100644
--- a/include/casbin/casbin.h
+++ b/include/casbin/casbin.h
@@ -1,21 +1,24 @@
/*
- * Copyright 2021 The casbin Authors. All Rights Reserved.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * This is the main file for python bindings workflow
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
+/* This is the main file for python bindings workflow */
+
#ifndef CASBIN_CPP_CASBIN_H
#define CASBIN_CPP_CASBIN_H
diff --git a/include/casbin/casbin_types.h b/include/casbin/casbin_types.h
index df30b3a8..05debbcb 100644
--- a/include/casbin/casbin_types.h
+++ b/include/casbin/casbin_types.h
@@ -1,21 +1,24 @@
/*
- * Copyright 2021 The casbin Authors. All Rights Reserved.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * This is the main file for python bindings workflow
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
+/* This is the main file for python bindings workflow */
+
#ifndef CASBIN_CPP_CASBIN_TYPES_H
#define CASBIN_CPP_CASBIN_TYPES_H
diff --git a/include/casbin/config/config.h b/include/casbin/config/config.h
index 883aa8a4..694a9340 100644
--- a/include/casbin/config/config.h
+++ b/include/casbin/config/config.h
@@ -1,17 +1,20 @@
/*
- * Copyright 2020 The casbin Authors. All Rights Reserved.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#ifndef CASBIN_CPP_CONFIG_CONFIG
diff --git a/include/casbin/config/config_interface.h b/include/casbin/config/config_interface.h
index 0dfb152e..9e1cfce5 100644
--- a/include/casbin/config/config_interface.h
+++ b/include/casbin/config/config_interface.h
@@ -1,17 +1,20 @@
/*
- * Copyright 2020 The casbin Authors. All Rights Reserved.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#ifndef CASBIN_CPP_CONFIG_CONFIG_INTERFACE
diff --git a/include/casbin/config/testdata/testini.ini b/include/casbin/config/testdata/testini.ini
index df6ff65f..fea424a9 100644
--- a/include/casbin/config/testdata/testini.ini
+++ b/include/casbin/config/testdata/testini.ini
@@ -1,3 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
# test config
debug = true
url = act.wiki
diff --git a/include/casbin/data_types.h b/include/casbin/data_types.h
index 81a3503c..afa608d4 100644
--- a/include/casbin/data_types.h
+++ b/include/casbin/data_types.h
@@ -1,17 +1,20 @@
/*
- * Copyright 2021 The casbin Authors. All Rights Reserved.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#include
diff --git a/include/casbin/effect/default_effector.h b/include/casbin/effect/default_effector.h
index 65206d48..47f4affa 100644
--- a/include/casbin/effect/default_effector.h
+++ b/include/casbin/effect/default_effector.h
@@ -1,17 +1,20 @@
/*
- * Copyright 2020 The casbin Authors. All Rights Reserved.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#ifndef CASBIN_CPP_EFFECT_DEFAULT_EFFECTOR
diff --git a/include/casbin/effect/effect.h b/include/casbin/effect/effect.h
index c7e41681..522cabb2 100644
--- a/include/casbin/effect/effect.h
+++ b/include/casbin/effect/effect.h
@@ -1,17 +1,20 @@
/*
- * Copyright 2020 The casbin Authors. All Rights Reserved.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#ifndef CASBIN_CPP_EFFECT_EFFECT
diff --git a/include/casbin/effect/effector.h b/include/casbin/effect/effector.h
index c337ebbd..7bde56d1 100644
--- a/include/casbin/effect/effector.h
+++ b/include/casbin/effect/effector.h
@@ -1,17 +1,20 @@
/*
- * Copyright 2020 The casbin Authors. All Rights Reserved.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * https://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#ifndef CASBIN_CPP_EFFECT_EFFECTOR
diff --git a/include/casbin/enforcer.h b/include/casbin/enforcer.h
index 66dc6009..225cfb29 100644
--- a/include/casbin/enforcer.h
+++ b/include/casbin/enforcer.h
@@ -1,283 +1,286 @@
-/*
- * Copyright 2020 The casbin Authors. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef CASBIN_CPP_ENFORCER
-#define CASBIN_CPP_ENFORCER
-
-#include
-#include
-
-#include "casbin/enforcer_interface.h"
-#include "casbin/log/log_util.h"
-#include "casbin/model/evaluator.h"
-#include "casbin/model/function.h"
-#include "casbin/persist/filtered_adapter.h"
-#include "casbin/rbac/role_manager.h"
-
-namespace casbin {
-
-// Enforcer is the main interface for authorization enforcement and policy management.
-class Enforcer : public IEnforcer {
-private:
- std::string m_model_path;
- std::shared_ptr m_model;
- std::shared_ptr m_eft;
-
- std::shared_ptr m_adapter;
- std::shared_ptr m_watcher;
- std::shared_ptr m_evalator;
- LogUtil m_log;
-
- bool m_enabled;
- bool m_auto_save;
- bool m_auto_build_role_links;
- bool m_auto_notify_watcher;
-
- // enforce use a custom matcher to decides whether a "subject" can access a "object"
- // with the operation "action", input parameters are usually: (matcher, sub, obj, act),
- // use model matcher by default when matcher is "".
- bool m_enforce(const std::string& matcher, std::vector& explains, std::shared_ptr evalator) override;
-
-public:
- std::shared_ptr rm;
-
- /**
- * Enforcer is the default constructor.
- */
- Enforcer();
- /**
- * Enforcer initializes an enforcer with a model file and a policy file.
- *
- * @param model_path the path of the model file.
- * @param policy_file the path of the policy file.
- */
- Enforcer(const std::string& model_path, const std::string& policy_file);
- /**
- * Enforcer initializes an enforcer with a database adapter.
- *
- * @param model_path the path of the model file.
- * @param adapter the adapter.
- */
- Enforcer(const std::string& model_path, std::shared_ptr adapter);
- /**
- * Enforcer initializes an enforcer with a model and a database adapter.
- *
- * @param m the model.
- * @param adapter the adapter.
- */
- Enforcer(const std::shared_ptr& m, std::shared_ptr adapter);
- /**
- * Enforcer initializes an enforcer with a model.
- *
- * @param m the model.
- */
- Enforcer(const std::shared_ptr& m);
- /**
- * Enforcer initializes an enforcer with a model file.
- *
- * @param model_path the path of the model file.
- */
- Enforcer(const std::string& model_path);
- /**
- * Enforcer initializes an enforcer with a model file, a policy file and an enable log flag.
- *
- * @param model_path the path of the model file.
- * @param policy_file the path of the policy file.
- * @param enable_log whether to enable Casbin's log.
- */
- Enforcer(const std::string& model_path, const std::string& policy_file, bool enable_log);
- // Destructor of Enforcer.
- ~Enforcer();
- // InitWithFile initializes an enforcer with a model file and a policy file.
- void InitWithFile(const std::string& model_path, const std::string& policy_path) override;
- // InitWithAdapter initializes an enforcer with a database adapter.
- void InitWithAdapter(const std::string& model_path, std::shared_ptr adapter) override;
- // InitWithModelAndAdapter initializes an enforcer with a model and a database adapter.
- void InitWithModelAndAdapter(const std::shared_ptr& m, std::shared_ptr adapter) override;
- void Initialize() override;
- // LoadModel reloads the model from the model CONF file.
- // Because the policy is attached to a model, so the policy is invalidated and
- // needs to be reloaded by calling LoadPolicy().
- void LoadModel() override;
- // GetModel gets the current model.
- std::shared_ptr GetModel() override;
- // SetModel sets the current model.
- void SetModel(const std::shared_ptr& m) override;
- // GetAdapter gets the current adapter.
- std::shared_ptr GetAdapter() override;
- // SetAdapter sets the current adapter.
- void SetAdapter(std::shared_ptr adapter) override;
- // SetWatcher sets the current watcher.
- void SetWatcher(std::shared_ptr watcher) override;
- // SetWatcher sets the current watcher.
- void SetEvaluator(std::shared_ptr evaluator);
- // GetRoleManager gets the current role manager.
- std::shared_ptr GetRoleManager() override;
- // SetRoleManager sets the current role manager.
- void SetRoleManager(std::shared_ptr& rm) override;
- // SetEffector sets the current effector.
- void SetEffector(std::shared_ptr eft) override;
- // ClearPolicy clears all policy.
- void ClearPolicy() override;
- // LoadPolicy reloads the policy from file/database.
- void LoadPolicy() override;
- // LoadFilteredPolicy reloads a filtered policy from file/database.
- template
- void LoadFilteredPolicy(Filter filter);
- // IsFiltered returns true if the loaded policy has been filtered.
- bool IsFiltered() override;
- // SavePolicy saves the current policy (usually after changed with Casbin API) back to file/database.
- void SavePolicy() override;
- // EnableEnforce changes the enforcing state of Casbin, when Casbin is disabled, all access will be allowed by the Enforce() function.
- void EnableEnforce(bool enable) override;
- // EnableLog changes whether Casbin will log messages to the Logger.
- void EnableLog(bool enable);
-
- // EnableAutoNotifyWatcher controls whether to save a policy rule automatically notify the Watcher when it is added or removed.
- void EnableAutoNotifyWatcher(bool enable) override;
- // EnableAutoSave controls whether to save a policy rule automatically to the adapter when it is added or removed.
- void EnableAutoSave(bool auto_save) override;
- // EnableAutoBuildRoleLinks controls whether to rebuild the role inheritance relations when a role is added or deleted.
- void EnableAutoBuildRoleLinks(bool auto_build_role_links) override;
- // BuildRoleLinks manually rebuild the role inheritance relations.
- void BuildRoleLinks() override;
- // BuildIncrementalRoleLinks provides incremental build the role inheritance relations.
- void BuildIncrementalRoleLinks(policy_op op, const std::string& p_type, const PoliciesValues& rules);
- // Enforce decides whether a "subject" can access a "object" with the operation "action", input parameters are usually: (sub, obj, act).
- bool Enforce(std::shared_ptr evalator) override;
- // Enforce with a list param, decides whether a "subject" can access a "object" with the operation "action", input parameters are usually: (sub, obj, act).
- virtual bool Enforce(const DataList& params);
- // Enforce with a vector param, decides whether a "subject" can access a "object" with the operation "action", input parameters are usually: (sub, obj, act).
- virtual bool Enforce(const DataVector& params);
- // Enforce with a map param,decides whether a "subject" can access a "object" with the operation "action", input parameters are usually: (sub, obj, act).
- virtual bool Enforce(const DataMap& params);
- // EnforceWithMatcher use a custom matcher to decides whether a "subject" can access a "object" with the operation "action", input parameters are usually: (matcher, sub, obj, act), use model
- // matcher by default when matcher is "".
- bool EnforceWithMatcher(const std::string& matcher, std::shared_ptr evalator) override;
- // EnforceWithMatcher use a custom matcher to decides whether a "subject" can access a "object" with the operation "action", input parameters are usually: (matcher, sub, obj, act), use model
- // matcher by default when matcher is "".
- bool EnforceWithMatcher(const std::string& matcher, const DataList& params);
- // EnforceWithMatcher use a custom matcher to decides whether a "subject" can access a "object" with the operation "action", input parameters are usually: (matcher, sub, obj, act), use model
- // matcher by default when matcher is "".
- bool EnforceWithMatcher(const std::string& matcher, const DataVector& params);
- // EnforceWithMatcher use a custom matcher to decides whether a "subject" can access a "object" with the operation "action", input parameters are usually: (matcher, sub, obj, act), use model
- // matcher by default when matcher is "".
- bool EnforceWithMatcher(const std::string& matcher, const DataMap& params);
-
- bool EnforceEx(std::shared_ptr evalator, std::vector& explain) override;
- bool EnforceEx(const DataList& params, std::vector& explain);
- bool EnforceEx(const DataVector& params, std::vector& explain);
- bool EnforceEx(const DataMap& params, std::vector& explain);
-
- bool EnforceExWithMatcher(const std::string& matcher, std::shared_ptr evalator, std::vector& explain) override;
- bool EnforceExWithMatcher(const std::string& matcher, const DataList& params, std::vector& explain);
- bool EnforceExWithMatcher(const std::string& matcher, const DataVector& params, std::vector& explain);
- bool EnforceExWithMatcher(const std::string& matcher, const DataMap& params, std::vector& explain);
-
- // BatchEnforce enforce in batches
- std::vector BatchEnforce(const std::initializer_list