Skip to content

will7200/casbin-idea-plugin

Repository files navigation

Casbin support for IntelliJ-based IDEs

Build Status Version Downloads

Get it from plugin repository: https://plugins.jetbrains.com/plugin/14809-casbin

Plugin for editing and testing Casbin models in IntelliJ-based IDEs.

Provides:

  • syntax highlighting
  • auto-completion for policy effect definitions and object attributes
  • quick fixes to add missing attributes to models
  • test casbin model using the casbin executor tool window
    • model and policy definitions are watched for changes to automatically update the Casbin Model and execution results

Editor Editor

Casbin Executor Casbin Executor

Installation

  • Using IDE built-in plugin system:

    Preferences > Plugins > Marketplace > Search for "CASBIN" > Install Plugin

  • Manually:

    Download the latest release and install it manually using Preferences > Plugins > ⚙️ > Install plugin from disk...

Development

The plugin is built using Gradle and uses gradle-intellij-plugin to integrate with IntelliJ Platform.

To build a plugin run

$ ./gradlew buildPlugin

Plugin zip file will be created in build/distributions

To test plugin in IDE run ./gradlew runIde

Grammar modifications

The plugin uses Grammar-Kit to generate parser and lexer. Please install Grammar-Kit plugin and refer to the documentation if you want to modify grammar.

Casbin Model Parser & Lexer

  • To regenerate the parser for casbin models, open Casbin.bnf and press Ctrl+Shift+G
  • To regenerate the lexer, open CasbinLexer.flex and press Ctrl+Shift+G

Casbin CSV Parser & Lexer

Contribution

Plugin is written in Kotlin.

Third Party Libraries

Look at ThirdPartyNotices.txt for more information.