# Accessing controller authorization through template View

**URL:** <https://discourse.cakephp.org/t/accessing-controller-authorization-through-template-view/7692>\
**Category:** Need Help\
**Created:** [April 21, 2020, 10:34am UTC](https://discourse.cakephp.org/t/accessing-controller-authorization-through-template-view/7692 "2020-04-21T10:34:22Z")\
**Posts on this page:** 1\
**Showing post:** 12

<div class="post-metadata">

**Author:** ![HypJ3U50N](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/hypj3u50n/32/1803_2.png) [@HypJ3U50N](https://discourse.cakephp.org/u/HypJ3U50N)\
**Post date:** [April 21, 2020, 9:18pm UTC](https://discourse.cakephp.org/t/accessing-controller-authorization-through-template-view/7692/12 "2020-04-21T21:18:16Z")

</div>

the can(…) function is unknown. From the documentation I am not sure if I have to change the UserEntity.php, since I use `$id = $this->request->getAttribute('identity');` instead of` user_id`  
I added `use Authorization\Identity;` to the Application.php since

"_If your application uses the [cakephp/authentication](https://github.com/cakephp/authentication) plugin then the `Authorization\Identity` class will be used. This class implements the Authentication\IdentityInterface` in addition to the Authorization\IdentityInterface_ . "

This seems redundant though, as it states it already will be used automatically?  
I followed the authorization tutorial so it is loaded in my Apllication.php and its middleware function. Although I miss the `ResponseInterface $response` in the public function getAuthorizationService().

So $id is the attribute identity now. What type of object is this?

---

_[View the full topic](https://discourse.cakephp.org/t/accessing-controller-authorization-through-template-view/7692)._
