Skip to content

Document Detector interface and DefaultDetector for RBAC cycle detection#437

Open
Copilot wants to merge 2 commits intomasterfrom
copilot/update-docs-for-prs-1629-1632-again
Open

Document Detector interface and DefaultDetector for RBAC cycle detection#437
Copilot wants to merge 2 commits intomasterfrom
copilot/update-docs-for-prs-1629-1632-again

Conversation

Copy link
Contributor

Copilot AI commented Jan 1, 2026

Adds documentation for PRs #1629 and #1632 which introduced cycle detection for RBAC role inheritance.

Changes

  • Added section "Detecting Cycles in Role Inheritance" to docs/RBAC.mdx covering:

    • The Detector interface for policy consistency checking
    • DefaultDetector implementation using DFS-based cycle detection
    • Usage example with detector.NewDefaultDetector()
    • When to run detection (after policy loads or bulk updates)
    • Extensibility via custom Detector implementations
  • Updated metadata in docs/RBAC.mdx:

    • Added keywords: cycle detection, detector

Example Usage

import (
    "github.com/casbin/casbin/v3"
    "github.com/casbin/casbin/v3/detector"
)

e, _ := casbin.NewEnforcer("model.conf", "policy.csv")
rm := e.GetRoleManager()

det := detector.NewDefaultDetector()
if err := det.Check(rm); err != nil {
    // e.g., "cycle detected: admin -> editor -> reviewer -> admin"
    panic(err)
}

The documentation explains cycle scenarios (e.g., admineditorrevieweradmin) and provides guidance on when to apply detection without adding unnecessary overhead.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/casbin/casbin/pulls/1629
    • Triggering command: /usr/bin/curl curl -s REDACTED (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>[docs] add docs for the PRs: 1629, 1632</issue_title>
<issue_description>Improve the related docs page based on the newly merged PRs: casbin/casbin#1629 and casbin/casbin#1632
You should write high-quality human-like docs for a modern OSS software. Don't write in the GPT-flavor. Don't write too long, keep it tidy docs. Don't use itemized list to describe things like "Use Cases", "Best practice" or "what it can do"
don't change yarn.lock
Don't add too long text, keep it short and to the point
Don't add the docs in a template like one section name and one text paragraph. You need to organize the content to be user-friendly and not boring for users to read
</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@hsluoyz hsluoyz marked this pull request as ready for review January 1, 2026 17:08
@netlify
Copy link

netlify bot commented Jan 1, 2026

Deploy Preview for casbin ready!

Name Link
🔨 Latest commit d3e9840
🔍 Latest deploy log https://app.netlify.com/projects/casbin/deploys/6956aef81190d600086b6b46
😎 Deploy Preview https://deploy-preview-437--casbin.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copilot AI changed the title [WIP] Add documentation for PRs 1629 and 1632 Document Detector interface and DefaultDetector for RBAC cycle detection Jan 1, 2026
Copilot AI requested a review from hsluoyz January 1, 2026 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[docs] add docs for the PRs: 1629, 1632

3 participants