From f90627c569d062058ed8f7d1188346256cd374aa Mon Sep 17 00:00:00 2001 From: Julien Goux Date: Wed, 22 Apr 2015 16:04:23 +0200 Subject: [PATCH 01/16] make package.json NPM compatible Added missing keys to make package.json compatible with NPM installation --- package.json | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index c1ace99..a962395 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,30 @@ { - "dependencies": {}, + "name": "angular-permission", + "version": "0.2.0", + "description": "Route permission and access control as simple as it can get", + "author": { + "name": "Rafael Vidaurre", + "email": "narzerus@gmail.com" + }, + "main": "dist/angular-permission.js", + "repository": { + "type": "git", + "url": "https://github.com/Narzerus/angular-permission.git" + }, + "keywords": [ + "angular", + "permissions", + "roles", + "route" + ], + "license": "MIT", + "bugs": { + "url": "https://github.com/Narzerus/angular-permission/issues" + }, + "homepage": "http://www.rafaelvidaurre.com", + "peerDependencies": { + "ui-router": "^0.2.11" + }, "devDependencies": { "grunt": "^0.4.5", "grunt-contrib-clean": "^0.5.0", From 910f4667e2c857942e4a5e6033fffc259414a1ec Mon Sep 17 00:00:00 2001 From: Julien Goux Date: Wed, 22 Apr 2015 16:07:54 +0200 Subject: [PATCH 02/16] Fix ui-router name --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a962395..ae16575 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ }, "homepage": "http://www.rafaelvidaurre.com", "peerDependencies": { - "ui-router": "^0.2.11" + "angular-ui-router": "^0.2.11" }, "devDependencies": { "grunt": "^0.4.5", From aaca11435d4d1a6cb691d4ae51f428e9f5863a68 Mon Sep 17 00:00:00 2001 From: Shoaib Merchant Date: Tue, 16 Jun 2015 00:45:33 +0530 Subject: [PATCH 03/16] Corrected spelling Thanks for the mention :) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3cf3711..01e4658 100644 --- a/README.md +++ b/README.md @@ -153,7 +153,7 @@ Events Caveats ======= Because of a bug in ui-router, when using `$urlStateProvider.otherwise` we get an **infinite digest** loop error. -A workaround was found by [@shaoibmerchant](https://github.com/shoaibmerchant) and it goes like this: +A workaround was found by [@shoaibmerchant](https://github.com/shoaibmerchant) and it goes like this: ```javascript // Normal usage (creates INFDG error) From 0b4437490426ee2cfda30fec9e8f5d5b209909f4 Mon Sep 17 00:00:00 2001 From: Rafael Vidaurre Date: Thu, 2 Jul 2015 17:40:23 -0300 Subject: [PATCH 04/16] Update package.json --- package.json | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index c1ace99..ab2fe6e 100644 --- a/package.json +++ b/package.json @@ -19,5 +19,29 @@ }, "scripts": { "test": "grunt karma:unit" - } + }, + "name": "angular-permission", + "description": "![alt tag](https://travis-ci.org/Narzerus/angular-permission.svg?branch=master)", + "version": "1.0.6", + "main": "dist/angular-permission.js", + "directories": { + "test": "test" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Narzerus/angular-permission.git" + }, + "keywords": [ + "permission", + "angular", + "routes", + "ui-router", + "access" + ], + "author": "Rafael Vidaurre", + "license": "MIT", + "bugs": { + "url": "https://github.com/Narzerus/angular-permission/issues" + }, + "homepage": "https://github.com/Narzerus/angular-permission#readme" } From fda09eb5d715509501f1bcdcef08b66aef4ed9d6 Mon Sep 17 00:00:00 2001 From: Rafael Vidaurre Date: Tue, 7 Jul 2015 20:58:23 -0300 Subject: [PATCH 05/16] Bump version --- bower.json | 2 +- dist/angular-permission.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bower.json b/bower.json index 0dc244a..52228e9 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "angular-permission", - "version": "0.3.0", + "version": "0.3.1", "authors": [ "Rafael Vidaurre " ], diff --git a/dist/angular-permission.js b/dist/angular-permission.js index e9b4f29..d154b7f 100644 --- a/dist/angular-permission.js +++ b/dist/angular-permission.js @@ -1,7 +1,7 @@ /** * angular-permission * Route permission and access control as simple as it can get - * @version v0.3.0 - 2015-07-07 + * @version v0.3.1 - 2015-07-07 * @link http://www.rafaelvidaurre.com * @author Rafael Vidaurre * @license MIT License, http://www.opensource.org/licenses/MIT From a1768176cf009e1220bd4611fb8c3eeeffef1bf8 Mon Sep 17 00:00:00 2001 From: Rafael Vidaurre Date: Tue, 7 Jul 2015 21:04:01 -0300 Subject: [PATCH 06/16] Update README.md --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index 3df50a6..117bd5d 100644 --- a/README.md +++ b/README.md @@ -140,6 +140,17 @@ For that you can use promises }); }); ``` + +You can also define many roles which share the same validator. This is useful when you have some central service which handles the validation. + +To define many roles which share one validator callback, use `defineManyRoles(, )` + +```javascript + Permission.defineManyRoles(arrayOfRoleNames, function (stateParams, roleName) { + return User.hasRole(roleName); + }); +``` + As you can see, Permission is useful wether you want a role-based access control or a permission-based one, as it allows you to define this behaviour however you want to. From 241f447240eb59480c7e4e5954086bbb84bb1edc Mon Sep 17 00:00:00 2001 From: Rafael Vidaurre Date: Wed, 30 Sep 2015 15:51:22 -0300 Subject: [PATCH 07/16] Bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ae16575..7e587d3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "angular-permission", - "version": "0.2.0", + "version": "0.4.0", "description": "Route permission and access control as simple as it can get", "author": { "name": "Rafael Vidaurre", From 1580787b3d8eed0633fd878280e27535e965da72 Mon Sep 17 00:00:00 2001 From: Rafael Vidaurre Date: Wed, 30 Sep 2015 15:55:09 -0300 Subject: [PATCH 08/16] Bump in bower --- bower.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bower.json b/bower.json index 52228e9..50f91fb 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "angular-permission", - "version": "0.3.1", + "version": "0.4.0", "authors": [ "Rafael Vidaurre " ], From 62064f93c74f2b91ad3c92f85fc56c2f057860e6 Mon Sep 17 00:00:00 2001 From: Rafael Vidaurre Date: Wed, 30 Sep 2015 16:01:08 -0300 Subject: [PATCH 09/16] Update to 1.1.0 because NPM --- bower.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bower.json b/bower.json index 50f91fb..50c5152 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "angular-permission", - "version": "0.4.0", + "version": "1.1.0", "authors": [ "Rafael Vidaurre " ], diff --git a/package.json b/package.json index a671a00..a3b7ddc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "angular-permission", - "version": "0.4.0", + "version": "1.1.0", "description": "Route permission and access control as simple as it can get", "author": { "name": "Rafael Vidaurre", From ad1dec707fc6259af0d73608121364e38191f5b2 Mon Sep 17 00:00:00 2001 From: Rafael Vidaurre Date: Wed, 30 Sep 2015 16:03:34 -0300 Subject: [PATCH 10/16] Fix package json errors --- package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/package.json b/package.json index a3b7ddc..0d975e4 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,6 @@ }, "name": "angular-permission", "description": "![alt tag](https://travis-ci.org/Narzerus/angular-permission.svg?branch=master)", - "version": "1.0.6", "main": "dist/angular-permission.js", "directories": { "test": "test" From 2b62ef2561d942724d07df81ab24b369742aeadb Mon Sep 17 00:00:00 2001 From: Rafael Vidaurre Date: Mon, 12 Oct 2015 22:26:31 -0200 Subject: [PATCH 11/16] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6c03613..5474886 100644 --- a/README.md +++ b/README.md @@ -182,7 +182,7 @@ $urlRouterProvider.otherwise( function($injector) { TODOS: ----- Help fill this list with your feature requests -- More powerful redirection to allow passing state parameters and other useful stuff ui-router provides. Ideas anyone? +- [Waiting for release on `ui-router`'s end] More powerful redirection to allow passing state parameters and other useful stuff ui-router provides. Ideas anyone? - Inheritance (example: 'admin' inherits from 'user') - Role validation caching? From 3c3b3e01f6746f42a07e433a2ece25092e5f2423 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C5=82a=C5=BCej=20Krysiak?= Date: Sat, 7 Nov 2015 12:09:52 +0100 Subject: [PATCH 12/16] Urgent fix: Defining roles is not working for instantiated service --- src/permission.svc.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/permission.svc.js b/src/permission.svc.js index 01e3ecc..8b5803b 100644 --- a/src/permission.svc.js +++ b/src/permission.svc.js @@ -107,7 +107,7 @@ scope where it is defined and therefore can interact with other modules **/ validateRoleDefinitionParams(roleName, validationFunction); - roleValidationConfig[roleName] = validationFunction; + Permission.roleValidations[roleName] = validationFunction; return Permission; }, From 386e202c123ffeb5cbdeb017e33aeec5685cf077 Mon Sep 17 00:00:00 2001 From: Rafael Vidaurre Date: Mon, 9 Nov 2015 15:34:39 -0300 Subject: [PATCH 13/16] Bump version --- bower.json | 2 +- dist/angular-permission.js | 4 ++-- package.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bower.json b/bower.json index 50f91fb..b1c665f 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "angular-permission", - "version": "0.4.0", + "version": "0.4.1", "authors": [ "Rafael Vidaurre " ], diff --git a/dist/angular-permission.js b/dist/angular-permission.js index d154b7f..7022f16 100644 --- a/dist/angular-permission.js +++ b/dist/angular-permission.js @@ -1,7 +1,7 @@ /** * angular-permission * Route permission and access control as simple as it can get - * @version v0.3.1 - 2015-07-07 + * @version v0.4.1 - 2015-11-09 * @link http://www.rafaelvidaurre.com * @author Rafael Vidaurre * @license MIT License, http://www.opensource.org/licenses/MIT @@ -191,7 +191,7 @@ scope where it is defined and therefore can interact with other modules **/ validateRoleDefinitionParams(roleName, validationFunction); - roleValidationConfig[roleName] = validationFunction; + Permission.roleValidations[roleName] = validationFunction; return Permission; }, diff --git a/package.json b/package.json index 7e587d3..c54c9b7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "angular-permission", - "version": "0.4.0", + "version": "0.4.1", "description": "Route permission and access control as simple as it can get", "author": { "name": "Rafael Vidaurre", From 751e7a543daf9e40bf40791a02fd72c2413a3a94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C5=82a=C5=BCej=20Krysiak?= Date: Sat, 7 Nov 2015 12:09:52 +0100 Subject: [PATCH 14/16] Urgent fix: Defining roles is not working for instantiated service --- src/permission.svc.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/permission.svc.js b/src/permission.svc.js index 01e3ecc..8b5803b 100644 --- a/src/permission.svc.js +++ b/src/permission.svc.js @@ -107,7 +107,7 @@ scope where it is defined and therefore can interact with other modules **/ validateRoleDefinitionParams(roleName, validationFunction); - roleValidationConfig[roleName] = validationFunction; + Permission.roleValidations[roleName] = validationFunction; return Permission; }, From fe0c3e4259714238465b6dfe53d413ebfbdc1d51 Mon Sep 17 00:00:00 2001 From: Rafael Vidaurre Date: Mon, 9 Nov 2015 15:34:39 -0300 Subject: [PATCH 15/16] Bump version --- bower.json | 2 +- dist/angular-permission.js | 4 ++-- package.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bower.json b/bower.json index 50c5152..8d4b1ae 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "angular-permission", - "version": "1.1.0", + "version": "1.1.1", "authors": [ "Rafael Vidaurre " ], diff --git a/dist/angular-permission.js b/dist/angular-permission.js index d154b7f..ddfd268 100644 --- a/dist/angular-permission.js +++ b/dist/angular-permission.js @@ -1,7 +1,7 @@ /** * angular-permission * Route permission and access control as simple as it can get - * @version v0.3.1 - 2015-07-07 + * @version v1.1.1 - 2015-11-09 * @link http://www.rafaelvidaurre.com * @author Rafael Vidaurre * @license MIT License, http://www.opensource.org/licenses/MIT @@ -191,7 +191,7 @@ scope where it is defined and therefore can interact with other modules **/ validateRoleDefinitionParams(roleName, validationFunction); - roleValidationConfig[roleName] = validationFunction; + Permission.roleValidations[roleName] = validationFunction; return Permission; }, diff --git a/package.json b/package.json index 0d975e4..43a0f4b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "angular-permission", - "version": "1.1.0", + "version": "1.1.1", "description": "Route permission and access control as simple as it can get", "author": { "name": "Rafael Vidaurre", From 4f67ca159d937942fe3bf6515b36244fb84c29c9 Mon Sep 17 00:00:00 2001 From: Paulo Pacheco Date: Tue, 10 Nov 2015 17:00:05 -0200 Subject: [PATCH 16/16] README updated. --- README.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/README.md b/README.md index 5474886..376b702 100644 --- a/README.md +++ b/README.md @@ -75,6 +75,29 @@ Another thing you can do is set a redirect url to which unauthorized sessions wi }); ``` +Setting directives permissions/roles +------------------------------- + +This is how simple is to set which permission can or not read a html element. + +```html +
+
+

Home

+
    +
  • ADMIN
  • +
  • MODERATOR
  • +
  • EXCEPT_ANONYMOUS
  • +
+
+
+``` + +There are three directives available for use: + +* rp-only +* rp-except +* rp-state Defining roles --------------------------