PHPackages                             hassnainabass/users-permissions - 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. hassnainabass/users-permissions

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

hassnainabass/users-permissions
===============================

Users Permissions Management plugin for CakePHP with GUI

171PHP

Since Jun 7Pushed 8y ago1 watchersCompare

[ Source](https://github.com/hassnainabass/UsersPermissions)[ Packagist](https://packagist.org/packages/hassnainabass/users-permissions)[ RSS](/packages/hassnainabass-users-permissions/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependenciesVersions (1)Used By (0)

UsersPermissions plugin for CakePHP
===================================

[](#userspermissions-plugin-for-cakephp)

The **UsersPermissions plugin** is for allowing admins to add user permissions for each module in Cakephp. It provides a basic interface to manage user permissions and check upon each request. It provides check box based user permissions in a form like magento. The plugin uses bootstrap by default but you can change that. It will automatically get all controllers and actions from Your Cakephp application and in a GUI you can select the permissions for all controller or actions inside a controller.

[![Image of UsersPermissions](https://camo.githubusercontent.com/a5269d10aad71e813a56754e3672e46e66f165c349143cc32343997d08b20ed1/687474703a2f2f6936362e74696e797069632e636f6d2f326b307569762e706e67)](https://camo.githubusercontent.com/a5269d10aad71e813a56754e3672e46e66f165c349143cc32343997d08b20ed1/687474703a2f2f6936362e74696e797069632e636f6d2f326b307569762e706e67)

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

[](#requirements)

- CakePHP 3.0+
- [Cakephp Migration Plugin](https://book.cakephp.org/3.0/en/migrations.html)
- [Simple Cakephp 3 Authentication](https://book.cakephp.org/3.0/en/tutorials-and-examples/blog-auth-example/auth.html)
- PHP 5.2.8+

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

[](#installation)

You can install this plugin into your CakePHP 3 application using [composer](http://getcomposer.org).

The recommended way to install composer packages is:

```
composer require  "hassnainabass/users-permissions:*"

```

Or download the files and move to root/plugins and paste it there, Please rename the folder to **UsersPermissions**

### After successfull steps above, Please follow the following:

[](#after-successfull-steps-above-please-follow-the-following)

- Load Plugin in config/bootstrap.php

    ```
     Plugin::load('UsersPermissions', ['routes' => true]);

    ```
- Open console/terminal and run the following migration,please make sure to load migration plugin first

    ```
     bin/cake migrations migrate -p UsersPermissions

    ```

    Or create the following table in database:

    ```
    CREATE TABLE user_permissions (
      id int(11) NOT NULL AUTO_INCREMENT,
      user_id int(11) DEFAULT NULL,
      permissions text DEFAULT NULL,
      created_on timestamp NULL DEFAULT CURRENT_TIMESTAMP,
      updated_on date DEFAULT NULL,
      PRIMARY KEY (id)
    )
    ENGINE = INNODB
    AUTO_INCREMENT = 1
    CHARACTER SET latin1
    COLLATE latin1_swedish_ci;

    ```

    It will create a table named "user\_permissions" in database using default database connection configured in config/app.php of your cakephp installation.
- Change the route for your plugin GUI in **plugins/UserPermissions/config/routes.php** , By default it is domain.com/users-permissions

    ```
     Router::plugin(
         'UsersPermissions',
         ['path' => '/users-permissions'],
         function ($routes) {
             $routes->fallbacks('DashedRoute');
         }
     );

    ```
- Update call back url if user does not have permision for a particular action. To update the url, replace 'dashboard' in plugins/UsersPermissions/src/controller/component/ResourceComponent.php

    ```
     return  $this->_registry->getController()->redirect('/dashboard');

    ```
- Update composer, Go to the root directory for your cakephp installation and run the following command:

    ```
     composer dumpautoload

    ```

**Thats all your plugin has been installed, yay :)**

You can access the GUI if you have 'admin' role in Users table in user authentication and authorization of cakephp application.

### Usage

[](#usage)

- If you want to load the plugin and permissions for all actions of all controllers and routes. Add the following code in cakephpapp/src/controller/AppController.php

    ```
     public function initialize()
     {
         parent::initialize();
         // Some code
         // Load Resource Component
         $this->loadComponent('UsersPermissions.Resource');
     }

     public function beforeFilter(Event $event)
     {
     	parent::beforeFilter($event);
     	// Some code
     	// Load permissions check function from Resource component
         $this->Resource->checkPermision();
     }

    ```
- If you want to load the plugin and permissions for all actions of only one controllers. Add the following code in desired controller (same as above) cakephpapp/src/controller/ExampleController.php

    ```
     public function initialize()
     {
         parent::initialize();
         // Some code
         // Load Resource Component
         $this->loadComponent('UsersPermissions.Resource');
     }

     public function beforeFilter(Event $event)
     {
     	parent::beforeFilter($event);
     	// Some code
     	// Load permissions check function from Resource component
         $this->Resource->checkPermision();
     }

    ```
- If you want to load the plugin and permissions for only one actions of only one controllers. Add the following code in desired controller and in the start of desired action/function in cakephpapp/src/controller/ExampleController.php

    ```
     public function initialize()
     {
         parent::initialize();
         // Some code
         // Load Resource Component
         $this->loadComponent('UsersPermissions.Resource');
     }

     public function exampleAction($param = null)
     {
     	// Load permissions check function from Resource component
         $this->Resource->checkPermision();

     	// Some code

     }

    ```

\*The plugin uses bootstrap as front-end styling but you can update the views. To do that you can update the following files.

```
plugins/UsersPermissions/src/template/Permissions/index.ctp
plugins/UsersPermissions/src/template/Permissions/userpermission.ctp

```

Author
------

[](#author)

Developed by [Hassnain Abass](https://www.linkedin.com/in/hussnain-abass-b041b578/) - Senior Web Developer and [Freelancer](https://www.freelancer.com/u/Hussnain0163.html)

Contributing
------------

[](#contributing)

This repository follows the [CakePhp Plugin Standards](https://book.cakephp.org/3.0/en/plugins.html). If you'd like to contribute new features, enhancements or bug fixes to the plugin, please feel free to pull or report/open issues.

License
-------

[](#license)

Copyright 2017-2020 [Hassnain Abass](https://www.linkedin.com/in/hussnain-abass-b041b578/). All rights reserved.

Licensed under the [MIT](http://www.opensource.org/licenses/mit-license.php) License. Redistributions of the source code included in this repository must retain the copyright notice found in each file.

**Goodluck And Happy Coding.**

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 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://www.gravatar.com/avatar/b2ea50b6748082a7ed333ddb234bb62669b198553aa693eb89f85f10842940ec?d=identicon)[hussnain.abass](/maintainers/hussnain.abass)

---

Top Contributors

[![hassnainabass](https://avatars.githubusercontent.com/u/7250886?v=4)](https://github.com/hassnainabass "hassnainabass (27 commits)")

### Embed Badge

![Health badge](/badges/hassnainabass-users-permissions/health.svg)

```
[![Health](https://phpackages.com/badges/hassnainabass-users-permissions/health.svg)](https://phpackages.com/packages/hassnainabass-users-permissions)
```

###  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)[bezhansalleh/filament-shield

Filament support for `spatie/laravel-permission`.

2.8k2.9M88](/packages/bezhansalleh-filament-shield)[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)

PHPackages © 2026

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