Home - Supermood/ngRights GitHub 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.
- [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
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.
If you want to start in three steps, here's the section for you.
bower install ngRights
app.config(['ngRightsProvider', function(ngRightsProvider) {
ngRightsProvider.setRights({
page: {
post: {
create: function(subject, page) { return page.ownerId == subject.id; }
}
}
});
}]);
<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>
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.
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.