1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
useroption.php
См. документацию.
1
<?php
2
3
declare(strict_types=1);
4
5
namespace
Bitrix\Main\Controller;
6
7
use Bitrix\Main\Engine;
8
use Bitrix\Main\Engine\ActionFilter;
9
use Bitrix\Main\Error;
10
18
class
UserOption
extends
Engine\JsonController
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
}
Bitrix\Main\Controller\UserOption
Определения
useroption.php:19
Bitrix\Main\Controller\UserOption\getDefaultPreFilters
getDefaultPreFilters()
Определения
useroption.php:22
Bitrix\Main\Controller\UserOption\deleteOptionAction
deleteOptionAction(string $category, string $name, bool $common=false)
Определения
useroption.php:40
Bitrix\Main\Controller\UserOption\ERROR_USER_NOT_AUTHORIZED
const ERROR_USER_NOT_AUTHORIZED
Определения
useroption.php:20
Bitrix\Main\Controller\UserOption\saveOptionsAction
saveOptionsAction(array $newValues)
Определения
useroption.php:35
Bitrix\Main\Engine\ActionFilter\CloseSession
Определения
closesession.php:13
Bitrix\Main\Engine\ActionFilter\HttpMethod
Определения
httpmethod.php:13
Bitrix\Main\Engine\ActionFilter\HttpMethod\METHOD_POST
const METHOD_POST
Определения
httpmethod.php:15
Bitrix\Main\Engine\Controller\addError
addError(Error $error)
Определения
controller.php:1070
Bitrix\Main\Engine\JsonController
Определения
jsoncontroller.php:9
Bitrix\Main\Error
Определения
error.php:15
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
$name
$name
Определения
menu_edit.php:35
Bitrix\Main\Engine\ActionFilter
Bitrix\Main\$GLOBALS
$GLOBALS['____1690880296']
Определения
license.php:1
bitrix
modules
main
lib
controller
useroption.php
Создано системой
1.14.0