Download the PHP package alessandrominoccheri/userpermissions without Composer

On this page you can find all versions of the php package alessandrominoccheri/userpermissions. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package userpermissions

UserPermissions V 3.0.4

Scrutinizer Code Quality Code Coverage Latest Stable Version License Build Status Total Downloads

a cakephp plugin for cakephp3 to allow groups of users or single users to view a specific page.


Background

In cakephp manage permission to view a page for a user or a group of user can be difficult or you need to make many check to understand permission of that user. With UserPermissions plugin you can manage in a simple array all your page for every controller, easy, simple and very quickly to apply.


Requirements

For cakephp 2.X you can check version 1.1.2 or download this branch: https://github.com/AlessandroMinoccheri/UserPermissions/tree/cakephp2.0


Installation

To install the plugin inside your cakephp project you can do this:

[GIT Submodule]

Open your console, go inside your project root and launch the command:

[Manual]

[GIT Clone]

In your Plugin directory type:

git clone https://github.com/AlessandroMinoccheri/UserPermissions.git UserPermissions

Enable plugin

In cakephp 3.x you need to enable the plugin your app/Config/bootstrap.php file:

You can load plugin in this way:

If you are already using Plugin::loadAll();, then this is not necessary.


Usage

You can run this plugin from all your controller (except AppController) inside beforeFilter action, because every time user try to load a page there is a check of permission to understand if that user can access to the next page. You need to include the plugin component inside your controller like this:

If you have already declare your variable $components you can do something like this:

Inside your action beforeFilter you can set rules for group of user that you want. For example:

And to run the check function you only need this line of code:

Now everytime that you load a page inside this controller the plugin check for the user logged if he can access to next page.


Settings

There are some parameters that you can use into this plugin:

user_type

Is the group name of the user (or the username if you check by username not by user group). You need to pass this information to the plugin to compare users and permission that you give. Usually inside table users, every user have a group field to understand if is an admin, a normal user etc. You can pass the value user_type for example in this way:

I advise you tu use field group inside your table and insert it inside session or use a function to retrieve this information. if you don't want to use group field, isn't important. The important is , for example, if you would like to use field "username", inside the array groups you need to insert the username list not the group list for example:

Redirect

This parameter allow you to set a redirect page if the user doesn't have permission to access at the next page. You can set this parameter like this:

or

If you don't want to use this parameter you can leave it blank or you can omitted it like this:

Message

This parameter allow you to set a specific message inside flash message session. You can insert the string that you want, you can leave it blank or you can to omitted id if you don't want to set a specific message.

Action

This parameter is mandatory and it's standard. You have always to pass this parameter in this way

You can't omitted it or you can't modified it, is a standard parameter.

Controller

This parameter is mandatory and it's standard. You have always to pass this parameter in this way:

You can't omitted it or you can't modified it, is a standard parameter.

Groups

This is an array of array. Inside this array you can create list of user group to specify which page can be view by that user group, or user. You can insert inside this array, gropu name or username (in base of user_type), inside it you can specify the action of this controller that this group can access to it for example:

In this case you have told to the plugin:

It's important to know that you can specify some standard value:

if you omitt some user group or for example user guest, means that the user group, or guest can't access to any page of this controller.

Views

This parameter is an array of callback function. Example:

In this case you have specify that: if the next page is edit the plugin check if that user can access to that page with array groups, after if the user can access to that page call the function with the name that you have passed. This function must be to return a true or false value. If return true the user can access to that page, if false can't access to it. The function that you call must be inside the controller where you call the plugin function, have to be the same name that you passed into the string and must be to return a value true or false.

Example:

In this case there are two callbacks function: checkEdit and checkDelete.

If you are into the page add these function aren't called. But if you try to access to the page edit, after understand if the user can access to that page by groups array, the plugin call checkEdit function. This function compare id of the user logged and the id passed by get: means that only the same user can access to that page. if you try to accss to the edit page of another user return an error and you redirect to another page. Same thing to the page delete and the function checkDelete().


License

The MIT License (MIT)

Copyright (c) 2014 Alessandro Minoccheri

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


All versions of userpermissions with dependencies

PHP Build Version
Package Version
Requires php Version >=7.0
ext-curl Version *
composer/installers Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package alessandrominoccheri/userpermissions contains the following files

Loading the files please wait ....