# Logged users only view/edit their own content

**URL:** <https://forum.getkirby.com/t/logged-users-only-view-edit-their-own-content/24732>\
**Category:** Questions\
**Tags:** v3\
**Created:** [February 15, 2022, 9:50am UTC](https://forum.getkirby.com/t/logged-users-only-view-edit-their-own-content/24732 "2022-02-15T09:50:45Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![SimTheGeek](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/simthegeek/32/9381_2.png) [@SimTheGeek](https://forum.getkirby.com/u/SimTheGeek)\
**Post date:** [February 15, 2022, 9:50am UTC](https://forum.getkirby.com/t/logged-users-only-view-edit-their-own-content/24732/1 "2022-02-15T09:50:45Z")

</div>

Hi everyone,  
Plase can you help me please ?  
I want to create a web platform with user roles. It works perfectly !

But I want logged users to only show/edit their owns contents in the panel.

Is it possible ? How to proceed please ?

Thanks a lot !

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [February 15, 2022, 11:33am UTC](https://forum.getkirby.com/t/logged-users-only-view-edit-their-own-content/24732/2 "2022-02-15T11:33:24Z")

</div>

Check out [Going beyond Kirby's permissions features | Kirby CMS](https://getkirby.com/docs/cookbook/extensions/permission-tricks#override-the-isreadable-method-in-a-page-model)

---

<div class="post-metadata">

**Author:** ![SimTheGeek](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/simthegeek/32/9381_2.png) [@SimTheGeek](https://forum.getkirby.com/u/SimTheGeek)\
**Post date:** [February 15, 2022, 1:05pm UTC](https://forum.getkirby.com/t/logged-users-only-view-edit-their-own-content/24732/3 "2022-02-15T13:05:50Z")

</div>

Thanks @texnixe, but it’s only for restricting access to specific user roles no ?

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [February 15, 2022, 4:44pm UTC](https://forum.getkirby.com/t/logged-users-only-view-edit-their-own-content/24732/4 "2022-02-15T16:44:54Z")

</div>

> [@SimTheGeek](#):
>
> but it’s only for restricting access to specific user roles no ?

No, that’s why I pointed you to this method. It allows you to restrict access to individual users, provided a user is assigned to the page(s).

---

<div class="post-metadata">

**Author:** ![SimTheGeek](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/simthegeek/32/9381_2.png) [@SimTheGeek](https://forum.getkirby.com/u/SimTheGeek)\
**Post date:** [February 16, 2022, 9:47am UTC](https://forum.getkirby.com/t/logged-users-only-view-edit-their-own-content/24732/5 "2022-02-16T09:47:56Z")

</div>

Hi,  
Sorry for my misunderstanding… ☹  
And thanks for this perfect trick !

So I made these changes and the “author” field now appears fine in my contents.

![image](https://europe1.discourse-cdn.com/flex017/uploads/getkirby/original/2X/e/ed82abb62888384c6171f9f9ccbcf1543f8e5054.png) ![image](https://europe1.discourse-cdn.com/flex017/uploads/getkirby/original/2X/f/f012669eaf36d00de4c01b601437f78efa1a0b0b.png)

But both authors John and San DOE can still view, access and edit all pages (but not the author owner)… ☹

 ![image](https://europe1.discourse-cdn.com/flex017/uploads/getkirby/original/2X/3/307e5d3280852e561d45aacb6e02b2514fd6b02c.png)

Is there an other specifc variable to set in roles permissions ?

Thanks a lot for your help !

---

<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:** [February 16, 2022, 12:06pm UTC](https://forum.getkirby.com/t/logged-users-only-view-edit-their-own-content/24732/6 "2022-02-16T12:06:13Z")

</div>

Which blueprint does this page use? And does your model use that same name?

---

<div class="post-metadata">

**Author:** ![SimTheGeek](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/simthegeek/32/9381_2.png) [@SimTheGeek](https://forum.getkirby.com/u/SimTheGeek)\
**Post date:** [February 16, 2022, 1:13pm UTC](https://forum.getkirby.com/t/logged-users-only-view-edit-their-own-content/24732/7 "2022-02-16T13:13:41Z")

</div>

Here is the bluprint’s “demande” that I use :

 ![Sans titre-1](https://europe1.discourse-cdn.com/flex017/uploads/getkirby/original/2X/5/550d1964b9e0a72d6268a939a96e3c39c77a5019.jpeg)

And the correspondig model :

 ![Sans titre-2](https://europe1.discourse-cdn.com/flex017/uploads/getkirby/original/2X/c/c765bf673e4aa75effe6b0558123603794a2e124.jpeg)

So annoying… 😭

---

<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:** [February 16, 2022, 1:18pm UTC](https://forum.getkirby.com/t/logged-users-only-view-edit-their-own-content/24732/8 "2022-02-16T13:18:25Z")

</div>

Could you show what is in your model, please?

---

<div class="post-metadata">

**Author:** ![SimTheGeek](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/simthegeek/32/9381_2.png) [@SimTheGeek](https://forum.getkirby.com/u/SimTheGeek)\
**Post date:** [February 16, 2022, 1:31pm UTC](https://forum.getkirby.com/t/logged-users-only-view-edit-their-own-content/24732/9 "2022-02-16T13:31:37Z")

</div>

Sure, here is the **/site/models/demande.php** code :

```auto
<?php

use Kirby\Cms\Page;

class NotePage extends Page

{

  public function isReadable(): bool

  {

    if (($user = $this->author()->toUser()) && $user->is($this->kirby()->user()) ||

        $this->kirby()->user()->isAdmin()) {

      return true;

    }

    return false;

  }

}

```

---

<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:** [February 16, 2022, 1:51pm UTC](https://forum.getkirby.com/t/logged-users-only-view-edit-their-own-content/24732/10 "2022-02-16T13:51:01Z")

</div>

> [@SimTheGeek](#):
>
> `class NotePage extends Page`

Must be `DemandePage extends Page`

---

<div class="post-metadata">

**Author:** ![SimTheGeek](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/simthegeek/32/9381_2.png) [@SimTheGeek](https://forum.getkirby.com/u/SimTheGeek)\
**Post date:** [February 16, 2022, 1:58pm UTC](https://forum.getkirby.com/t/logged-users-only-view-edit-their-own-content/24732/11 "2022-02-16T13:58:36Z")

</div>

What a fool 😖 !! Works perfectly 🤩 👌 👍 🙏 !!  
Thanks a lot @pixelijn and @texnixe !!

---

<div class="post-metadata">

**Author:** ![SimTheGeek](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/simthegeek/32/9381_2.png) [@SimTheGeek](https://forum.getkirby.com/u/SimTheGeek)\
**Post date:** [February 17, 2022, 11:12am UTC](https://forum.getkirby.com/t/logged-users-only-view-edit-their-own-content/24732/12 "2022-02-17T11:12:37Z")

</div>

I have made some changes to my file structure for a better role permissions folder/files edition

![image](https://europe1.discourse-cdn.com/flex017/uploads/getkirby/original/2X/9/9620cf95b67c4863f4e90bb078fc98e0d40112a6.png)

But since, panel don’t work. I have a “no blueprint exists” warning…

Any idea please ?

---

<div class="post-metadata">

**Author:** ![SimTheGeek](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/simthegeek/32/9381_2.png) [@SimTheGeek](https://forum.getkirby.com/u/SimTheGeek)\
**Post date:** [February 17, 2022, 11:13am UTC](https://forum.getkirby.com/t/logged-users-only-view-edit-their-own-content/24732/13 "2022-02-17T11:13:44Z")

</div>

And here is my index.php

```auto
<?php

require __DIR__. '/kirby/bootstrap.php';

$kirby = new Kirby();

$current_user = $kirby->user();

if ( $current_user && $current_user->role() == 'referent' ):

   $kirby = new Kirby([

      'roots' => [

         'blueprints' => __DIR__. '/site/blueprintsreferent',

      ],

   ]);

elseif ( $current_user && $current_user->role() == 'admin' ):

   $kirby = new Kirby([

      'roots' => [

         'blueprints' => __DIR__. '/site/blueprintsadmin',

      ],

   ]);

endif;

echo (new Kirby)->render();

```

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [February 17, 2022, 11:54am UTC](https://forum.getkirby.com/t/logged-users-only-view-edit-their-own-content/24732/14 "2022-02-17T11:54:52Z")

</div>

Now your users blueprints won’t be found anymore. If you do it like this, you have to move all blueprints.

---

<div class="post-metadata">

**Author:** ![SimTheGeek](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/simthegeek/32/9381_2.png) [@SimTheGeek](https://forum.getkirby.com/u/SimTheGeek)\
**Post date:** [February 17, 2022, 3:10pm UTC](https://forum.getkirby.com/t/logged-users-only-view-edit-their-own-content/24732/15 "2022-02-17T15:10:33Z")

</div>

Sorry @texnixe, my kirby’s knowledge is not very advanced and neither is my English’s level…  
You mean I have to put all my files in the blueprints folder without any other sub-folders ?

---

<div class="post-metadata">

**Author:** ![SimTheGeek](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/simthegeek/32/9381_2.png) [@SimTheGeek](https://forum.getkirby.com/u/SimTheGeek)\
**Post date:** [February 17, 2022, 4:09pm UTC](https://forum.getkirby.com/t/logged-users-only-view-edit-their-own-content/24732/16 "2022-02-17T16:09:17Z")

</div>

I restored my files folders tree like this and all works fine !

![image](https://europe1.discourse-cdn.com/flex017/uploads/getkirby/original/2X/0/0dbdccc27dc3a4a0ce2266e6741361e6414831e5.png)

I will create another topic for permissions questions !

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [February 17, 2022, 4:41pm UTC](https://forum.getkirby.com/t/logged-users-only-view-edit-their-own-content/24732/17 "2022-02-17T16:41:10Z")

</div>

Now that we have dynamic blueprints and with the possibility to load blueprints by user, I think I would no longer use this hack with loading Kirby twice or even multiple times as in the example above.

> **[Programmable blueprints](https://getkirby.com/docs/cookbook/panel/programmable-blueprints)**
>
> Create blueprints programmatically with PHP
