1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* @package CleverStyle Framework |
4
|
|
|
* @subpackage System module |
5
|
|
|
* @category modules |
6
|
|
|
* @author Nazar Mokrynskyi <[email protected]> |
7
|
|
|
* @copyright Copyright (c) 2015-2016, Nazar Mokrynskyi |
8
|
|
|
* @license MIT License, see license.txt |
9
|
|
|
*/ |
10
|
|
|
namespace cs\modules\System\api\Controller\admin\users; |
11
|
|
|
use |
12
|
|
|
cs\Config; |
13
|
|
|
|
14
|
|
|
trait general { |
15
|
|
|
protected static $users_general_options_keys = [ |
16
|
|
|
'session_expire', |
17
|
|
|
'sign_in_attempts_block_count', |
18
|
|
|
'sign_in_attempts_block_time', |
19
|
|
|
'remember_user_ip', |
20
|
|
|
'password_min_length', |
21
|
|
|
'password_min_strength', |
22
|
|
|
'allow_user_registration', |
23
|
|
|
'require_registration_confirmation', |
24
|
|
|
'registration_confirmation_time', |
25
|
|
|
'auto_sign_in_after_registration' |
26
|
|
|
]; |
27
|
|
|
/** |
28
|
|
|
* Get general users settings |
29
|
|
|
*/ |
30
|
|
|
public static function admin_users_general_get_settings () { |
|
|
|
|
31
|
|
|
$Config = Config::instance(); |
32
|
|
|
return $Config->core(static::$users_general_options_keys) + [ |
33
|
|
|
'applied' => $Config->cancel_available() |
34
|
|
|
]; |
35
|
|
|
} |
36
|
|
|
/** |
37
|
|
|
* Apply general users settings |
38
|
|
|
* |
39
|
|
|
* @param \cs\Request $Request |
40
|
|
|
* |
41
|
|
|
* @throws \cs\ExitException |
42
|
|
|
*/ |
43
|
|
|
public static function admin_users_general_apply_settings ($Request) { |
44
|
|
|
static::admin_core_options_apply($Request, static::$users_general_options_keys); |
45
|
|
|
} |
46
|
|
|
/** |
47
|
|
|
* Save general users settings |
48
|
|
|
* |
49
|
|
|
* @param \cs\Request $Request |
50
|
|
|
* |
51
|
|
|
* @throws \cs\ExitException |
52
|
|
|
*/ |
53
|
|
|
public static function admin_users_general_save_settings ($Request) { |
54
|
|
|
static::admin_core_options_save($Request, static::$users_general_options_keys); |
55
|
|
|
} |
56
|
|
|
/** |
57
|
|
|
* Cancel general users settings |
58
|
|
|
* |
59
|
|
|
* @throws \cs\ExitException |
60
|
|
|
*/ |
61
|
|
|
public static function admin_users_general_cancel_settings () { |
62
|
|
|
static::admin_core_options_cancel(); |
63
|
|
|
} |
64
|
|
|
} |
65
|
|
|
|
Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a
@return
annotation as described here.