Скоуп у ключей API: ограничение подмножеством прав владельца
Ключ без --abilities работает как раньше. Со скоупом Viewer::forToken() пересекает права владельца и список ключа — расширить роль в обход владельца скоуп не может, только урезать
This commit is contained in:
1 parent
779fbfafea
commit
a9d98729b1
11 files changed
+167
-13
No files matched your search
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Migrations;
|
||||
|
||||
use Rsgrinko\Proton\Database\Migration;
|
||||
use Rsgrinko\Proton\Database\Schema\Blueprint;
|
||||
|
||||
/**
|
||||
* Скоуп ключа API: список прав через запятую, которыми ключ ограничен —
|
||||
* даже если у владельца их больше. Пусто — без ограничения, ключ может
|
||||
* всё, что может владелец (как раньше).
|
||||
*/
|
||||
final class AddTokenAbilities extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
$this->table('api_tokens', function (Blueprint $table): void {
|
||||
$table->string('abilities', 500)->default('');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
$this->table('api_tokens', function (Blueprint $table): void {
|
||||
$table->dropColumn('abilities');
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user