Skip to content

Add documentation for cycle detection in RBAC#435

Closed
Copilot wants to merge 4 commits intomasterfrom
copilot/update-docs-for-prs-1629-1632
Closed

Add documentation for cycle detection in RBAC#435
Copilot wants to merge 4 commits intomasterfrom
copilot/update-docs-for-prs-1629-1632

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 1, 2026

Documents the Detector interface and DefaultDetector implementation from casbin/casbin PRs #1629 and #1632, which provide cycle detection for role inheritance graphs.

Changes

  • docs/CycleDetection.mdx: New page explaining cycle detection mechanics, usage patterns, performance characteristics, and custom detector implementation
  • docs/RoleManagerApi.mdx: Added cycle detection reference linking to full documentation
  • sidebars.js: Integrated cycle detection under RBAC section

Usage

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

e, _ := casbin.NewEnforcer("model.conf", "policy.csv")
d := detector.NewDefaultDetector()

if err := d.Check(e.GetRoleManager()); err != nil {
    // err describes the cycle: "cycle detected: role_a -> role_b -> role_c -> role_a"
    log.Fatal(err)
}

The detector uses DFS to identify cycles in O(n) time where n is the number of roles and relationships.

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: apache/casbin#1629 and apache/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.

@netlify
Copy link
Copy Markdown

netlify bot commented Jan 1, 2026

Deploy Preview for casbin ready!

Name Link
🔨 Latest commit 2f384a3
🔍 Latest deploy log https://app.netlify.com/projects/casbin/deploys/6956a04e6f54530008860446
😎 Deploy Preview https://deploy-preview-435--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.

@CLAassistant
Copy link
Copy Markdown

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 16:06
Copilot AI and others added 2 commits January 1, 2026 16:26
Co-authored-by: hsluoyz <3787410+hsluoyz@users.noreply.github.com>
Co-authored-by: hsluoyz <3787410+hsluoyz@users.noreply.github.com>
Copilot AI changed the title [WIP] Add documentation for pull requests 1629 and 1632 Add documentation for cycle detection in RBAC Jan 1, 2026
Copilot AI requested a review from hsluoyz January 1, 2026 16:29
@hsluoyz hsluoyz closed this Jan 1, 2026
@hsluoyz hsluoyz deleted the copilot/update-docs-for-prs-1629-1632 branch March 22, 2026 02: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