2019-06-20 14:46:50 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
|
|
|
|
|
|
class AppPermission extends Migration
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Run the migrations.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function up()
|
|
|
|
{
|
|
|
|
Schema::table('apps', function (Blueprint $table) {
|
|
|
|
$table->boolean('access_oAuth')->default(true)->comment('Perform oAuth Request and get user profile');
|
|
|
|
$table->boolean('access_api')->default(true)->comment('App can Access the API, perform requests as user');
|
|
|
|
$table->boolean('access_update_apps')->default(false)->comment("App can update App Data from all Apps the User has Access to");
|
|
|
|
$table->boolean('access_update_profile')->default(false)->comment("App can Update the Profile Settings of the User");
|
|
|
|
$table->boolean('access_update_access')->default(false)->comment("App can Update the User-Access to all Apps");
|
|
|
|
$table->boolean('access_read_access')->default(false)->comment("App cann see which Apps the User give Access to");
|
|
|
|
$table->boolean('access_read_apps')->default(false)->comment("App can see which App are managed by the User");
|
|
|
|
$table->boolean('access_read_profile')->default(true)->comment("App can read the Profile Settings of the User");
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
$app = \App\Models\App::query()->where("name", "=", "PHP-GUI")->firstOrFail();
|
|
|
|
$app->access_update_apps = true;
|
|
|
|
$app->access_update_profile = true;
|
|
|
|
$app->access_update_access = true;
|
|
|
|
$app->access_read_apps = true;
|
|
|
|
$app->saveOrFail();
|
2019-06-20 16:03:54 +00:00
|
|
|
|
2019-06-20 14:46:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Reverse the migrations.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function down()
|
|
|
|
{
|
|
|
|
Schema::table('apps', function (Blueprint $table) {
|
|
|
|
$table->dropColumn('access_oAuth');
|
|
|
|
$table->dropColumn('access_api');
|
|
|
|
$table->dropColumn('access_update_apps');
|
|
|
|
$table->dropColumn('access_update_profile');
|
|
|
|
$table->dropColumn('access_update_access');
|
|
|
|
$table->dropColumn('access_read_access');
|
|
|
|
$table->dropColumn('access_read_apps');
|
|
|
|
$table->dropColumn('access_read_profile');
|
|
|
|
});
|
2019-06-20 16:03:54 +00:00
|
|
|
|
2019-06-20 14:46:50 +00:00
|
|
|
}
|
|
|
|
}
|