# Restricting choice in specific field based on user role

**URL:** <https://forum.getkirby.com/t/restricting-choice-in-specific-field-based-on-user-role/18291>\
**Category:** Questions\
**Tags:** v3\
**Created:** [May 20, 2020, 11:36am UTC](https://forum.getkirby.com/t/restricting-choice-in-specific-field-based-on-user-role/18291 "2020-05-20T11:36:49Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![pixelijn](https://avatars.discourse-cdn.com/v4/letter/p/7ab992/32.png) [@pixelijn](https://forum.getkirby.com/u/pixelijn)\
**Post date:** [May 20, 2020, 12:31pm UTC](https://forum.getkirby.com/t/restricting-choice-in-specific-field-based-on-user-role/18291/6 "2020-05-20T12:31:46Z")

</div>

> [@jbeauviala](#):
>
> ? Isn’t it the same as the index.php hack ?

It is.

If only single blueprints are affected, it is also possible to do this on a per blueprint basis in a plugin.

> [@User permisions for specific page and it's subpages](https://forum.getkirby.com/t/user-permisions-for-specific-page-and-its-subpages/12943/13):
>
> Ok, I just tested this and works perfectly for me. I disabled the default home.yml. Then in my plugin: \<?php if(($user = kirby()-\>user()) && $user-\>role()-\>name() == 'client') { $dir = \_\_DIR\_\_. '/blueprints/client/home.yml'; } else { $dir = \_\_DIR\_\_ . '/blueprints/home.yml'; } Kirby::plugin('texnixe/permissions', ['blueprints' =\> ['pages/home' =\> $dir] ]); And the structure of my plugins folder: [53]

Also: [Bouncer | Kirby CMS](https://getkirby.com/plugins/sylvainjule/bouncer)

Page models that override the `isReadable()` method are another option:

```auto
class NotePage extends Page
{
  
    public function isReadable(): bool
    {
        static $readable = [];

        $template = $this->intendedTemplate()->name();

        if (isset($readable[$template]) === true) {
            return $readable[$template];
        }
        if ($this->author()->toUser() === kirby()->user() || kirby()->user()->role()->name() === 'admin') {
            return true;
        }
        return false;

    }
}

```

---

_[View the full topic](https://forum.getkirby.com/t/restricting-choice-in-specific-field-based-on-user-role/18291)._
