Download the PHP package n0nag0n/fatfree-permissions without Composer

On this page you can find all versions of the php package n0nag0n/fatfree-permissions. 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 fatfree-permissions

Fat-Free Permissions

This is a permissions module that can be used in your projects if you have multiple roles in your app and each role has a little bit different functionality. This module allows you to define permissions for each role and then check if the current user has the permission to access a certain page or perform a certain action. This module is designed to be used with the Fat-Free Framework. It is not a standalone module. This module pairs very nicely with xfra35/f3-access

Installation

Run composer require n0nag0n/fatfree-permissions and you're on your way!

Configuration

There is very little configuration you need to do to get this started. It actually is wired up to accept configs, but it's not actually used at the moment.

Usage

First you need to setup your permissions, then you tell the your app what the permissions mean. Ultimately you will check your permissions with $Permissions->has(), ->can(), or is(). They all have the same functionality, but are named differently to make your code more readable.

Simple Usage

Then in your template or controller you can do something like this:

Advanced Usage

You might have something more advanced where you have some functionality available to one role, but not another role surrounding the same thing. I'll show you what I mean.

The permissions defined in this context are completely customizable. If you want view, update, archive, soft-delete, and like permissions, you can totally customize it that way. Whatever strings you append to the array can be used to check if the user has that permission.

Now the fun part comes when you want to check if a user has a certain permission regarding orders. You can do something like this:

Injecting dependencies

As you can see in the example above, you can inject dependencies into the closure that defines the permissions. This is useful if you have some sort of toggle that you want to check against. The same works for Class->Method type calls, except you define the method as such:

Shortcuts with classes

You can also use classes to define your permissions. This is useful if you have a lot of permissions and you want to keep your code clean. You can do something like this:

The cool part is that there is also a shortcut that you can use (that is also cached!!!) where you just tell the permissions class to map all methods in a class into permissions. So if you have a method named order() and a method named company(), these will automatically be mapped so you can just run $Permissions->has('order.read') or $Permissions->has('company.read') and it will work. Defining this is very difficult, so stay with me here. You just need to do this:

And away you go!


All versions of fatfree-permissions with dependencies

PHP Build Version
Package Version
Requires bcosca/fatfree-core Version ^3.7
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 n0nag0n/fatfree-permissions contains the following files

Loading the files please wait ....