diff --git a/casbin/__init__.py b/casbin/__init__.py index b838ce20..0e159ba8 100644 --- a/casbin/__init__.py +++ b/casbin/__init__.py @@ -1,3 +1,17 @@ +# 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. + from .enforcer import * from .synced_enforcer import SyncedEnforcer from .distributed_enforcer import DistributedEnforcer diff --git a/casbin/config/__init__.py b/casbin/config/__init__.py index cca5d9bd..fd34cf7f 100644 --- a/casbin/config/__init__.py +++ b/casbin/config/__init__.py @@ -1 +1,15 @@ +# 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. + from .config import Config diff --git a/casbin/config/config.py b/casbin/config/config.py index 9dba5b3e..ced352c0 100644 --- a/casbin/config/config.py +++ b/casbin/config/config.py @@ -1,3 +1,17 @@ +# 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. + from io import StringIO diff --git a/casbin/core_enforcer.py b/casbin/core_enforcer.py index a5e75580..31ba25d5 100644 --- a/casbin/core_enforcer.py +++ b/casbin/core_enforcer.py @@ -1,3 +1,17 @@ +# 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. + import logging, copy from casbin.effect import Effector, get_effector, effect_to_bool diff --git a/casbin/distributed_enforcer.py b/casbin/distributed_enforcer.py index 6ae14e6e..b01778d3 100644 --- a/casbin/distributed_enforcer.py +++ b/casbin/distributed_enforcer.py @@ -1,3 +1,17 @@ +# 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. + from casbin import SyncedEnforcer import logging diff --git a/casbin/effect/__init__.py b/casbin/effect/__init__.py index 88bc31da..ede8aa8f 100644 --- a/casbin/effect/__init__.py +++ b/casbin/effect/__init__.py @@ -1,3 +1,17 @@ +# 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. + from .default_effectors import ( AllowOverrideEffector, DenyOverrideEffector, diff --git a/casbin/effect/default_effectors.py b/casbin/effect/default_effectors.py index 9e00ee41..7e5ae578 100644 --- a/casbin/effect/default_effectors.py +++ b/casbin/effect/default_effectors.py @@ -1,3 +1,17 @@ +# 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. + from .effector import Effector diff --git a/casbin/effect/effector.py b/casbin/effect/effector.py index 45106db4..71251ded 100644 --- a/casbin/effect/effector.py +++ b/casbin/effect/effector.py @@ -1,3 +1,18 @@ +# 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. + + class Effector: """Effector is the interface for Casbin effectors.""" diff --git a/casbin/enforcer.py b/casbin/enforcer.py index f45473fb..636baf0c 100644 --- a/casbin/enforcer.py +++ b/casbin/enforcer.py @@ -1,3 +1,17 @@ +# 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. + from functools import partial from casbin.management_enforcer import ManagementEnforcer diff --git a/casbin/frontend.py b/casbin/frontend.py index c13851ec..7ec7d788 100644 --- a/casbin/frontend.py +++ b/casbin/frontend.py @@ -1,3 +1,17 @@ +# 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. + import json diff --git a/casbin/internal_enforcer.py b/casbin/internal_enforcer.py index 87879544..2a15fe0a 100644 --- a/casbin/internal_enforcer.py +++ b/casbin/internal_enforcer.py @@ -1,3 +1,17 @@ +# 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. + from casbin.core_enforcer import CoreEnforcer from casbin.model.policy_op import PolicyOp diff --git a/casbin/management_enforcer.py b/casbin/management_enforcer.py index 6870cb99..3f1155f9 100644 --- a/casbin/management_enforcer.py +++ b/casbin/management_enforcer.py @@ -1,3 +1,17 @@ +# 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. + from casbin.internal_enforcer import InternalEnforcer from casbin.model.policy_op import PolicyOp diff --git a/casbin/model/__init__.py b/casbin/model/__init__.py index 2bdda40b..5491ba83 100644 --- a/casbin/model/__init__.py +++ b/casbin/model/__init__.py @@ -1,3 +1,17 @@ +# 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. + from .assertion import Assertion from .model import Model from .policy import Policy diff --git a/casbin/model/assertion.py b/casbin/model/assertion.py index c2f52c68..174cbe31 100644 --- a/casbin/model/assertion.py +++ b/casbin/model/assertion.py @@ -1,3 +1,17 @@ +# 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. + import logging from casbin.model.policy_op import PolicyOp diff --git a/casbin/model/function.py b/casbin/model/function.py index aedc9ef7..fdd4a227 100644 --- a/casbin/model/function.py +++ b/casbin/model/function.py @@ -1,3 +1,17 @@ +# 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. + from casbin import util diff --git a/casbin/model/model.py b/casbin/model/model.py index fd4e775d..c0b8d9c5 100644 --- a/casbin/model/model.py +++ b/casbin/model/model.py @@ -1,3 +1,17 @@ +# 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. + from . import Assertion from casbin import util, config from .policy import Policy diff --git a/casbin/model/policy.py b/casbin/model/policy.py index 175dbf3b..7c77cc74 100644 --- a/casbin/model/policy.py +++ b/casbin/model/policy.py @@ -1,3 +1,17 @@ +# 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. + import logging DEFAULT_SEP = "," diff --git a/casbin/model/policy_op.py b/casbin/model/policy_op.py index 7ef171da..a05f765e 100644 --- a/casbin/model/policy_op.py +++ b/casbin/model/policy_op.py @@ -1,3 +1,17 @@ +# 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. + import enum diff --git a/casbin/persist/__init__.py b/casbin/persist/__init__.py index 0c04a1c4..78c13538 100644 --- a/casbin/persist/__init__.py +++ b/casbin/persist/__init__.py @@ -1,3 +1,17 @@ +# 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. + from .adapter import * from .adapter_filtered import * from .batch_adapter import * diff --git a/casbin/persist/adapter.py b/casbin/persist/adapter.py index 567bd770..0d291b3b 100644 --- a/casbin/persist/adapter.py +++ b/casbin/persist/adapter.py @@ -1,3 +1,18 @@ +# 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. + + def load_policy_line(line, model): """loads a text line as a policy rule to model.""" diff --git a/casbin/persist/adapter_filtered.py b/casbin/persist/adapter_filtered.py index 5cd1038c..dd3ab897 100644 --- a/casbin/persist/adapter_filtered.py +++ b/casbin/persist/adapter_filtered.py @@ -1,3 +1,17 @@ +# 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. + from .adapter import Adapter """ FilteredAdapter is the interface for Casbin adapters supporting filtered policies.""" diff --git a/casbin/persist/adapters/__init__.py b/casbin/persist/adapters/__init__.py index 804ae9ca..5bee4fcf 100644 --- a/casbin/persist/adapters/__init__.py +++ b/casbin/persist/adapters/__init__.py @@ -1,3 +1,17 @@ +# 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. + from .file_adapter import FileAdapter from .adapter_filtered import FilteredAdapter from .update_adapter import UpdateAdapter diff --git a/casbin/persist/adapters/adapter_filtered.py b/casbin/persist/adapters/adapter_filtered.py index b37a0da0..571ee7d1 100644 --- a/casbin/persist/adapters/adapter_filtered.py +++ b/casbin/persist/adapters/adapter_filtered.py @@ -1,3 +1,17 @@ +# 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. + from casbin import persist from casbin import model from .file_adapter import FileAdapter diff --git a/casbin/persist/adapters/file_adapter.py b/casbin/persist/adapters/file_adapter.py index 8dc8d667..0e807598 100644 --- a/casbin/persist/adapters/file_adapter.py +++ b/casbin/persist/adapters/file_adapter.py @@ -1,3 +1,17 @@ +# 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. + from casbin import persist import os diff --git a/casbin/persist/adapters/update_adapter.py b/casbin/persist/adapters/update_adapter.py index b9356ec6..590c1891 100644 --- a/casbin/persist/adapters/update_adapter.py +++ b/casbin/persist/adapters/update_adapter.py @@ -1,3 +1,18 @@ +# 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. + + class UpdateAdapter: """UpdateAdapter is the interface for Casbin adapters with add update policy function.""" diff --git a/casbin/persist/batch_adapter.py b/casbin/persist/batch_adapter.py index 8ccec0f3..c6688163 100644 --- a/casbin/persist/batch_adapter.py +++ b/casbin/persist/batch_adapter.py @@ -1,3 +1,17 @@ +# 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. + from .adapter import Adapter """BatchAdapter is the interface for Casbin adapters with multiple add and remove policy functions.""" diff --git a/casbin/persist/dispatcher.py b/casbin/persist/dispatcher.py index 6ea589c1..51aa4a86 100644 --- a/casbin/persist/dispatcher.py +++ b/casbin/persist/dispatcher.py @@ -1,3 +1,18 @@ +# 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. + + class Dispatcher: """Dispatcher is the interface for pycasbin dispatcher""" diff --git a/casbin/rbac/__init__.py b/casbin/rbac/__init__.py index cd3c1521..b82b0732 100644 --- a/casbin/rbac/__init__.py +++ b/casbin/rbac/__init__.py @@ -1 +1,15 @@ +# 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. + from .role_manager import RoleManager diff --git a/casbin/rbac/default_role_manager/__init__.py b/casbin/rbac/default_role_manager/__init__.py index bf5c0470..45e45fde 100644 --- a/casbin/rbac/default_role_manager/__init__.py +++ b/casbin/rbac/default_role_manager/__init__.py @@ -1 +1,15 @@ +# 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. + from .role_manager import RoleManager, DomainManager diff --git a/casbin/rbac/default_role_manager/role_manager.py b/casbin/rbac/default_role_manager/role_manager.py index c7e0ce7b..e6c7cbd6 100644 --- a/casbin/rbac/default_role_manager/role_manager.py +++ b/casbin/rbac/default_role_manager/role_manager.py @@ -1,3 +1,17 @@ +# 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. + import logging from collections import namedtuple from enum import Enum diff --git a/casbin/rbac/role_manager.py b/casbin/rbac/role_manager.py index 9c1cefc4..09153e7a 100644 --- a/casbin/rbac/role_manager.py +++ b/casbin/rbac/role_manager.py @@ -1,3 +1,18 @@ +# 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. + + class RoleManager: """provides interface to define the operations for managing roles.""" diff --git a/casbin/synced_enforcer.py b/casbin/synced_enforcer.py index c1180360..716e9680 100644 --- a/casbin/synced_enforcer.py +++ b/casbin/synced_enforcer.py @@ -1,3 +1,17 @@ +# 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. + import threading import time diff --git a/casbin/util/__init__.py b/casbin/util/__init__.py index 92b6317c..f1cb7fab 100644 --- a/casbin/util/__init__.py +++ b/casbin/util/__init__.py @@ -1,3 +1,17 @@ +# 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. + from .builtin_operators import * from .expression import * from .util import * diff --git a/casbin/util/builtin_operators.py b/casbin/util/builtin_operators.py index cf478864..5541974a 100644 --- a/casbin/util/builtin_operators.py +++ b/casbin/util/builtin_operators.py @@ -1,3 +1,17 @@ +# 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. + import ipaddress import re diff --git a/casbin/util/expression.py b/casbin/util/expression.py index 6f519c63..350f6f11 100644 --- a/casbin/util/expression.py +++ b/casbin/util/expression.py @@ -1,3 +1,17 @@ +# 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. + from simpleeval import EvalWithCompoundTypes import ast diff --git a/casbin/util/rwlock.py b/casbin/util/rwlock.py index 105312e1..0c0355df 100644 --- a/casbin/util/rwlock.py +++ b/casbin/util/rwlock.py @@ -1,3 +1,17 @@ +# 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. + from threading import RLock, Condition # This implementation was adapted from https://en.wikipedia.org/wiki/Readers%E2%80%93writer_lock diff --git a/casbin/util/util.py b/casbin/util/util.py index 3003af67..9b817604 100644 --- a/casbin/util/util.py +++ b/casbin/util/util.py @@ -1,3 +1,17 @@ +# 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. + from collections import OrderedDict import re diff --git a/setup.py b/setup.py index 86fb8896..d13f3b9f 100644 --- a/setup.py +++ b/setup.py @@ -1,3 +1,17 @@ +# 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. + import setuptools from os import path diff --git a/tests/__init__.py b/tests/__init__.py index e69de29b..dcfb1ee3 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -0,0 +1,13 @@ +# 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. diff --git a/tests/benchmarks/__init__.py b/tests/benchmarks/__init__.py index e69de29b..dcfb1ee3 100644 --- a/tests/benchmarks/__init__.py +++ b/tests/benchmarks/__init__.py @@ -0,0 +1,13 @@ +# 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. diff --git a/tests/benchmarks/benchmark_model.py b/tests/benchmarks/benchmark_model.py index e0b54fae..5fb17a16 100644 --- a/tests/benchmarks/benchmark_model.py +++ b/tests/benchmarks/benchmark_model.py @@ -1,3 +1,17 @@ +# 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. + import os import casbin diff --git a/tests/config/__init__.py b/tests/config/__init__.py index e69de29b..dcfb1ee3 100644 --- a/tests/config/__init__.py +++ b/tests/config/__init__.py @@ -0,0 +1,13 @@ +# 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. diff --git a/tests/config/test_config.py b/tests/config/test_config.py index c7413f93..96c41bec 100644 --- a/tests/config/test_config.py +++ b/tests/config/test_config.py @@ -1,3 +1,17 @@ +# 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. + import os from casbin.config import Config from unittest import TestCase diff --git a/tests/model/__init__.py b/tests/model/__init__.py index e69de29b..dcfb1ee3 100644 --- a/tests/model/__init__.py +++ b/tests/model/__init__.py @@ -0,0 +1,13 @@ +# 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. diff --git a/tests/model/test_policy.py b/tests/model/test_policy.py index 757c9e53..855eb841 100644 --- a/tests/model/test_policy.py +++ b/tests/model/test_policy.py @@ -1,3 +1,17 @@ +# 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. + from unittest import TestCase from casbin.model import Model diff --git a/tests/rbac/__init__.py b/tests/rbac/__init__.py index e69de29b..dcfb1ee3 100644 --- a/tests/rbac/__init__.py +++ b/tests/rbac/__init__.py @@ -0,0 +1,13 @@ +# 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. diff --git a/tests/rbac/test_role_manager.py b/tests/rbac/test_role_manager.py index 8c3fe929..9e0327ef 100644 --- a/tests/rbac/test_role_manager.py +++ b/tests/rbac/test_role_manager.py @@ -1,3 +1,17 @@ +# 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. + from unittest import TestCase from casbin.rbac import default_role_manager from casbin.util import regex_match_func diff --git a/tests/test_distributed_api.py b/tests/test_distributed_api.py index 9704dab6..84ef9900 100644 --- a/tests/test_distributed_api.py +++ b/tests/test_distributed_api.py @@ -1,3 +1,17 @@ +# 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. + import casbin from tests.test_enforcer import get_examples, TestCaseBase diff --git a/tests/test_enforcer.py b/tests/test_enforcer.py index 284c8756..45f9022c 100644 --- a/tests/test_enforcer.py +++ b/tests/test_enforcer.py @@ -1,3 +1,17 @@ +# 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. + import os import time from unittest import TestCase diff --git a/tests/test_filter.py b/tests/test_filter.py index 72dfce54..6633b229 100644 --- a/tests/test_filter.py +++ b/tests/test_filter.py @@ -1,3 +1,17 @@ +# 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. + import casbin from unittest import TestCase from tests.test_enforcer import get_examples diff --git a/tests/test_frontend.py b/tests/test_frontend.py index 8ffdf73b..cfe1f6cb 100644 --- a/tests/test_frontend.py +++ b/tests/test_frontend.py @@ -1,3 +1,17 @@ +# 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. + import json import re import casbin diff --git a/tests/test_management_api.py b/tests/test_management_api.py index 812c769e..7bcfcd2b 100644 --- a/tests/test_management_api.py +++ b/tests/test_management_api.py @@ -1,3 +1,17 @@ +# 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. + from functools import partial import casbin diff --git a/tests/test_rbac_api.py b/tests/test_rbac_api.py index 01d21492..62c18b30 100644 --- a/tests/test_rbac_api.py +++ b/tests/test_rbac_api.py @@ -1,3 +1,17 @@ +# 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. + import casbin from tests.test_enforcer import get_examples, TestCaseBase diff --git a/tests/util/__init__.py b/tests/util/__init__.py index e69de29b..dcfb1ee3 100644 --- a/tests/util/__init__.py +++ b/tests/util/__init__.py @@ -0,0 +1,13 @@ +# 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. diff --git a/tests/util/test_builtin_operators.py b/tests/util/test_builtin_operators.py index 533861c2..e981f8e8 100644 --- a/tests/util/test_builtin_operators.py +++ b/tests/util/test_builtin_operators.py @@ -1,3 +1,17 @@ +# 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. + from unittest import TestCase from casbin import util diff --git a/tests/util/test_rwlock.py b/tests/util/test_rwlock.py index f7309f8f..d4a248a6 100644 --- a/tests/util/test_rwlock.py +++ b/tests/util/test_rwlock.py @@ -1,3 +1,17 @@ +# 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. + from unittest import TestCase from casbin.util.rwlock import RWLockWrite from concurrent.futures import ThreadPoolExecutor diff --git a/tests/util/test_util.py b/tests/util/test_util.py index 0b4be0e4..c60ff230 100644 --- a/tests/util/test_util.py +++ b/tests/util/test_util.py @@ -1,3 +1,17 @@ +# 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. + from unittest import TestCase from casbin import util