@@ 8-54 (lines=47) @@ | ||
5 | use Bytesfield\KeyManager\KeyManagerInterface; |
|
6 | use Illuminate\Console\Command; |
|
7 | ||
8 | class ActivateApiCredentialCommand extends Command |
|
9 | { |
|
10 | /** |
|
11 | * The name and signature of the console command. |
|
12 | * |
|
13 | * @var string |
|
14 | */ |
|
15 | protected $signature = 'client:activate-key {clientId}'; |
|
16 | ||
17 | /** |
|
18 | * The console command description. |
|
19 | * |
|
20 | * @var string |
|
21 | */ |
|
22 | protected $description = 'Command to activate a client credential'; |
|
23 | ||
24 | /** |
|
25 | * The KeyManagerInterface. |
|
26 | * |
|
27 | * @var KeyManagerInterface |
|
28 | */ |
|
29 | private $manager; |
|
30 | ||
31 | /** |
|
32 | * @param KeyManagerInterface $manager |
|
33 | * @return void |
|
34 | */ |
|
35 | public function __construct(KeyManagerInterface $manager) |
|
36 | { |
|
37 | $this->manager = $manager; |
|
38 | parent::__construct(); |
|
39 | } |
|
40 | ||
41 | /** |
|
42 | * Execute the console command. |
|
43 | * |
|
44 | * @return int |
|
45 | */ |
|
46 | public function handle() |
|
47 | { |
|
48 | $key = $this->manager->activateApiCredential($this->argument('clientId')); |
|
49 | ||
50 | $this->info($key->getData()->status == true ? 'Success' : 'Failed'); |
|
51 | ||
52 | $this->info($key->getData()->message); |
|
53 | } |
|
54 | } |
|
55 |
@@ 8-54 (lines=47) @@ | ||
5 | use Bytesfield\KeyManager\KeyManagerInterface; |
|
6 | use Illuminate\Console\Command; |
|
7 | ||
8 | class ActivateClientCommand extends Command |
|
9 | { |
|
10 | /** |
|
11 | * The name and signature of the console command. |
|
12 | * |
|
13 | * @var string |
|
14 | */ |
|
15 | protected $signature = 'client:activate {clientId}'; |
|
16 | ||
17 | /** |
|
18 | * The console command description. |
|
19 | * |
|
20 | * @var string |
|
21 | */ |
|
22 | protected $description = 'Command to activate a client'; |
|
23 | ||
24 | /** |
|
25 | * The KeyManagerInterface. |
|
26 | * |
|
27 | * @var KeyManagerInterface |
|
28 | */ |
|
29 | private $manager; |
|
30 | ||
31 | /** |
|
32 | * @param KeyManagerInterface $manager |
|
33 | * @return void |
|
34 | */ |
|
35 | public function __construct(KeyManagerInterface $manager) |
|
36 | { |
|
37 | $this->manager = $manager; |
|
38 | parent::__construct(); |
|
39 | } |
|
40 | ||
41 | /** |
|
42 | * Execute the console command. |
|
43 | * |
|
44 | * @return int |
|
45 | */ |
|
46 | public function handle() |
|
47 | { |
|
48 | $key = $this->manager->activateClient($this->argument('clientId')); |
|
49 | ||
50 | $this->info($key->getData()->status == true ? 'Success' : 'Failed'); |
|
51 | ||
52 | $this->info($key->getData()->message); |
|
53 | } |
|
54 | } |
|
55 |
@@ 8-54 (lines=47) @@ | ||
5 | use Bytesfield\KeyManager\KeyManagerInterface; |
|
6 | use Illuminate\Console\Command; |
|
7 | ||
8 | class SuspendApiCredentialCommand extends Command |
|
9 | { |
|
10 | /** |
|
11 | * The name and signature of the console command. |
|
12 | * |
|
13 | * @var string |
|
14 | */ |
|
15 | protected $signature = 'client:suspend-key {clientId}'; |
|
16 | ||
17 | /** |
|
18 | * The console command description. |
|
19 | * |
|
20 | * @var string |
|
21 | */ |
|
22 | protected $description = 'Command to suspend a client credential'; |
|
23 | ||
24 | /** |
|
25 | * The KeyManagerInterface. |
|
26 | * |
|
27 | * @var KeyManagerInterface |
|
28 | */ |
|
29 | private $manager; |
|
30 | ||
31 | /** |
|
32 | * @param KeyManagerInterface $manager |
|
33 | * @return void |
|
34 | */ |
|
35 | public function __construct(KeyManagerInterface $manager) |
|
36 | { |
|
37 | $this->manager = $manager; |
|
38 | parent::__construct(); |
|
39 | } |
|
40 | ||
41 | /** |
|
42 | * Execute the console command. |
|
43 | * |
|
44 | * @return int |
|
45 | */ |
|
46 | public function handle() |
|
47 | { |
|
48 | $key = $this->manager->suspendApiCredential($this->argument('clientId')); |
|
49 | ||
50 | $this->info($key->getData()->status == true ? 'Success' : 'Failed'); |
|
51 | ||
52 | $this->info($key->getData()->message); |
|
53 | } |
|
54 | } |
|
55 |
@@ 8-54 (lines=47) @@ | ||
5 | use Bytesfield\KeyManager\KeyManagerInterface; |
|
6 | use Illuminate\Console\Command; |
|
7 | ||
8 | class SuspendClientCommand extends Command |
|
9 | { |
|
10 | /** |
|
11 | * The name and signature of the console command. |
|
12 | * |
|
13 | * @var string |
|
14 | */ |
|
15 | protected $signature = 'client:suspend {clientId}'; |
|
16 | ||
17 | /** |
|
18 | * The console command description. |
|
19 | * |
|
20 | * @var string |
|
21 | */ |
|
22 | protected $description = 'Command to suspend a client'; |
|
23 | ||
24 | /** |
|
25 | * The KeyManagerInterface. |
|
26 | * |
|
27 | * @var KeyManagerInterface |
|
28 | */ |
|
29 | private $manager; |
|
30 | ||
31 | /** |
|
32 | * @param KeyManagerInterface $manager |
|
33 | * @return void |
|
34 | */ |
|
35 | public function __construct(KeyManagerInterface $manager) |
|
36 | { |
|
37 | $this->manager = $manager; |
|
38 | parent::__construct(); |
|
39 | } |
|
40 | ||
41 | /** |
|
42 | * Execute the console command. |
|
43 | * |
|
44 | * @return int |
|
45 | */ |
|
46 | public function handle() |
|
47 | { |
|
48 | $key = $this->manager->suspendClient($this->argument('clientId')); |
|
49 | ||
50 | $this->info($key->getData()->status == true ? 'Success' : 'Failed'); |
|
51 | ||
52 | $this->info($key->getData()->message); |
|
53 | } |
|
54 | } |
|
55 |