Giter Club home page Giter Club logo

Comments (7)

tabacitu avatar tabacitu commented on July 30, 2024

Hi @bastha ,

Sure, tell me what doesn't work, so I can help. Please explain what you did, what you expected to happen and what did/did not happen.

Cheers!

from permissionmanager.

bastha avatar bastha commented on July 30, 2024

from permissionmanager.

OwenMelbz avatar OwenMelbz commented on July 30, 2024

You have to handle the permissions yourself, try using middleware. If you search the backpack github issues you'll find lots of people's suggestions how :)

from permissionmanager.

bastha avatar bastha commented on July 30, 2024

from permissionmanager.

tabacitu avatar tabacitu commented on July 30, 2024

Hi @bastha ,

I personally like the recommended middleware by spatie (the ones who created the package that permissionmanager uses): https://github.com/spatie/laravel-permission#using-a-middleware

If you follow their instructions you should be able to quickly create two middleware: role and permission, that you can use in your routes file.

A faster way to create those is coming in the near-future in Backpack. This, in combination with Laravel's 5.4 release, will make it a more powerful and intuitive tool, since you'll be able to specify middleware on each route.

Cheers!

from permissionmanager.

yingdongzhang avatar yingdongzhang commented on July 30, 2024

@bastha

I found that the line

if (Auth::guest()) {
            return redirect($urlOfYourLoginPage);
        }

doesn't really do anything, leaving it there or commenting it out doesn't have any effect. If you have not logged in, you will be directed to the login page anyway, I think Backpack takes care of redirecting guests before they enter this middleware. If you have logged in already, it won't enter the if statement. So I think it is safe to remove the if statement completely.

from permissionmanager.

tabacitu avatar tabacitu commented on July 30, 2024

@yingdongzhang - totally agree.

@bastha , if you haven't figured this out yet, here's the code to my middlewares. Hope it helps.

Cheers!

from permissionmanager.

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.