PHPackages                             drago-ex/project-permission - 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. drago-ex/project-permission

ActiveDrago-project-resource[Authentication &amp; Authorization](/categories/authentication)

drago-ex/project-permission
===========================

Component for managing user permissions in a Drago project.

093↑222.6%PHPCI passing

Since Jun 1Pushed 6d agoCompare

[ Source](https://github.com/drago-ex/project-permission)[ Packagist](https://packagist.org/packages/drago-ex/project-permission)[ RSS](/packages/drago-ex-project-permission/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Drago Project Permission
========================

[](#drago-project-permission)

Component for ACL and permission management in a Drago / Nette project.

[![License: MIT](https://camo.githubusercontent.com/fdf2982b9f5d7489dcf44570e714e3a15fce6253e0cc6b5aa61a075aac2ff71b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d79656c6c6f772e737667)](https://github.com/drago-ex/project-permission/blob/main/license)[![PHP version](https://camo.githubusercontent.com/d1fa62dc60f899cf36d067a167e24a8247b23d93989f7d0158533f666daa8160/68747470733a2f2f62616467652e667572792e696f2f70682f647261676f2d657825324670726f6a6563742d7065726d697373696f6e2e737667)](https://badge.fury.io/ph/drago-ex/project-permission)

Requirements
------------

[](#requirements)

- PHP &gt;= 8.3
- Nette Framework
- Composer
- Bootstrap
- Naja
- Node.js
- Drago Project core packages

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

[](#installation)

```
composer require drago-ex/project-permission
```

Project files
-------------

[](#project-files)

File copying is handled automatically by [drago-ex/project-tools](https://github.com/drago-ex/project-tools), which must be installed in your project. Without it, copy the files manually according to the `copy` section in this package's `composer.json`. To skip this package, set `"skip": true` under `extra.drago-project.packages.` in your root `composer.json`.

After installation, run the package migrations, load the provided service configuration, register the Naja extension from `assets/permission-toggle.js` and include styles from `assets/permission-togle.scss`.

Example:

```
import naja from 'naja';
import PermissionToggle from 'drago-ex/project-permission/assets/permission-toggle';
import 'drago-ex/project-permission/assets/permission-toggle.scss';

naja.registerExtension(new PermissionToggle());
```

What it does
------------

[](#what-it-does)

- manages **roles**
- assigns **multiple roles to users**
- manages **resource + privilege** records
- allows role permissions to be toggled in the admin UI
- builds a Nette `Permission` ACL from registered providers and database data

The package ships with an admin section for:

- **Users** - assign roles to existing users
- **Roles** - create, edit and delete custom roles
- **Permissions** - allow or deny access for a selected role

System roles such as `admin`, `user` and `guest` are handled as protected base roles.

Database
--------

[](#database)

The package works with these tables:

- `roles`
- `users_roles`
- `resources`
- `authorization`

Seed migrations also add default roles and AccessControl permissions for the backend module.

Integration with project-auth
-----------------------------

[](#integration-with-project-auth)

[`UserRepository`](https://github.com/drago-ex/project-auth/blob/main/resources/app/UI/Backend/Sign/User/UserRepository.php#L58)fill in the body of the prepared `getRolesByUser()` method:

```
public function getRolesByUser(int $userId): array
{
	$roles = $this->getConnection()
		->select('r.*')->from(RolesEntity::Table)->as('r')
		->innerJoin(UsersRolesEntity::Table)->as('ur')->on('ur.role_id = r.id')
		->where('ur.%n = ?', UsersRolesEntity::ColumnUserId, $userId)
		->fetchPairs(value: RolesEntity::ColumnName);

	$roles = array_values($roles);
	return $roles ?: [\Drago\Permission\Role::RoleUser];
}
```

Database migration
------------------

[](#database-migration)

-

```
php vendor/bin/migration db:migrate vendor/drago-ex/project-permission/migrations
```

Automated setup
---------------

[](#automated-setup)

This package exposes setup commands in `composer.json` under `extra.drago-project.commands`. If [drago-ex/project-tools](https://github.com/drago-ex/project-tools) is installed, you can run them from the project root:

```
php vendor/bin/drago-setup
```

**Important Note on Migrations:**The migrations in this package depend on the `users` table. If you are not using the automated `drago-setup` tool, ensure that you run the migrations from **`drago-ex/project-auth`** first to create the necessary foreign key targets.

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance64

Regular maintenance activity

Popularity14

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity11

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5998929?v=4)[Zdeněk Papučík](/maintainers/accgit)[@accgit](https://github.com/accgit)

---

Top Contributors

[![accgit](https://avatars.githubusercontent.com/u/5998929?v=4)](https://github.com/accgit "accgit (132 commits)")

### Embed Badge

![Health badge](/badges/drago-ex-project-permission/health.svg)

```
[![Health](https://phpackages.com/badges/drago-ex-project-permission/health.svg)](https://phpackages.com/packages/drago-ex-project-permission)
```

###  Alternatives

[kartik-v/yii2-password

Useful password strength validation utilities for Yii Framework 2.0

761.2M17](/packages/kartik-v-yii2-password)

PHPackages © 2026

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