Code Monkey home page Code Monkey logo

casbin-website's Introduction

The site configuration and documentation powering Casbin's website: https://v1.casbin.org

Getting started

Prerequisites

  1. Git
  2. Node: install version 6.2.2 or greater. Node v8 would be ideal.
  3. Yarn: See Yarn Installation
  4. Docusaurus: Run yarn global add docusaurus-init or npm install --global docusaurus-init

Installation

  1. git clone https://github.com/casbin/casbin-website to download source code.
  2. cd casbin-website to go into the project root.
  3. cd website to go into the website portion of the project.
  4. yarn to install the website's npm dependencies (or npm install, if not using Yarn).

Running locally

  1. yarn start to start the development server (powered by Docusaurus) (or npm start, if not using Yarn).
  2. open http://localhost:3000/ to open the site in your favorite browser.

Publish manually (optional)

Whenever a new commit lands in master, the change will be automatically published to: https://v1.casbin.org. However, if you want to deploy the site manually, make sure you have write access to: https://github.com/casbin/casbin.github.io, and use the following instruction:

  1. yarn run publish-gh-pages to publish the site to GitHub pages: https://github.com/casbin/casbin.github.io (aka https://v1.casbin.org).

Overview

If you're here because you would like to contribute an edit or addition to the docs, you'll probably want to take a look at the docs/ directory.

To edit the internals of how the site is built, you may want to get familiarized with how the site is built. The Casbin website is a static site generated using Docusaurus. The website configuration can be found in the website/ directory. Visit the Docusaurus website to learn more about all the available configuration options.

Directory structure

The following is a high-level overview of relevant files and folders.

casbin-website/
├── docs/
│   ├── assets/
│   ├── accessibility.md
│   └── ...
└── website/
    ├── blog/
    │   ├── assets/
    │   ├── 2015-03-26-casbin-bringing-modern-web-techniques-to-mobile.md
    │   └── ...
    ├── core/
    ├── pages/
    │   └── en/
    │       ├── ...
    │       ├── index.js
    │       └── ...
    ├── static/
    │   ├── css/
    │   ├── img/
    │   └── js/
    ├── versioned_docs/
    │   ├── version-0.5/
    │   └── ...
    ├── versioned_sidebars/
    │   ├── version-0.5-sidebars.json
    │   └── ...
    ├── showcase.json
    ├── sidebars.json
    ├── siteConfig.js
    └── versions.json

Documentation sources

As mentioned above, the docs/ folder contains the source files for all of the docs in the Casbin website. In most cases, you will want to edit the files within this directory. If you're adding a new doc or you need to alter the order the docs appear in the sidebar, take a look at the sidebars.json file in the website/ directory. The sidebars file contains a list of document ids that should match those defined in the header metadata (aka frontmatter) of the docs markdown files.

Versioned docs

The Casbin website is versioned as to allow users to go back and see the API reference docs for any given release. A new version of the website is generally made whenever there is a new Casbin release. When this happens, any changes made to the docs/ and website/sidebars.json files will be copied over to the corresponding location within website/versioned_docs/ and website/versioned_sidebars/.

Do not edit the auto-generated files within versioned_docs/ or versioned_sidebars/ unless you are sure it is necessary. Edits made to older versions will not be propagated to newer versions of the docs.

Docusaurus keeps track of the list of versions for the site in the website/versions.json file. The ordering of the versions in this file should be in reverse chronological order.

Cutting a new version

  1. cd casbin-website to go into the project root
  2. cd website to go into the website portion of the project
  3. Run yarn version <version> where <version> is the new version being released.

Website configuration

The main config file for the website can be found at website/siteConfig.js. This file tells Docusaurus how to build the website. Edits to this file are rarely necessary.

The pages/ subdirectory contains the Casbin components that make up the non-documentation pages of the site, such as the homepage.

The showcase.json file contains the list of users that are highlighted in the Casbin showcase.

Contributing

Create a branch

  1. git checkout master from any folder in your local casbin-website repository.
  2. git pull origin master to ensure you have the latest main code.
  3. git checkout -b the-name-of-my-branch (replacing the-name-of-my-branch with a suitable name) to create a branch.

Make the change

  1. Follow the Running locally instructions.
  2. Save the files and check in the browser. Some changes may require a server restart.
  3. Changes to /docs will only be visible in the latest version of the documentation (master).

open http://localhost:3000/casbin/versions.html to see other versions.

Test the change

  1. If possible, test any visual changes in all latest versions of common browsers, on both desktop and mobile.

Push it

  1. Run yarn prettier to ensure your changes are consistent with other files in the repo
  2. git add -A && git commit -m "My message" (replacing My message with a commit message, such as Fixed header logo on Android) to stage and commit your changes
  3. git push my-fork-name the-name-of-my-branch
  4. Go to the casbin-website repo and you should see recently pushed branches.
  5. Follow GitHub's instructions.
  6. If possible, include screenshots of visual changes.

Translation

Crowdin is used for Casbin website's translation. You can contribute to the translation of your proficient languages on that.

Build the translation project locally

Please contact the Casbin team for manager access on Crowdin.

Manually trigger Crowdin [DEPRECATED]

  • Install Crowdin CLI:

https://support.crowdin.com/cli-tool/

  • Setup environment variable:
