Download the PHP package casbin/think-authz without Composer

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

ThinkPHP Authorization

Think-authz 是一个专为 ThinkPHP 打造的授权(角色和权限控制)工具

Build Status Coverage Status Latest Stable Version Total Downloads License

它基于 PHP-Casbin, 一个强大的、高效的开源访问控制框架,支持基于ACL, RBAC, ABAC等访问控制模型。

在这之前,你需要了解 Casbin 的相关知识。

安装

该扩展需要 PHP 7.1+ 和 ThinkPHP 6.x/8.x,针对 TP 5.1 请使用 Think-Casbin .

使用composer安装:

注册服务,在应用的全局公共文件service.php中加入:

发布配置文件和数据库迁移文件:

这将自动生成 config/tauthz-rbac-model.confconfig/tauthz.php 文件。

执行迁移工具(确保数据库配置信息正确):

这将创建名为 rules 的表。

用法

快速开始

安装成功后,可以这样使用:

你可以检查一个用户是否拥有某个权限:

使用 Enforcer Api

它提供了非常丰富的 API,以促进对 Policy 的各种操作:

获取所有角色:

获取所有的角色的授权规则:

获取某个用户的所有角色:

获取某个角色的所有用户:

决定用户是否拥有某个角色:

给用户添加角色:

赋予权限给某个用户或角色:

删除用户的角色:

删除某个用户的所有角色:

删除单个角色:

删除某个权限:

删除某个用户或角色的权限:

删除某个用户或角色的所有权限:

获取用户或角色的所有权限:

决定某个用户是否拥有某个权限

更多 API 参考 Casbin API

使用中间件

该扩展包带有一个 \tauthz\middleware\Basic::class 中间件:

感谢

Casbin,你可以查看全部文档在其 官网 上。

License

This project is licensed under the Apache 2.0 license.


All versions of think-authz with dependencies

PHP Build Version
Package Version
Requires casbin/casbin Version ~3.0
topthink/framework Version ~6.0|^8.0.3
topthink/think-migration Version ^3.1.0
casbin/psr3-bridge Version ^1.1
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/think-authz contains the following files

Loading the files please wait ....