drago-ex / project-permission
Component for managing user permissions in a Drago project.
Package info
github.com/drago-ex/project-permission
Type:drago-project-resource
pkg:composer/drago-ex/project-permission
Requires
- php: >=8.3 <9
- drago-ex/application: ^1.0
- drago-ex/component: ^1.0
- drago-ex/database: ^2.0
- drago-ex/datagrid: @dev
- drago-ex/form: ^1.0
- drago-ex/permission: ^1.0
- drago-ex/project-front: ^1.0
- drago-ex/project-user: ^1.0
- drago-ex/translator: ^2.0
- drago-ex/utils: ^1.0
- nette/application: ^3.1
- nette/di: ^3.1
- nette/robot-loader: ^4.1
- nette/security: ^3.1
Requires (Dev)
- phpstan/phpstan-nette: ^1.2.9
This package is auto-updated.
Last update: 2026-05-07 07:55:05 UTC
README
Component for ACL and permission management in a Drago / Nette project.
Requirements
- PHP >= 8.3
- Nette Framework
- Composer
- Bootstrap
- Naja
- Node.js
- Drago Project core packages
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
PermissionACL 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.
Installation
composer require drago-ex/project-permission
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'; naja.registerExtension(new PermissionToggle());
Database
The package works with these tables:
rolesusers_rolesresourcesauthorization
Seed migrations also add default roles and AccessControl permissions for the backend module.
Integration with project-auth
In UserRepository
fill in the body of the prepared getRolesByUser() method:
public function getRolesByUser(int $userId): array { return $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(RolesEntity::PrimaryKey, RolesEntity::ColumnName); }