Home - Supermood/ngRights GitHub Wiki

ngRights wiki

ngRights is a library that allows you to easily add feature-toggling, RBAC and ABAC policies to your front-end.

On this page, you will find the wiki plan, how to quickstart, how to contribute and the project's timeline.

Plan

  • [Installation & Configuration](Installation & Configuration) : how to install & configuration options for ngRights
  • [ngRights directive](ngRights directive) : how to use ng-rights and implement feature-toggling, RBAC and ABAC
  • [ngRights service](ngRights service) : how to use ngRights to execute JavaScript code conditionally
  • [Rule structure](Rule structure) : how rules and rulesets are defined

Use cases

You should use ngRights when

  • You want to have clearer HTML code
  • You want more control on DOM elements than based on roles
  • You want to visually remove links / buttons that will not result in successful routing / actions
  • You want to personalize the appearance of your website depending on the context (different interfaces & rights for different clients) while not duplicating code or adding complexity in the html.

Quickstart

If you want to start in three steps, here's the section for you.

1. Install the library

bower install ngRights

2. Define rights

app.config(['ngRightsProvider', function(ngRightsProvider) {
  ngRightsProvider.setRights({
    page: {
      post: {
        create: function(subject, page) { return page.ownerId == subject.id; }
      }
    }
  });
}]);

3. Use ngRights

<div ng-controller="PageController">
  <h1>{{ page.title }}</h1>
  <button ng-rights="pages.posts.create(page)">Create new post</button>
  <div ng-repeat="post in page.posts">
    {{ post.title }}
  </div>
</div>

Contributing

You are welcome to contribute in any way you want. Add issues, create pull requests...

Before adding a feature, please add it as an issue so that it can be discussed.

Timeline

2016 / 03 / 01 : Release of the first version of the library

2016 / 02 / 15 : Release of a beta of the library

2016 / 01 / 31 : First version of the documentation finished. This will serve as the specification.

⚠️ **GitHub.com Fallback** ⚠️