GithubHelp home page GithubHelp logo

Comments (6)

RafaelVidaurre avatar RafaelVidaurre commented on May 24, 2024

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.

jelkevdh avatar jelkevdh commented on May 24, 2024

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.

RafaelVidaurre avatar RafaelVidaurre commented on May 24, 2024

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.

jelkevdh avatar jelkevdh commented on May 24, 2024

Ok thanks

from angular-permission.

jelkevdh avatar jelkevdh commented on May 24, 2024

Oh it's a duplicate of issue #13 :|

from angular-permission.

RafaelVidaurre avatar RafaelVidaurre commented on May 24, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.