-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Grammar support and custom theme
- Loading branch information
Showing
22 changed files
with
456 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Dependabot configuration: | ||
# https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/configuration-options-for-dependency-updates | ||
|
||
version: 2 | ||
updates: | ||
# Maintain dependencies for Gradle dependencies | ||
- package-ecosystem: "gradle" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" | ||
# Maintain dependencies for GitHub Actions | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,63 @@ | ||
# openfga4intellij | ||
# OpenFGA plugin for JetBrain IDEs | ||
|
||
This is the official IntelliJ plugin for [OpenFGA](https://openfga.dev/) [language for authorization models](https://openfga.dev/docs/configuration-language). | ||
|
||
This is an unofficial IntelliJ plugin for [OpenFGA](https://openfga.dev/) support. | ||
[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://github.com/openfga/vscode-ext/blob/main/LICENSE) | ||
[![Join our community](https://img.shields.io/badge/slack-cncf_%23openfga-40abb8.svg?logo=slack)](https://openfga.dev/community) | ||
[![Twitter](https://img.shields.io/twitter/follow/openfga?color=%23179CF0&logo=twitter&style=flat-square "@openfga on Twitter")](https://twitter.com/openfga) | ||
|
||
|
||
## Features | ||
## About | ||
|
||
* _Partial_ DSL syntax support (associated with `.fga` and `.openfga` file extensions) | ||
[OpenFGA](https://openfga.dev) is an open source Fine-Grained Authorization solution inspired by [Google's Zanzibar paper](https://research.google/pubs/pub48190/). It was created by the FGA team at [Auth0](https://auth0.com) based on [Auth0 Fine-Grained Authorization (FGA)](https://fga.dev), available under [a permissive license (Apache-2)](https://github.com/openfga/rfcs/blob/main/LICENSE) and welcomes community contributions. | ||
|
||
OpenFGA is designed to make it easy for application builders to model their permission layer, and to add and integrate fine-grained authorization into their applications. OpenFGA’s design is optimized for reliability and low latency at a high scale. | ||
|
||
## Resources | ||
|
||
- [OpenFGA Documentation](https://openfga.dev/docs) | ||
- [OpenFGA API Documentation](https://openfga.dev/api/service) | ||
- [OpenFGA on Twitter](https://twitter.com/openfga) | ||
- [OpenFGA Community](https://openfga.dev/community) | ||
- [Zanzibar Academy](https://zanzibar.academy) | ||
- [Google's Zanzibar Paper (2019)](https://research.google/pubs/pub48190/) | ||
|
||
|
||
## Installation | ||
|
||
### Manual Installation | ||
|
||
![manual_install.png](docs/manual_install.png) | ||
|
||
## Usage | ||
|
||
* DSL syntax support (associated with `.fga` and `.openfga` file extensions) | ||
![syntax.png](docs/syntax.png) | ||
* DSL syntax injection for YAML store files (associated with `.fga.yaml` and `.openfga.yaml` file extensions) | ||
![store_syntax.png](docs/store_syntax.png) | ||
* Authorization model dsl file template | ||
* Authorization model dsl live templates | ||
* Generate json file from DSL (requires [OpenFGA CLI](https://github.com/openfga/cli) to be installed) | ||
![cli_setup.png](docs/cli_setup.png) | ||
* Configure servers in OpenFGA tool window | ||
![server_setup.png](docs/server_setup.png) | ||
|
||
## Roadmap | ||
|
||
A rough [roadmap](https://github.com/orgs/openfga/projects/1) for development priorities. | ||
|
||
## Contributing | ||
|
||
See the [DEVELOPMENT](./docs/DEVELOPMENT.md) and [CONTRIBUTING](https://github.com/openfga/.github/blob/main/CONTRIBUTING.md). | ||
|
||
## Author | ||
|
||
[OpenFGA](https://github.com/openfga) | ||
|
||
## Acknowledgments | ||
|
||
A special thanks to [Yann D'Isanto](https://github.com/le-yams) for the contribution of [their codebase](https://github.com/le-yams/openfga4intellij), which this project is built upon. | ||
|
||
## License | ||
|
||
This project is licensed under the Apache-2.0 license. See the [LICENSE](https://github.com/openfga/vscode-ext/blob/main/LICENSE) file for more info. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Development and Contributing to the OpenFGA VS Code Extension | ||
|
||
Read the [OpenFGA Contribution Process](https://github.com/openfga/.github/blob/main/CONTRIBUTING.md) and the [OpenFGA Code of Conduct](https://github.com/openfga/.github/blob/main/CODE_OF_CONDUCT.md). | ||
|
||
## Getting Started | ||
|
||
### Run Build & tests | ||
|
||
```./gradlew build``` | ||
|
||
## Distribution (Optional) | ||
|
||
To generate an installable build of this plugin, you can do the following: | ||
|
||
```./gradlew buildPlugin``` | ||
|
||
[Instructions for installation from disk](https://www.jetbrains.com/help/idea/managing-plugins.html#install_plugin_from_disk) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
src/main/java/com/github/le_yams/openfga4intellij/inject/OpenFGAYamlInjector.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package com.github.le_yams.openfga4intellij.inject; | ||
|
||
import com.github.le_yams.openfga4intellij.OpenFGALanguage; | ||
import com.intellij.lang.injection.MultiHostInjector; | ||
import com.intellij.lang.injection.MultiHostRegistrar; | ||
import com.intellij.psi.ElementManipulators; | ||
import com.intellij.psi.PsiElement; | ||
import com.intellij.psi.PsiLanguageInjectionHost; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.yaml.psi.YAMLKeyValue; | ||
import org.jetbrains.yaml.psi.YAMLScalarList; | ||
|
||
import java.util.List; | ||
|
||
public class OpenFGAYamlInjector implements MultiHostInjector { | ||
@Override | ||
public void getLanguagesToInject(@NotNull MultiHostRegistrar registrar, | ||
@NotNull PsiElement context) { | ||
|
||
if (!(context instanceof YAMLKeyValue && shouldInject(context))) { | ||
return; | ||
} | ||
|
||
PsiLanguageInjectionHost host = (PsiLanguageInjectionHost) ((YAMLKeyValue) context).getValue(); | ||
registrar.startInjecting(OpenFGALanguage.INSTANCE); | ||
registrar.addPlace(null, null, host, ElementManipulators.getValueTextRange(host)); | ||
registrar.doneInjecting(); | ||
} | ||
|
||
private boolean shouldInject(PsiElement context) { | ||
return context instanceof YAMLKeyValue && | ||
(context.getContainingFile().getName().endsWith("fga.yaml") || | ||
context.getContainingFile().getName().endsWith("openfga.yaml")) && | ||
((YAMLKeyValue) context).getValue() instanceof YAMLScalarList && | ||
((YAMLKeyValue) context).getKeyText().equals("model"); | ||
} | ||
|
||
@Override | ||
public @NotNull List<? extends Class<? extends PsiElement>> elementsToInjectIn() { | ||
return List.of(YAMLKeyValue.class); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.