1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Slides\Saml2\Commands; |
4
|
|
|
|
5
|
|
|
use Slides\Saml2\Helpers\ConsoleHelper; |
6
|
|
|
use Slides\Saml2\Repositories\TenantRepository; |
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* Class UpdateTenant |
10
|
|
|
* |
11
|
|
|
* @package Slides\Saml2\Commands |
12
|
|
|
*/ |
13
|
|
|
class UpdateTenant extends \Illuminate\Console\Command |
|
|
|
|
14
|
|
|
{ |
15
|
|
|
use RendersTenants; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* The name and signature of the console command. |
19
|
|
|
* |
20
|
|
|
* @var string |
21
|
|
|
*/ |
22
|
|
|
protected $signature = 'saml2:update-tenant {id} |
23
|
|
|
{ --k|key= : A tenant custom key } |
24
|
|
|
{ --entityId= : IdP Issuer URL } |
25
|
|
|
{ --loginUrl= : IdP Sign on URL } |
26
|
|
|
{ --logoutUrl= : IdP Logout URL } |
27
|
|
|
{ --x509cert= : x509 certificate (base64) } |
28
|
|
|
{ --metadata= : A custom metadata }'; |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* The console command description. |
32
|
|
|
* |
33
|
|
|
* @var string |
34
|
|
|
*/ |
35
|
|
|
protected $description = 'Update a Tenant entity (relying identity provider)'; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* @var TenantRepository |
39
|
|
|
*/ |
40
|
|
|
protected $tenants; |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* DeleteTenant constructor. |
44
|
|
|
* |
45
|
|
|
* @param TenantRepository $tenants |
46
|
|
|
*/ |
47
|
|
|
public function __construct(TenantRepository $tenants) |
48
|
|
|
{ |
49
|
|
|
$this->tenants = $tenants; |
50
|
|
|
|
51
|
|
|
parent::__construct(); |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* Execute the console command. |
56
|
|
|
* |
57
|
|
|
* @return void |
58
|
|
|
*/ |
59
|
|
|
public function handle() |
60
|
|
|
{ |
61
|
|
|
if(!$tenant = $this->tenants->findById($this->argument('id'))) { |
62
|
|
|
$this->error('Cannot find a tenant #' . $this->argument('id')); |
63
|
|
|
return; |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
$tenant->update(array_filter([ |
67
|
|
|
'key' => $this->option('key'), |
68
|
|
|
'idp_entity_id' => $this->option('entityId'), |
69
|
|
|
'idp_login_url' => $this->option('loginUrl'), |
70
|
|
|
'idp_logout_url' => $this->option('logoutUrl'), |
71
|
|
|
'idp_x509_cert' => $this->option('x509cert'), |
72
|
|
|
'metadata' => ConsoleHelper::stringToArray($this->option('metadata')) |
73
|
|
|
])); |
74
|
|
|
|
75
|
|
|
if(!$tenant->save()) { |
76
|
|
|
$this->error('Tenant cannot be saved.'); |
77
|
|
|
return; |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
$this->info("The tenant #{$tenant->id} ({$tenant->uuid}) was successfully updated."); |
81
|
|
|
|
82
|
|
|
$this->renderTenantCredentials($tenant); |
83
|
|
|
|
84
|
|
|
$this->output->newLine(); |
85
|
|
|
} |
86
|
|
|
} |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths