Download the PHP package fastbolt/sonata-admin-protected-fields without Composer

On this page you can find all versions of the php package fastbolt/sonata-admin-protected-fields. 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 sonata-admin-protected-fields

Composer version

Code Climate maintainability Test Coverage

Type Coverage Psalm Level

GitHub

Field and Entity protection for sonata admin

This library aims to provide an easy way to protect fields from being edited in sonata admin, while still being displayed in the form.

Using the library, some entities fields may be fixed, e.g. coming from the ERP or some other system, while other fields may still be edited by the user. Furthermore, items created in the GUI might still be editable, including all fields, which are not editable for other instances.

In addition, the same checks can be used to protect entities from being deleted in the Sonata admin GUI on a per-item basis.

The system relies on the Fastbolt\SonataAdminProtectedFields\Protection\Checker\Checker interface which has access to all entity properties.

For custom implementation, please head to the Implementing custom checkers section.

Prerequisites

Due to the PHP Attribute usage, we need at least PHP 8.0 or higher.

For now, the bundle is tested using PHP 8.0, 8.1 and 8.2 and the sonata admin bundle version 4.9

Installation

The library can be installed via composer:

Configuration

If not configured automatically, the bundle needs to be enabled in your project's bundles.php file:

Usage

Field protection

To enable dynamic field protection when editing entities in sonata admin, just add the corresponding attribute to your entity's field:

The default property protection is performed using the Fastbolt\SonataAdminProtectedFields\Protection\Checker\PropertyProtectionChecker service, which is automatically registered through the bundle configuration.

It expects your entity to implement a method isProtected() that returns a boolean value:

Delete protection

To enable dynamic delete protection, just add the corresponding attribute to your entity's class header:

The protection checks use the same mechanism as outlined in the Field protection section.

Implementing custom checkers

Custom checkers need to implement the simple Fastbolt\SonataAdminProtectedFields\Protection\Checker\Checker interface:

All checkers need to have the DIC tag sonata_admin_protected_fields_checker. For further information on DIC tags please refer to the symfony documentation.

To enable the custom checker, the value returned from the getName method needs to be set in both Attributes:


All versions of sonata-admin-protected-fields with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
sonata-project/admin-bundle Version ^4.9
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 fastbolt/sonata-admin-protected-fields contains the following files

Loading the files please wait ....