Buy

This Chapter isn't quite ready yet

Rest assured, the gnomes are hard at work on completing this video

Coming soon...

There are two main places where you can deny access. The first one we just learned about it is access control. This is super easy because it's all done with regular expressions and this is a great way to protect entire areas of your site, like everything under slash admin with roll underscore admin, so I do use access control, but most of the time I want to deny access on a more granular level. I want to, for example, open controller, comment admin controller. I usually deny access right inside of my controller so that I can specify exactly exactly which role I want to use for this right now so we can see if these things are so we can test. If this isn't working, I'm going to comment out our new access control though I might actually keep it real application and then go back to your common APP chiller. So how can we deny access inside of controller? Oh, so easy. This arrow tonight access, unless granted, pass this role underscore Adam. That's it. Move over, refresh

and access denied. If you want to give a note to make sure that's really working, we'll change it to roll user. If we rush and it works now, as easy as it deny access, unless grants in is I actually prefer to use annotations, let's check us out. We can delete or deny access. Less granted. Up here we're going to say at is granted to get an annotation that comes from framework, extra bundle, which is a bundle that you should already have installed. We already have installed because we installed the annotation support inside here, double quotes, we just say roll underscore admin. That's it. Dried out, refresh and done access denied by controller annotation, pretty sweet, but the really cool thing is then in addition to putting his granted above the controller method, you can put it above the controller class, so above common admin controller at ACC is granted role admin. Now, every single method inside of this controller, which is only one right now, will require this role. You're fresh to that. You get the same error. That is an awesome way to deny access.

There are two main places where you can deny access. The first one we just learned about it is access control. This is super easy because it's all done with regular expressions and this is a great way to protect entire areas of your site, like everything under slash admin with roll underscore admin, so I do use access control, but most of the time I want to deny access on a more granular level. I want to, for example, open controller, comment admin controller. I usually deny access right inside of my controller so that I can specify exactly exactly which role I want to use for this right now so we can see if these things are so we can test. If this isn't working, I'm going to comment out our new access control though I might actually keep it real application and then go back to your common APP chiller. So how can we deny access inside of controller? Oh, so easy. This arrow tonight access, unless granted, pass this role underscore Adam. That's it. Move over, refresh

and access denied. If you want to give a note to make sure that's really working, we'll change it to roll user. If we rush and it works now, as easy as it deny access, unless grants in is I actually prefer to use annotations, let's check us out. We can delete or deny access. Less granted. Up here we're going to say at is granted to get an annotation that comes from framework, extra bundle, which is a bundle that you should already have installed. We already have installed because we installed the annotation support inside here, double quotes, we just say roll underscore admin. That's it. Dried out, refresh and done access denied by controller annotation, pretty sweet, but the really cool thing is then in addition to putting his granted above the controller method, you can put it above the controller class, so above common admin controller at ACC is granted role admin. Now, every single method inside of this controller, which is only one right now, will require this role. You're fresh to that. You get the same error. That is an awesome way to deny access.

Leave a comment!