diff options
author | friendica <info@friendica.com> | 2012-10-04 23:05:45 -0700 |
---|---|---|
committer | friendica <info@friendica.com> | 2012-10-04 23:05:45 -0700 |
commit | 7bee460df28bcd956206c3719e091fb500e3045d (patch) | |
tree | 4d06c81c9cfd39d2f88cab1c52aa5b6d11ef20ab /include/account.php | |
parent | 4302134fdd2640843aa1349e95285b966d1282ab (diff) | |
download | volse-hubzilla-7bee460df28bcd956206c3719e091fb500e3045d.tar.gz volse-hubzilla-7bee460df28bcd956206c3719e091fb500e3045d.tar.bz2 volse-hubzilla-7bee460df28bcd956206c3719e091fb500e3045d.zip |
provide auto admin registration as before, but allow the current admin to create other admins
Diffstat (limited to 'include/account.php')
-rw-r--r-- | include/account.php | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/include/account.php b/include/account.php index fa56afe7d..b850fcffd 100644 --- a/include/account.php +++ b/include/account.php @@ -77,6 +77,15 @@ function check_account_invite($invite_code) { } +function check_account_admin($arr) { + if(is_site_admin()) + return true; + $admin_mail = trim(get_config('system','admin_email')); + if(strlen($admin_email) && $admin_email === trim($arr['email'])) + return true; + return false; +} + function create_account($arr) { @@ -90,6 +99,7 @@ function create_account($arr) { $password2 = ((x($arr,'password2')) ? trim($arr['password2']) : ''); $parent = ((x($arr,'parent')) ? intval($arr['parent']) : 0 ); $flags = ((x($arr,'account_flags')) ? intval($arr['account_flags']) : ACCOUNT_OK); + $roles = ((x($arr,'account_roles')) ? intval($arr['account_roles']) : 0 ); $default_service_class = get_config('system','default_service_class'); if($default_service_class === false) @@ -100,6 +110,13 @@ function create_account($arr) { return $result; } + if($roles & ACCOUNT_ROLE_ADMIN) { + $admin_result = check_account_admin($arr); + if(! $admin_result) { + $roles = 0; + } + } + $invite_result = check_account_invite($invite_code); if($invite_result['error']) { $result['message'] = $invite_result['message']; @@ -134,7 +151,7 @@ function create_account($arr) { dbesc(get_best_language()), dbesc(datetime_convert()), dbesc($flags), - dbesc(0), + dbesc($roles), dbesc($expires), dbesc($default_service_class) |