Download the PHP package casbin/webman-permission without Composer

On this page you can find all versions of the php package casbin/webman-permission. 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 webman-permission

🐇 An Authorization Library for Webman Plugin 🐇

🐇 Webman Authorization Plugin Based on Casbin 🐇

Build Status Latest Stable Version Total Downloads License

An authorization library that supports access control models like ACL, RBAC, ABAC for Webman plugin.


Table of Contents


Installation

Install the package via Composer:


Configuration

Dependency Injection

Modify the config/container.php configuration file as follows:

Database Configuration

By default, the policy storage uses ThinkORM.

1. Model Configuration

The default uses ThinkORM. Modify the database configuration in config/thinkorm.php.

Note: If using Laravel database, configure as follows:

  • Modify the database configuration in config/database.php
  • Change the adapter in config/plugin/casbin/webman-permission/permission.php to the Laravel adapter

2. Create casbin_rule Table

Execute the following SQL to create the policy rules table:

3. Configure Redis

Configure your Redis settings in config/redis.php.

4. Restart Webman


Usage

After successful installation, you can use the library as follows:

Basic Operations

Permission Check


Multiple Driver Configuration

You can use multiple driver configurations:

For more API details, refer to the Casbin API Documentation.


Tutorials


Testing

This project includes a comprehensive unit test suite covering the following aspects:

Test File Structure

Test Coverage

  1. Basic Functionality

    • Permission add, remove, check
    • Role assignment, removal
    • Policy management
  2. Adapter Tests

    • Database operations
    • Filter functionality
    • Batch operations
    • Transaction handling
  3. Edge Cases

    • Null value handling
    • Special characters
    • Large data volumes
    • Performance testing
  4. Integration Tests

    • Complete RBAC workflow
    • Domain permission control
    • Multi-driver support
    • Complex business scenarios
  5. Error Handling
    • Exception scenarios
    • Invalid input
    • Concurrent access

Running Tests

Requirements

Test Environment

The test environment automatically creates the following tables:

Best Practices

  1. Writing New Tests

    • Inherit from appropriate test base classes
    • Follow naming conventions
    • Add necessary assertions
  2. Test Data Management

    • Use setUp() and tearDown() methods
    • Ensure test data isolation
    • Clean up test data
  3. Test Coverage
    • Cover normal workflows
    • Test exception scenarios
    • Verify boundary conditions

Contributing

Adding New Features

  1. Write corresponding test cases for new features
  2. Ensure test coverage meets requirements
  3. Run the complete test suite
  4. Check test status before submitting code

Bug Fixes

  1. Write reproduction tests for bugs
  2. Verify tests pass after fixing bugs
  3. Ensure existing functionality is not affected

Credits

Built on top of Casbin. For full documentation, visit the official website.


Advanced Configuration

Removing PHP-DI Dependency (Not Recommended) 1. Uninstall the DI dependency package: 2. Modify the `Casbin\WebmanPermission\Permission` file: Replace: With: > **Warning:** This approach has high coupling and is not recommended. For more information, visit: https://www.workerman.net/doc/webman/di.html

Troubleshooting

Think-ORM 4.0 Compatibility

Error: Object not contained in WeakMap or array_search(): Argument #2 ($haystack) must be of type array, null given

Solution: This package fully supports think-orm 4.0+. If you encounter WeakMap errors:

  1. Ensure you're using the latest version:

  2. For detailed information, see:
    • Think-ORM 4.0 Fix Guide
    • Think-ORM Compatibility Guide

Supported Versions:

Laravel Driver Error

Error: Call to a member function connection() on null

Solution: Check if your local database proxy is working correctly. Using Docker container host addresses like dnmp-mysql may cause this issue.


License

MIT License


All versions of webman-permission with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
casbin/casbin Version ~4.0
topthink/think-orm Version ^2.0.53 || ^3.0.0 || ^4.0.30 || dev-master
php-di/php-di Version ^7.0
doctrine/annotations Version ^2.0
workerman/redis Version ^2.0
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 casbin/webman-permission contains the following files

Loading the files please wait ...