New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

ngpermission

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ngpermission

Add authorization to angular route, so restriction route to specific tole becomes so easy.

latest
Source
npmnpm
Version
1.0.8
Version published
Maintainers
1
Created
Source

ngPermission

Add authorization to angular route, so restriction route to specific tole becomes so easy.

Install via bower:

bower install ngPermission

Install via npm:

npm install ngpermission

Add dependency to you module:

angular.module("your app name",["ngPermission"])

Add role permission to route:

.when('/view1', {
        templateUrl: 'view1/view1.html',
        controller: 'View1Ctrl',
        authorizedRole: ['admin']
    })

Resolve if role is present:

.run(['$rootScope', '$http', '$route', function ($rootScope, $http, $route) {
    $rootScope.$on('ngPermission', function (event,roles, defer,routeObject) {
    // do what you want to do
    //role ["admin"]
    //routeObject {templateUrl: 'view1/view1.html',controller: 'View1Ctrl',authorizedRole: ['admin']}
        $http.get('/someUrl').success(function(data){
         var indexRole = roles.indexOf(data.role);
         if(indexRole!=-1){
         defer.resolve();
         }
        });
    });
}])

FAQs

Package last updated on 31 May 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts