1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* Copyright 2014 SURFnet bv |
5
|
|
|
* |
6
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
7
|
|
|
* you may not use this file except in compliance with the License. |
8
|
|
|
* You may obtain a copy of the License at |
9
|
|
|
* |
10
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0 |
11
|
|
|
* |
12
|
|
|
* Unless required by applicable law or agreed to in writing, software |
13
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, |
14
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
15
|
|
|
* See the License for the specific language governing permissions and |
16
|
|
|
* limitations under the License. |
17
|
|
|
*/ |
18
|
|
|
|
19
|
|
|
namespace Surfnet\StepupRa\RaBundle\Command; |
20
|
|
|
|
21
|
|
|
use Symfony\Component\Validator\Constraints as Assert; |
22
|
|
|
|
23
|
|
|
final class ExportRaSecondFactorsCommand |
24
|
|
|
{ |
25
|
|
|
const STATUS_UNVERIFIED = 'unverified'; |
26
|
|
|
const STATUS_VERIFIED = 'verified'; |
27
|
|
|
const STATUS_VETTED = 'vetted'; |
28
|
|
|
const STATUS_REVOKED = 'revoked'; |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* @Assert\NotBlank(message="ra.search_ra_second_factors.institution.blank") |
32
|
|
|
* @Assert\Type("string", message="ra.search_ra_second_factors.institution.type") |
33
|
|
|
* |
34
|
|
|
* @var string |
35
|
|
|
*/ |
36
|
|
|
public $institution; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* @var string|null |
40
|
|
|
*/ |
41
|
|
|
public $name; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @var string|null |
45
|
|
|
*/ |
46
|
|
|
public $type; |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* @var string|null The second factor type's ID (eg. Yubikey public ID) |
50
|
|
|
*/ |
51
|
|
|
public $secondFactorId; |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* @var string|null |
55
|
|
|
*/ |
56
|
|
|
public $email; |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* @Assert\Choice( |
60
|
|
|
* {"unverified", "verified", "vetted", "revoked"}, |
61
|
|
|
* message="ra.search_ra_second_factors.status.invalid_choice" |
62
|
|
|
* ) |
63
|
|
|
* |
64
|
|
|
* @var string|null One of the STATUS_* constants. |
65
|
|
|
*/ |
66
|
|
|
public $status; |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* @Assert\Choice( |
70
|
|
|
* {"name", "type", "secondFactorId", "email", "status"}, |
71
|
|
|
* message="ra.search_ra_second_factors.order_by.invalid_choice" |
72
|
|
|
* ) |
73
|
|
|
* |
74
|
|
|
* @var string|null |
75
|
|
|
*/ |
76
|
|
|
public $orderBy; |
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* @Assert\Choice({"asc", "desc"}, message="ra.search_ra_second_factors.order_direction.invalid_choice") |
80
|
|
|
* |
81
|
|
|
* @var string|null |
82
|
|
|
*/ |
83
|
|
|
public $orderDirection; |
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* Builds the command from a SearchRaSecondFactorsCommand |
87
|
|
|
* @param SearchRaSecondFactorsCommand $command |
88
|
|
|
* @param string $institution |
89
|
|
|
* @return ExportRaSecondFactorsCommand |
90
|
|
|
*/ |
91
|
|
|
public static function fromSearchCommand(SearchRaSecondFactorsCommand $command, $institution) |
92
|
|
|
{ |
93
|
|
|
$exportCommand = new self; |
94
|
|
|
|
95
|
|
|
$exportCommand->name = $command->name; |
96
|
|
|
$exportCommand->type = $command->type; |
97
|
|
|
$exportCommand->secondFactorId = $command->secondFactorId; |
98
|
|
|
$exportCommand->email = $command->email; |
99
|
|
|
$exportCommand->status = $command->status; |
100
|
|
|
$exportCommand->orderBy = $command->orderBy; |
101
|
|
|
$exportCommand->orderDirection = $command->orderDirection; |
102
|
|
|
$exportCommand->institution = $institution; |
103
|
|
|
|
104
|
|
|
return $exportCommand; |
105
|
|
|
} |
106
|
|
|
} |
107
|
|
|
|