PHPackages                             jalendport/craft-lockout - 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. [Admin Panels](/categories/admin)
4. /
5. jalendport/craft-lockout

ActiveCraft-plugin[Admin Panels](/categories/admin)

jalendport/craft-lockout
========================

Deploy-safe control panel lockouts for Craft CMS, with bypass permissions and a custom lock screen.

3.0.0(3w ago)53.7k↓47.8%3mitPHPPHP ^8.2CI passing

Since Nov 27Pushed 3w ago2 watchersCompare

[ Source](https://github.com/jalendport/craft-lockout)[ Packagist](https://packagist.org/packages/jalendport/craft-lockout)[ GitHub Sponsors](https://github.com/jalendport)[ RSS](/packages/jalendport-craft-lockout/feed)WikiDiscussions develop Synced 1w ago

READMEChangelog (4)Dependencies (7)Versions (11)Used By (0)

[![Lockout](src/icon.svg)](src/icon.svg)

Lockout
=======

[](#lockout)

Lockout is a Craft CMS plugin that temporarily restricts control panel access during deployments, content freezes, and structural changes. Its database-backed state survives project config application, while permissions and per-environment configuration determine who can enter and how locked-out requests respond.

Features
--------

[](#features)

- **Dedicated utility** — see whether Lockout is enabled, the active environment, and whether the state comes from the database or a config override, then toggle it from one place.
- **Permission-based access** — grant users permission to manage Lockout or bypass it while everyone else remains locked out; administrators always retain access.
- **Deployment-safe state** — the database-backed toggle survives `project-config/apply`, making it suitable for deployment scripts and content freezes.
- **Environment overrides** — force Lockout on or off from `config/lockout.php`; an active override disables the utility toggle and clearly identifies its source.
- **Custom lock screen** — set the headline and message, return either a 403 or 503 response, and optionally render your own template.
- **CLI ready** — enable, disable, or inspect Lockout from deployment scripts, with status output that includes the effective state and its source.

Installation
------------

[](#installation)

### Requirements

[](#requirements)

This plugin requires **Craft CMS 5.0.0 or later** and **PHP 8.2 or later**.

> Using Craft 4? Use the [2.x](https://github.com/jalendport/craft-lockout/tree/craft4) line, which is the Craft 4 release of this plugin.

### Plugin Store

[](#plugin-store)

Log into your control panel and click on 'Plugin Store'. Search for 'Lockout'.

### Composer

[](#composer)

1. Open your terminal and go to your Craft project:

```
cd /path/to/project
```

2. Then tell Composer to load the plugin:

```
composer require jalendport/craft-lockout
```

3. In the Control Panel, go to Settings → Plugins and click the "Install" button for Lockout.

Usage
-----

[](#usage)

### Managing Lockout

[](#managing-lockout)

Open Utilities → Lockout to see the effective state, active environment, and state source. Users with the **Manage Lockout** permission can enable or disable Lockout there; administrators have this permission implicitly.

When `enabled` is set in `config/lockout.php`, the config value takes precedence over the database state. The utility identifies the override and disables its toggle until the override is removed.

### Choosing Who Can Enter

[](#choosing-who-can-enter)

Lockout registers two permissions that can be assigned to users and user groups:

PermissionAllows**Manage Lockout** (`lockout:manage`)View the utility and enable or disable Lockout.**Bypass Lockout** (`lockout:bypass`)Continue using the control panel while Lockout is enabled.Administrators always bypass Lockout. Give **Bypass Lockout** to any user groups that should retain control panel access during a lockout; all other users are shown the configured lock screen.

### CLI

[](#cli)

Lockout provides three console commands for deployment scripts:

```
./craft lockout/lockout/enable
./craft lockout/lockout/disable
./craft lockout/lockout/status
```

The status command reports whether Lockout is enabled and whether the effective state comes from the database or a config override. It exits with `0` when locked and `1` when unlocked, so scripts can branch on the result.

The enabled state is stored separately from project config, so it survives `project-config/apply` during a deployment. This avoids the state-reset behavior that can affect [`craft off`](https://github.com/craftcms/cms/issues/9855) when project config is reapplied.

Configuration
-------------

[](#configuration)

### Settings

[](#settings)

The presentation settings are available from Lockout's plugin settings in the control panel:

SettingConfig keyDescriptionHeadline`headline`The heading shown to locked-out users.Message`message`The supporting message shown below the headline.Status code`statusCode`The HTTP status returned by the lock screen: `403` (Forbidden) or `503` (Service Unavailable). A 503 response also includes a `Retry-After` header when Craft's [`retryDuration`](https://craftcms.com/docs/5.x/reference/config/general.html#retryduration) setting is configured.Custom template`template`An optional site template to render instead of Lockout's stock error page.### Overriding Plugin Settings

[](#overriding-plugin-settings)

Create a [config file](https://craftcms.com/docs/5.x/configure.html#config-files) named `lockout.php` in your project's `config` folder to override Lockout's settings. The file is fully [multi-environment](https://craftcms.com/docs/5.x/configure.html#multi-environment-configs) aware, so each environment can have its own state and presentation. A commented template you can copy is included at [`src/config.php`](src/config.php).

```
