Skip to content

Commit e701e79

Browse files
remove 'esi-characterstats.read.v1' scope (#708)
* remove 'esi-characterstats.read.v1' scope * styleci
1 parent 737c7c2 commit e701e79

File tree

2 files changed

+69
-1
lines changed

2 files changed

+69
-1
lines changed

src/WebServiceProvider.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,6 @@ private function register_settings()
541541
'esi-characters.read_notifications.v1',
542542
'esi-characters.read_standings.v1',
543543
'esi-characters.read_titles.v1',
544-
'esi-characterstats.read.v1',
545544
'esi-clones.read_clones.v1',
546545
'esi-clones.read_implants.v1',
547546
'esi-contracts.read_character_contracts.v1',
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
<?php
2+
3+
/*
4+
* This file is part of SeAT
5+
*
6+
* Copyright (C) 2015 to present Leon Jacobs
7+
*
8+
* This program is free software; you can redistribute it and/or modify
9+
* it under the terms of the GNU General Public License as published by
10+
* the Free Software Foundation; either version 2 of the License, or
11+
* (at your option) any later version.
12+
*
13+
* This program is distributed in the hope that it will be useful,
14+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+
* GNU General Public License for more details.
17+
*
18+
* You should have received a copy of the GNU General Public License along
19+
* with this program; if not, write to the Free Software Foundation, Inc.,
20+
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21+
*/
22+
23+
use Illuminate\Database\Migrations\Migration;
24+
use Illuminate\Support\Facades\DB;
25+
26+
return new class extends Migration {
27+
/**
28+
* Run the migrations.
29+
*
30+
* @return void
31+
*/
32+
public function up()
33+
{
34+
// Extends https://github.com/eveseat/web/pull/698
35+
36+
$remove_scopes = [
37+
'esi-characterstats.read.v1',
38+
];
39+
40+
$sso_scopes_setting = DB::table('global_settings')->where('name', 'sso_scopes')->first();
41+
42+
// if no sso scope settings have been configured, we don't have anything to migrate
43+
if($sso_scopes_setting === null) return;
44+
45+
// Fix the global_settings
46+
$profiles = json_decode($sso_scopes_setting->value);
47+
foreach($profiles as &$profile) {
48+
foreach($remove_scopes as $rs) {
49+
foreach(array_keys($profile->scopes, $rs, true) as $key) {
50+
unset($profile->scopes[$key]);
51+
}
52+
$profile->scopes = array_values($profile->scopes);
53+
}
54+
}
55+
DB::table('global_settings')
56+
->where('name', 'sso_scopes')
57+
->update(['value' => json_encode($profiles)]);
58+
}
59+
60+
/**
61+
* Reverse the migrations.
62+
*
63+
* @return void
64+
*/
65+
public function down()
66+
{
67+
68+
}
69+
};

0 commit comments

Comments
 (0)