Waxim/Woodhouse

Woodhouse 是一个针对 PostgreSQL 数据库的 PHP 用户管理库。

1.0 2021-12-07 17:01 UTC

This package is auto-updated.

Last update: 2024-09-07 23:19:14 UTC


README

“没有任何友谊比共同的文学品味更能奠定美好友谊的基础。” —— P.G. Wodehouse

Woodhouse 是一个用于管理 PostgreSQL 数据库中用户的非常简单的 PHP 库。它允许您创建/删除用户并给予它们特定的表权限。Woodhouse 需要laravels illuminate/database 包(因此与 Laravel 兼容)。

示例

$woodhouse = (new Woodhouse);
$woodhouse->user()->create(($username = 'testing'), ($password = 'testing'));

// ... create a table

# Then give the user permissions to the table
$woodhouse->user()->allow(($username = 'testing'), ($table = 'table_name'));

# Or take the permission away again
$woodhouse->user()->deny(($username = 'testing'), ($table = 'table_name'));

# Delete the user
$woodhouse->user()->delete(($username = 'testing'));

# We can even test if a user has permissions to a table
$woodhouse->user()->has(($username = 'testing'), ($table = 'table_name'));

# We can also get a list of all our tables
$tables = $woodhouse->user()->table()->list();
foreach($tables as $table) {
    echo $table->tablename;
}