|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* @package CleverStyle Framework |
|
4
|
|
|
* @subpackage System module |
|
5
|
|
|
* @category modules |
|
6
|
|
|
* @author Nazar Mokrynskyi <[email protected]> |
|
7
|
|
|
* @license 0BSD |
|
8
|
|
|
*/ |
|
9
|
|
|
namespace cs\modules\System\api\Controller\admin\users; |
|
10
|
|
|
use |
|
11
|
|
|
cs\Config; |
|
12
|
|
|
|
|
13
|
|
|
trait general { |
|
14
|
|
|
protected static $users_general_options_keys = [ |
|
15
|
|
|
'session_expire', |
|
16
|
|
|
'remember_user_ip', |
|
17
|
|
|
'password_min_length', |
|
18
|
|
|
'password_min_strength', |
|
19
|
|
|
'allow_user_registration', |
|
20
|
|
|
'require_registration_confirmation', |
|
21
|
|
|
'registration_confirmation_time', |
|
22
|
|
|
'auto_sign_in_after_registration' |
|
23
|
|
|
]; |
|
24
|
|
|
/** |
|
25
|
|
|
* Get general users settings |
|
26
|
|
|
* |
|
27
|
|
|
* @return array |
|
28
|
|
|
*/ |
|
29
|
|
|
public static function admin_users_general_get_settings () { |
|
30
|
|
|
$Config = Config::instance(); |
|
31
|
|
|
return $Config->core(static::$users_general_options_keys) + [ |
|
32
|
|
|
'applied' => $Config->cancel_available() |
|
33
|
|
|
]; |
|
34
|
|
|
} |
|
35
|
|
|
/** |
|
36
|
|
|
* Apply general users settings |
|
37
|
|
|
* |
|
38
|
|
|
* @param \cs\Request $Request |
|
39
|
|
|
* |
|
40
|
|
|
* @throws \cs\ExitException |
|
41
|
|
|
*/ |
|
42
|
|
|
public static function admin_users_general_apply_settings ($Request) { |
|
43
|
|
|
static::admin_core_options_apply($Request, static::$users_general_options_keys); |
|
44
|
|
|
} |
|
45
|
|
|
/** |
|
46
|
|
|
* Save general users settings |
|
47
|
|
|
* |
|
48
|
|
|
* @param \cs\Request $Request |
|
49
|
|
|
* |
|
50
|
|
|
* @throws \cs\ExitException |
|
51
|
|
|
*/ |
|
52
|
|
|
public static function admin_users_general_save_settings ($Request) { |
|
53
|
|
|
static::admin_core_options_save($Request, static::$users_general_options_keys); |
|
54
|
|
|
} |
|
55
|
|
|
/** |
|
56
|
|
|
* Cancel general users settings |
|
57
|
|
|
* |
|
58
|
|
|
* @throws \cs\ExitException |
|
59
|
|
|
*/ |
|
60
|
|
|
public static function admin_users_general_cancel_settings () { |
|
61
|
|
|
static::admin_core_options_cancel(); |
|
62
|
|
|
} |
|
63
|
|
|
} |
|
64
|
|
|
|