Git Product home page Git Product logo

casbin-idea-plugin's Introduction

Hi there ๐Ÿ‘‹

Github Years Github Visits

My name is will and I love building things.

Latest Jetbrains Plugin

Introducing Casbin Plugin for Intellij Products link

I noticed that there weren't any plugins for casbin for the Intellij products line. As an avid user of their product line I found an opportunity to finally write a plugin. Please do checkout it out and any feedback is very much appreciated.

Casbin Executor Tool Window Casbin File Editor
Work Bites Solver App Work Bites Solver App

Latest Web Creation

Introducing Word Bites Solver link

I have been enjoying the new game word-bites on game pigeon. They implemented a new feature that gives all the wordsWorker possible on the game that is really cool. The only downside is that is quite expensive to utilize. So i made this app to help with that. There are multiple dictionary that the user can choose from to filter out the words possible.

Work Bites Solver App

Stats

Github Stats
Github Languages

casbin-idea-plugin's People

Contributors

actions-user avatar tlcoffee avatar will7200 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

casbin-idea-plugin's Issues

Not compatible with 2020.3

Just upgraded to 2020.3 and it marked plugin as not compatible.

IntelliJ IDEA 2020.3 (Ultimate Edition)
Build #IU-203.5981.155, built on November 30, 2020
Runtime version: 11.0.9+11-b1145.21 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 10.15.7
GC: ParNew, ConcurrentMarkSweep
Memory: 1981M
Cores: 8

NullReference Exception on load in CasbinExecutorToolWindow

I get the following exception when loading the plugin, am I missing any prerequisites?

  • Jetbrains Rider: 2023.1.1
  • Casbin Plugin: 0.1.12
java.lang.NullPointerException: Cannot invoke "java.net.URL.toExternalForm()" because "location" is null
	at java.desktop/javax.swing.ImageIcon.<init>(ImageIcon.java:234)
	at io.github.will7200.plugins.casbin.view.ui.CasbinExecutorToolWindow.$$$setupUI$$$(CasbinExecutorToolWindow.java)
	at io.github.will7200.plugins.casbin.view.ui.CasbinExecutorToolWindow.<init>(CasbinExecutorToolWindow.java:32)
	at io.github.will7200.plugins.casbin.view.ui.CasbinExecutorToolWindowImp.<init>(CasbinExecutorToolWindowImp.kt:17)
	at io.github.will7200.plugins.casbin.view.ui.CasbinToolWindowFactory.createToolWindowContent(CasbinToolWindowFactory.kt:16)
	at com.intellij.openapi.wm.impl.ToolWindowImpl.createContentIfNeeded(ToolWindowImpl.kt:548)
	at com.intellij.openapi.wm.impl.ToolWindowImpl.scheduleContentInitializationIfNeeded$intellij_platform_ide_impl(ToolWindowImpl.kt:527)
	at com.intellij.openapi.wm.impl.ToolWindowManagerImpl.doShowWindow(ToolWindowManagerImpl.kt:983)
	at com.intellij.openapi.wm.impl.ToolWindowManagerImpl.showToolWindowImpl(ToolWindowManagerImpl.kt:920)
	at com.intellij.openapi.wm.impl.ToolWindowManagerImpl.activateToolWindow$intellij_platform_ide_impl(ToolWindowManagerImpl.kt:629)
	at com.intellij.openapi.wm.impl.ToolWindowManagerImpl.activateToolWindow$intellij_platform_ide_impl$default(ToolWindowManagerImpl.kt:599)
	at com.intellij.openapi.wm.impl.ToolWindowManagerImpl.activated$intellij_platform_ide_impl(ToolWindowManagerImpl.kt:1979)
	at com.intellij.openapi.wm.impl.SquareAnActionButton.setSelected(SquareStripeButton.kt:156)
	at com.intellij.ui.ToggleActionButton.actionPerformed(ToggleActionButton.java:42)
	at com.intellij.openapi.actionSystem.impl.ActionButton.actionPerformed(ActionButton.java:228)
	at com.intellij.openapi.actionSystem.impl.ActionButton.lambda$performAction$2(ActionButton.java:207)
	at com.intellij.openapi.actionSystem.ex.ActionUtil.performDumbAwareWithCallbacks(ActionUtil.java:356)
	at com.intellij.openapi.actionSystem.impl.ActionButton.performAction(ActionButton.java:207)
	at com.intellij.openapi.actionSystem.impl.ActionButton.processMouseEvent(ActionButton.java:518)
	at java.desktop/java.awt.Component.processEvent(Component.java:6421)
	at java.desktop/java.awt.Container.processEvent(Container.java:2266)
	at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5026)
	at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2324)
	at java.desktop/java.awt.Component.dispatchEvent(Component.java:4854)
	at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4948)
	at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4575)
	at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4516)
	at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2310)
	at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2804)
	at java.desktop/java.awt.Component.dispatchEvent(Component.java:4854)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:790)
	at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:739)
	at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:731)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:97)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:763)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:761)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:760)
	at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.kt:666)
	at com.intellij.ide.IdeEventQueue.dispatchMouseEvent(IdeEventQueue.kt:614)
	at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.kt:569)
	at com.intellij.ide.IdeEventQueue.access$_dispatchEvent(IdeEventQueue.kt:68)
	at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.compute(IdeEventQueue.kt:349)
	at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.compute(IdeEventQueue.kt:348)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:787)
	at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1.invoke(IdeEventQueue.kt:348)
	at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1.invoke(IdeEventQueue.kt:343)
	at com.intellij.ide.IdeEventQueueKt.performActivity$lambda$1(IdeEventQueue.kt:994)
	at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:113)
	at com.intellij.ide.IdeEventQueueKt.performActivity(IdeEventQueue.kt:994)
	at com.intellij.ide.IdeEventQueue.dispatchEvent$lambda$4(IdeEventQueue.kt:343)
	at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:831)
	at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.kt:385)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:207)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:92)

