1 <?php
2
3 4 5 6 7 8 9 10
11
12 namespace Icybee\Modules\Users;
13
14 use ICanBoogie\I18n\FormattedString;
15
16 17 18
19 class ActivateOperation extends \ICanBoogie\Operation
20 {
21 protected function get_controls()
22 {
23 return [
24
25 self::CONTROL_PERMISSION => Module::PERMISSION_ADMINISTER,
26 self::CONTROL_RECORD => true,
27 self::CONTROL_OWNERSHIP => true
28
29 ] + parent::get_controls();
30 }
31
32 protected function validate(\ICanboogie\Errors $errors)
33 {
34 return true;
35 }
36
37 protected function process()
38 {
39 $record = $this->record;
40 $record->is_activated = true;
41 $record->save();
42
43 $this->response->message = new FormattedString('!name account is active.', [ '!name' => $record->name ]);
44
45 return true;
46 }
47 }