CROWDIN_DOCUSAURUS_API_KEY = XXX
  • Upload:
crowdin --config ../crowdin.yaml upload sources --auto-update -b master
  • Download:
crowdin --config ../crowdin.yaml download -b master

Noting that the translation of the official website will update after a Pull Request is merged

License

Casbin is Apache licensed.

Casbin documentation is Creative Commons licensed.

casbin-website's People

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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

casbin-website's Issues

collapsing of content

As try dashboard should have some space between the other components

Screenshot:
Screenshot from 2020-02-21 11-51-12

Additional Context:
If this really is a bug, I would like to take this up.

Please add a GBAC example

Would it be possible to implement Graph-based access control with Casbin?

EX: Pattern-matching on the relationship / traversal from subject to object and /or vice versa?

This could enable a simplified ruleset since we could abstract a lot of rules into a smaller number of traversal patterns...

Define all policy effect functions

Matchers has a nice table that describes all (I assume) functions that possible, but policy effect does not. It has a bunch of examples, but no explicit explanation of anything used.

  • some and where are used in examples together, but never defined individually.
  • any is mentioned after the second inverted example, but then said to be used for "all". This is either confusingly written, or incorrect. And then what's the difference between any and some?
  • priority is only used in the Priority example, but never defined anywhere.
  • deny is used as a standalone variable in the Priority example, but not defined. Since policy effect is supposed to define whether a request is accepted, is deny just an alias for false?

Make the documentation language easier to follow

I wrote the initial version of docs. And maybe because I wrote a lot of academic papers in my Ph.D, the current docs writing style looks very academic and hard to follow for engineers.

Will need improvement from a good technical writer that knows how to write attractive articles.

Height of image is not consistent

Capture
In this height of 'Flexible policy storage' image is not consistent with other two images. That's why the text is not at same level.

Responsive issue

There seems to be a responsive issue for some devices like:

  • iPhone 5/SE
  • Galaxy S5

Uploading an image for reference!
image

casbin online editor can not work with "Group with domain model"

Model

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

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

[role_definition]
g = _, _
g2 = _, _, _

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

[matchers]
m = (g(r.sub, p.sub) || g2(r.sub, p.sub, r.dom)) && r.obj == p.obj && r.act == p.act

Policy

p, admin, domain1, data1, read
g, alice, group1
g2, group1, admin, domain1

Expect result:

alice, domain1, data1, read========> true

Actual result

alice, domain1, data1, read=========> false

SpaceX is not using casbin

Hi! Sorry for being a party pooper, but SpaceX Inc is not really using casbin. The commit linked on your site points to github.com/r-spacex, which is described as:

A central location for information and collaboration on all of the awesome projects coming out of r/SpaceX

which is a subreddit. Furthermore upon reading their repo it states that they're not affiliated with SpaceX.

image

Thereby I think your claim of SpaceX using Casbin is incorrect.

[Bug] Incorrect mongodb driver link for Go in adapter documentation

Describe the bug
It's a documentation issue. In the supported adapters table, under Go's description section for mongoDB:

For MongoDB based on MongoDB driver for Go

The driver link points to the old and unofficial mongo driver whereas the adapter uses the latest and official mongo driver

To Reproduce
Steps to reproduce the behavior:

  1. Go to adapters
  2. Click on Go under supported adapters.
  3. Scroll down to MongoDB Adapter
  4. See error in the description section

Expected behavior
The driver link of the description should point to the correct link of the mongo driver used by the adapter.

Not responsive

the site is not responsive in many modes
see the image the casbin name overlapping with Docs

image

Casbin editor does not indicate whitespace errors

Casbin editor (just like Casbin) won't have a true response, if the policy spacing is done with tabs.

Example request:
myuserid, /someurl, GET

This policy will have a false response:
p, user, /someurl, TAB HERE GET
g, myuserid, user

This policy will have a true response:
p, user, /someurl, SPACE HERE GET
g, myuserid, user

As there is a Syntax Validate button in the editor, I recommend you to provide a syntax warning for this validation if there is any wrong whitespacing in the policy.

Dark mode for the website

Feature Request

As someone who uses dark mode everywhere possible, it really sets me back to visit a website with no dark mode. Also its really in the trend now so what do you think?

Languages are contrained to very few languages

Problem Description

The langugaes.js has been contrained to very few languages i.e. Eng,Russian etc. This can be extended into several other languages.

Solution

Extending languages.js to include several other languages like Portuguese etc.

@hsluoyz Any opinion about this?

[Bug] Changing the look of Brand name

Want to prioritize this issue? Try:

issuehunt-to-marktext


Describe the bug
The cabin brand name beside the logo changes its color to blue and gets underlined on hover which looks weird and makes the makes look unattractive.

To Reproduce
Changing the hover features so that the brand logo doesn't get underlined and colored,
Rather, only the cursor changes to a pointer and the brand name redirect to the home page

Expected behavior
the brand name doesn't change it's color on hover and doesn't get underlined but work in the exact same way and redirects every user to the homepage

Screenshots
bef
aft

Desktop (please complete the following information):

  • OS: WINDOWS 10
  • Browser: Chrome

Smartphone (please complete the following information):

  • Device: OnePlus 8T
  • OS: OxygenOS
  • Browser Chrome

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.