Editor shows error for multiline matcher

For multiline matcher, the editor provided by the plugin shows error on && \ : <expr> expected, got '\'.
The matcher works perfectly fine. The only issue is the error in the editor.

Sample model.conf:

[request_definition]
r = foo, bar, xyz

[policy_definition]
p = foo, bar, xyz, eft

[policy_effect]
e = some(where (p.eft == allow)) && !some(where (p.eft == deny))

[matchers]
m = r.foo == p.foo && \
    r.bar == p.bar && \
    r.xyz == p.xyz

regexMatch, Domain (Tenant) and Group models not giving expected results

Hello @will7200 ,

Just awesome idea to have such plugin in IDEA.
Unfortunately, it seems not quite well functioning.

Casbin policy:

p, alice, domain1, /foo/bar/.+/.+baz.+, GET, allow
p, alice, domain1, /foo/bar/.+/baz$, GET, deny
p, alice, domain1, /foo/bar/.+, GET, allow
p, alice, domain1, /foo/bar.+, GET, deny
p, alice, domain1, /foo/bar$, GET, allow
p, alice, 10.10.10.10, /foo/.+, GET, allow
p, alice, 10.10.10.10, /foo.+, GET, deny
p, alice, domain1, /foo/.+, GET, deny
p, alice, domain1, /foo.+, GET, deny
p, data2_admin, domain1, /foo$, GET, allow
p, alice, domain1, /foo$, GET, deny
p, root, domain1, /foo$, GET, deny
p, alice, domain1, /.+, GET, deny

g, alice, data2_admin, domain1
g, bob, root, domain1

Casbin model:

[request_definition]
r = sub, dom, obj, act

[policy_definition]
p = sub, dom, obj, act, eft

[role_definition]
g = _, _, _

[policy_effect]
e = priority(p.eft) || deny

[matchers]
m = (((r.sub == p.sub) || g(r.sub, p.sub, r.dom)) && r.dom == p.dom && c(r.obj, p.obj) && regexMatch(r.act, p.act)) || (g(r.sub, "root", p.dom) || r.sub == "admin")

Test requests

alice, domain1, /zed, GET
alice, domain1, /zed, POST

alice, domain-10050, /foo, GET
alice, domain1, /foo, GET
data2_admin, domain1, /foo, GET
alice, domain1, /foo-bar, GET
alice, domain1, /foo/zed, GET
alice, domain1, /foo/bar, GET
alice, domain1, /foo/bar-zed, GET
alice, domain1, /foo/bar/zed, GET

alice, domain1, /foo/bar/*/baz-q, GET
alice, domain1, /foo/bar/zed/baz, GET

alice, domain1, /foo/bar/*/*baz*, GET
alice, domain1, /foo/bar/zed/aaa-baz=val, GET

alice, 10.10.10.10, /foo, GET
alice, 10.10.10.10, /foo/bar, GET

root, *, *, *
root, *, *, GET
root, *, *, POST
root, *, *, PUT
root, *, /foo/bar/zed/baz, *
root, *, /foo/bar/zed/aaa-baz=val, *

bob, domain1, /foo, POST
bob, domain1, /foo$, GET
bob, domain1, /foo/bar/baz, GET
bob, domain2, /foo, PUT
bob, domain2, /foo, GET
bob1, domain1, /foo, GET
admin, domain1, /foo-bar, GET
admin, domain10500, /cert, GET

If we'll feed Casbin Editor (https://casbin.org/en/editor) with same input, result from both would not be the same.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.