From 9fdb91243caa95c7b29f8ad056113a454f2e72d8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 28 Dec 2025 08:41:34 +0000 Subject: [PATCH 1/3] Initial plan From 7763e60411497a18feb519bd9857d9727847b27f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 28 Dec 2025 08:44:17 +0000 Subject: [PATCH 2/3] feat(detector): introduce Detector interface and package Co-authored-by: hsluoyz <3787410+hsluoyz@users.noreply.github.com> --- .../org/casbin/jcasbin/detector/Detector.java | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/main/java/org/casbin/jcasbin/detector/Detector.java diff --git a/src/main/java/org/casbin/jcasbin/detector/Detector.java b/src/main/java/org/casbin/jcasbin/detector/Detector.java new file mode 100644 index 00000000..a2064012 --- /dev/null +++ b/src/main/java/org/casbin/jcasbin/detector/Detector.java @@ -0,0 +1,29 @@ +// Copyright 2017 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. + +package org.casbin.jcasbin.detector; + +import org.casbin.jcasbin.rbac.RoleManager; + +/** + * Detector defines the interface of a policy consistency checker, currently used to detect RBAC inheritance cycles. + */ +public interface Detector { + /** + * Checks whether the current status of the passed-in RoleManager contains logical errors (e.g., cycles in role inheritance). + * @param rm RoleManager instance + * @return If an error is found, return a description message; otherwise return null + */ + String check(RoleManager rm); +} From d162d2c8807ece544b2213ccd6d32805673cc2ae Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 28 Dec 2025 08:45:29 +0000 Subject: [PATCH 3/3] fix: update copyright year to 2025 for new file Co-authored-by: hsluoyz <3787410+hsluoyz@users.noreply.github.com> --- src/main/java/org/casbin/jcasbin/detector/Detector.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/casbin/jcasbin/detector/Detector.java b/src/main/java/org/casbin/jcasbin/detector/Detector.java index a2064012..20ab3dc8 100644 --- a/src/main/java/org/casbin/jcasbin/detector/Detector.java +++ b/src/main/java/org/casbin/jcasbin/detector/Detector.java @@ -1,4 +1,4 @@ -// Copyright 2017 The casbin Authors. All Rights Reserved. +// Copyright 2025 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.