PHPackages                             sylvainjule/bouncer - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. sylvainjule/bouncer

ActiveKirby-plugin[Authentication &amp; Authorization](/categories/authentication)

sylvainjule/bouncer
===================

Restrict access of a user role to a specific page (and its children) in the panel.

1.2.0(9mo ago)663.4k↓12.5%6[1 issues](https://github.com/sylvainjule/kirby-bouncer/issues)MITPHP

Since Mar 10Pushed 9mo ago3 watchersCompare

[ Source](https://github.com/sylvainjule/kirby-bouncer)[ Packagist](https://packagist.org/packages/sylvainjule/bouncer)[ RSS](/packages/sylvainjule-bouncer/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (1)Versions (14)Used By (0)

Kirby – Bouncer
===============

[](#kirby--bouncer)

Restrict access of a user role to a specific page (and its children) in the panel.

[![bouncer-screenshot](https://user-images.githubusercontent.com/14079751/76368370-4c6ccc00-6330-11ea-92d3-9ac560cf037e.jpg)](https://user-images.githubusercontent.com/14079751/76368370-4c6ccc00-6330-11ea-92d3-9ac560cf037e.jpg)

Overview
--------

[](#overview)

> This plugin is completely free and published under the MIT license. However, if you are using it in a commercial project and want to help me keep up with maintenance, you can consider [making a donation of your choice](https://www.paypal.me/sylvainjl).

- [1. Installation](#1-installation)
- [2. Setup](#2-setup)
- [3. Disclaimer](#3-disclaimer)
- [4. License](#4-disclaimer)

1. Installation
---------------

[](#1-installation)

Download and copy this repository to `/site/plugins/bouncer`

Alternatively, you can install it with composer: `composer require sylvainjule/bouncer`

2. Setup
--------

[](#2-setup)

The intent of this plugin is to limit a user's ability to edit only their Account page + pages (and their children) selected in a *Pages field*.

- First, create a new user role (for example, `/site/blueprints/users/test.yml`)
- Set their permissions, and add a `pages` field:

```
title: Test

permissions:
  access:
    panel: true
    site: true
    settings: false
    languages: false
    users: false
  # ...
  user:
    changeRole: false
    delete: false
    update: false # else a user will be able to edit the page they have access to on their profile

fields:
  canaccess:
    label: 'The user will only be able to access:'
    type: pages
    options: query
    query: site.pages # or any query that suits your needs
```

- In your `site/config/config.php`, tell the plugin which `role => fieldname` associations to use:

```
return [
    'sylvainjule.bouncer.list' => [
        'test' => [ // match the filename without extension of the user blueprint
            'fieldname' => 'canaccess'
        ]
    ]
];
```

### 2.1 Allow additionnal paths

[](#21-allow-additionnal-paths)

In your `site/config/config.php`, you can configure for each `role` some extra paths the user will be able to visit. It can be useful if you have custom panel areas, for example.

```
return [
    'sylvainjule.bouncer.list' => [
        'test' => [ // match the filename without extension of the user blueprint
            'extra' => [
                [
                    'title' => 'Area title',
                    'path'  => '/area-path'
                ]
            ]
        ]
    ]
];
```

### 2.2 Optional page switcher

[](#22-optional-page-switcher)

(beta)

Since 1.0.1 a given user can access different pages. You can remove the `multiple: false` option from the blueprint:

```
# User role blueprint
title: Test

fields:
  canaccess:
    label: 'The user will only be able to access:'
    type: pages
    options: query
    query: site.pages # or any query that suits your needs
```

Add a `bouncernav` section in every page you'd like to display the page switcher on:

```
// Anywhere in any blueprint

(...)
sections:
  bouncernav:
    type: bouncernav
```

Then state in your `config.php` that you want to display the page switcher for a given user role:

```
return [
    'sylvainjule.bouncer.list' => [
        'test' => [
            'fieldname' => 'canaccess',
            'nav' => true
        ]
    ]
];
```

### 2.3 Fallback path

[](#23-fallback-path)

In your `site/config/config.php`, you can configure for each `role` which path to fallback to when the user tries to access a forbidden page. It is optional: if left empty, the first accessible page from the *Pages field* associated to the user's role (`canaccess`, in our example) will be used.

```
return [
    'sylvainjule.bouncer.list' => [
        'test' => [ // match the filename without extension of the user blueprint
            'fallback' => '/fallback-path'
        ]
    ]
];
```

### 2.4 Movable pages

[](#24-movable-pages)

By default, a restricted user will be able to move pages even to pages it cannot access. Kirby calls a `isMovableTo` method to check which pages to disable / enable in the *Move page* dialog, which is declared in the `Page` class and cannot be overwritten globally from the plugin. However if you want to apply the bouncer's restrictions to this page tree and disable restricted pages, the plugin provides a replacement method.

You have to declare a custom [Page model](https://getkirby.com/docs/guide/templates/page-models#overriding-the-page-class) for each page in order to apply it:

```
class ExamplePage extends Page {
    public function isMovableTo(Kirby\Cms\Page|Kirby\Cms\Site $parent): bool {
        return Bouncer::isMovableTo($this, $parent);
    }
};
```

3. Disclaimer
-------------

[](#3-disclaimer)

I needed this functionnality for a website and turned it into a plugin. I hope it can prove helpful, but do not intend to extend it or support more refined restriction scenarios with this plugin.

4. License
----------

[](#4-license)

MIT

###  Health Score

46

—

FairBetter than 93% of packages

Maintenance56

Moderate activity, may be stable

Popularity35

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 70.2% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~179 days

Recently: every ~157 days

Total

12

Last Release

288d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/14079751?v=4)[Sylvain Julé](/maintainers/sylvainjule)[@sylvainjule](https://github.com/sylvainjule)

---

Top Contributors

[![sylvainjule](https://avatars.githubusercontent.com/u/14079751?v=4)](https://github.com/sylvainjule "sylvainjule (40 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (6 commits)")[![distantnative](https://avatars.githubusercontent.com/u/3788865?v=4)](https://github.com/distantnative "distantnative (4 commits)")[![kerli81](https://avatars.githubusercontent.com/u/5836810?v=4)](https://github.com/kerli81 "kerli81 (3 commits)")[![bnomei](https://avatars.githubusercontent.com/u/3265642?v=4)](https://github.com/bnomei "bnomei (2 commits)")[![hlp-pls](https://avatars.githubusercontent.com/u/53251969?v=4)](https://github.com/hlp-pls "hlp-pls (2 commits)")

---

Tags

kirbykirby-pluginpermissionsrestricteduseruser-role

### Embed Badge

![Health badge](/badges/sylvainjule-bouncer/health.svg)

```
[![Health](https://phpackages.com/badges/sylvainjule-bouncer/health.svg)](https://phpackages.com/packages/sylvainjule-bouncer)
```

###  Alternatives

[namshi/jose

JSON Object Signing and Encryption library for PHP.

1.8k99.6M101](/packages/namshi-jose)[league/oauth1-client

OAuth 1.0 Client Library

99698.8M106](/packages/league-oauth1-client)[gesdinet/jwt-refresh-token-bundle

Implements a refresh token system over Json Web Tokens in Symfony

70516.4M35](/packages/gesdinet-jwt-refresh-token-bundle)[league/oauth2-google

Google OAuth 2.0 Client Provider for The PHP League OAuth2-Client

41721.2M118](/packages/league-oauth2-google)[illuminate/auth

The Illuminate Auth package.

9327.3M1.0k](/packages/illuminate-auth)[beatswitch/lock

A flexible, driver based Acl package for PHP 5.4+

870304.7k2](/packages/beatswitch-lock)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
