Coder Social home page Coder Social logo

Comments (15)

bjyoungblood avatar bjyoungblood commented on September 27, 2024

In order to do this, you would want to implement your own view strategy that does not render an HTML error page. The class in question is in UnauthorizedStrategy.php (modifying lines 132-140 will probably get you what you need).

When you create your own view strategy, you can modify the config to use yours instead of the default. See here.

from bjyauthorize.

rhacker avatar rhacker commented on September 27, 2024

Thanks for your quick answer, I will try to implement it too see if I come up with anything :)

from bjyauthorize.

rhacker avatar rhacker commented on September 27, 2024

I've tried to change the ViewModel but it seems that it still returns the application layout html in the response.

from bjyauthorize.

Ocramius avatar Ocramius commented on September 27, 2024

This is supported on controller routes now if you use the HTTP method as action in configuration.

from bjyauthorize.

Ocramius avatar Ocramius commented on September 27, 2024

@rhacker news on this one?

from bjyauthorize.

nXqd avatar nXqd commented on September 27, 2024

@Ocramius Actually, I don't have much time atm so I've tried to implement something on my own and it goes well. But I will look into this plugin later to implement the acl :)

from bjyauthorize.

Ocramius avatar Ocramius commented on September 27, 2024

Closing then, since this was implemented in master

from bjyauthorize.

nXqd avatar nXqd commented on September 27, 2024

Thanks @Ocramius , I haven't your last message clearly. I will try it today and see if it fits with my current application :D
@Ocramius Can you reference me to the commit :D

from bjyauthorize.

localheinz avatar localheinz commented on September 27, 2024

@Ocramius

If using the Guard\Controller how would you be able to differentiate between

  • GET /foo
  • GET /foo/{id}

I'm not so sure at the moment how to implement this using BjyAuthorize. Should I use both Guard\Controller and Guard\Route?

from bjyauthorize.

Ocramius avatar Ocramius commented on September 27, 2024

@localheinz good point. I didn't think about this use case, and that's mainly because I have different controllers for /foo (collection) and /foo/{id}, which are different resources.

I guess it is a limitation for now.

from bjyauthorize.

localheinz avatar localheinz commented on September 27, 2024

@Ocramius

Actually, that's not even that bad an idea! Thanks.

It may seem like a workaround and it may even duplicate some code in the factory layer (because a collection controller might have similar dependencies), but it actually fits the single responsibility principle.

from bjyauthorize.

fiWhy avatar fiWhy commented on September 27, 2024

When i try to get access by POST method i catch an forbidden 403 error. How to fix this?

from bjyauthorize.

Ocramius avatar Ocramius commented on September 27, 2024

@fiWhy unrelated.

from bjyauthorize.

fiWhy avatar fiWhy commented on September 27, 2024

I'm sorry. Wrong question. I'm trying to use module with rest api's methods. In case of using get or getList I have access, but when try to send data I catch a forbidden response. Correctly I asked create and update methods.

from bjyauthorize.

Ocramius avatar Ocramius commented on September 27, 2024

@fiWhy open a new issue with more detailed information to reproduce this, please :-\

from bjyauthorize.

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.