Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
useroption.php
1<?php
2
3declare(strict_types=1);
4
6
10
19{
20 public const ERROR_USER_NOT_AUTHORIZED = 'ERROR_USER_NOT_AUTHORIZED';
21
22 protected function getDefaultPreFilters(): array
23 {
24 return array_merge(
25 parent::getDefaultPreFilters(),
26 [
27 new ActionFilter\CloseSession(),
28 new ActionFilter\HttpMethod(
29 [ActionFilter\HttpMethod::METHOD_POST],
30 ),
31 ]
32 );
33 }
34
35 public function saveOptionsAction(array $newValues): void
36 {
37 \CUserOptions::SetOptionsFromArray($newValues);
38 }
39
40 public function deleteOptionAction(string $category, string $name, bool $common = false): void
41 {
42 if (!($GLOBALS["USER"] instanceof \CUser))
43 {
44 $this->addError(new Error('User is not authorized', self::ERROR_USER_NOT_AUTHORIZED));
45
46 return;
47 }
48
49 $currentUser = $GLOBALS["USER"];
50 if ($common && !$currentUser->CanDoOperation('edit_other_settings'))
51 {
52 $common = false;
53 }
54
55 \CUserOptions::DeleteOption(
56 $category,
57 $name,
58 $common,
59 $currentUser->getId()
60 );
61 }
62}
deleteOptionAction(string $category, string $name, bool $common=false)
saveOptionsAction(array $newValues)
$GLOBALS['____1444769544']
Definition license.php:1