Comments (6)
It should be checked, are you setting your permissions inside the data
property?
El El Sat, Apr 11, 2015 a las 8:02 PM, jelkevdh [email protected]
escribió:
Hi,
I'm trying this module and it looks pretty nice :)
A bit further in, I noticed that if I set the permission on an abstract
parent state, it is not checked.
Is this behavior not supported, or am I doing it wrong?Thanks,
Jelke—
Reply to this email directly or view it on GitHub
#58.
from angular-permission.
Wow, thanks for the fast reply!
Yes I am. I think I'm doing it right.
Some code snipets:
myApp.run(
[ '$rootScope', '$state', '$stateParams', 'Permission',
function ($rootScope, $state, $stateParams, Permission) {
Permission.defineRole('anonymous', function() {
return true;
});
Permission.defineRole('admin', function() {
return false;
});
}
]
);
myApp
.config(['$stateProvider', '$urlRouterProvider', function ($stateProvider, $urlRouterProvider) {
// State Configurations
$stateProvider
// Login Page
.state("login", {
data: {
permissions: {
only: ['anonymous'],
redirectTo: 'auth.home'
}
},
page_title: 'Login Page',
url: "/login",
templateUrl: 'views/login.html',
controller: 'loginCtrl'
})
// Authenticated
.state("auth", {
abstract: true,
url: "",
date: {
permissions: {
only: ['admin'],
redirectTo: 'login'
}
},
templateUrl: 'views/authenticated.html'
})
// Dashboard
.state("auth.home", {
// this state page title
page_title: 'Dashboard',
// this state url
url: "/",
templateUrl: 'views/dashboard.html',
data: {
ncyBreadcrumbLabel: 'Home'
},
controller: 'dashboardCtrl'
})
from angular-permission.
Hmm I see, I'll look into this I can't remember if this is expected
behavior and I'm not near my computer right now.
Cheers!
El sáb., 11 de abril de 2015 a las 20:09, jelkevdh (<
[email protected]>) escribió:
Wow, thanks for the fast reply!
Yes I am. I think I'm doing it right.
Some code snipets:Permission.defineRole('anonymous', function() {
return true;
});
Permission.defineRole('admin', function() {
return false;
});myApp
.config(['$stateProvider', '$urlRouterProvider', function ($stateProvider,
$urlRouterProvider) {
// State Configurations
$stateProvider
// Login Page
.state("login", {
data: {
permissions: {
only: ['anonymous'],
redirectTo: 'auth.home'
}
},
page_title: 'Login Page',
url: "/login",
templateUrl: 'views/login.html',
controller: 'loginCtrl'
})
// Authenticated
.state("auth", {
abstract: true,
url: "",
date: {
permissions: {
only: ['admin'],
redirectTo: 'login'
}
},
templateUrl: 'views/authenticated.html'
})
// Dashboard
.state("auth.home", {
// this state page title
page_title: 'Dashboard',
// this state url
url: "/",
templateUrl: 'views/dashboard.html',
data: {
ncyBreadcrumbLabel: 'Home'
},
controller: 'dashboardCtrl'
})—
Reply to this email directly or view it on GitHub
#58 (comment)
.
from angular-permission.
Ok thanks
from angular-permission.
Oh it's a duplicate of issue #13 :|
from angular-permission.
Oooooh, yes, sorry I was not very focused at the moment I read this. we're waiting for ui-team to provide the route options on events.
Closing since its a dupe.
from angular-permission.
Related Issues (20)
- resolve function in state provider problem HOT 2
- Disabling Angular UI bootsrap element.
- angular-ui-router is deprecated in lieu of @uirouter/angularjs HOT 3
- Set up roles and permissions after authentication HOT 2
- permission-sref with dynamic access HOT 1
- PermPermissionStore has no method define Permission
- How to add permission-only dynamically? HOT 5
- A different approach for ng-if HOT 4
- permissions context
- Pass parameter inside a permission-on-authorized function
- How to get current user Roles on services? HOT 1
- Any example of defining Permission before permission.ui load HOT 1
- UI-Router 1.x HOT 4
- permission-sref state params
- $q.any is not a function (Lazyloading angular modules using webpack) HOT 2
- Where the API?
- where i should store session and store after login ?? (Can you give example)
- How to do asynchronous task when defining a permission
- State params not passed to signin state HOT 2
- no $stateChangePermissionStart after upgrading to @uirouter/angularjs && angular-permission 5.3.2 HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from angular-permission.