|
|
|
@ -191,6 +191,12 @@ class FreshRSS_user_Controller extends Minz_ActionController { |
|
|
|
|
case 'demote': |
|
|
|
|
$this->demoteAction(); |
|
|
|
|
break; |
|
|
|
|
case 'enable': |
|
|
|
|
$this->enableAction(); |
|
|
|
|
break; |
|
|
|
|
case 'disable': |
|
|
|
|
$this->disableAction(); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -332,6 +338,7 @@ class FreshRSS_user_Controller extends Minz_ActionController { |
|
|
|
|
$ok = self::createUser($new_user_name, $email, $passwordPlain, array( |
|
|
|
|
'language' => Minz_Request::param('new_user_language', FreshRSS_Context::$user_conf->language), |
|
|
|
|
'is_admin' => Minz_Request::paramBoolean('new_user_is_admin'), |
|
|
|
|
'enabled' => true, |
|
|
|
|
)); |
|
|
|
|
Minz_Request::_param('new_user_passwordPlain'); //Discard plain-text password ASAP |
|
|
|
|
$_POST['new_user_passwordPlain'] = ''; |
|
|
|
@ -550,14 +557,22 @@ class FreshRSS_user_Controller extends Minz_ActionController { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function promoteAction() { |
|
|
|
|
$this->switchAdminAction(true); |
|
|
|
|
$this->toggleAction('is_admin', true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function demoteAction() { |
|
|
|
|
$this->switchAdminAction(false); |
|
|
|
|
$this->toggleAction('is_admin', false); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function enableAction() { |
|
|
|
|
$this->toggleAction('enabled', true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function disableAction() { |
|
|
|
|
$this->toggleAction('enabled', false); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private function switchAdminAction($isAdmin) { |
|
|
|
|
private function toggleAction($field, $value) { |
|
|
|
|
if (!FreshRSS_Auth::hasAccess('admin')) { |
|
|
|
|
Minz_Error::error(403); |
|
|
|
|
} |
|
|
|
@ -575,9 +590,10 @@ class FreshRSS_user_Controller extends Minz_ActionController { |
|
|
|
|
Minz_Error::error(500); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$userConfig->_param('is_admin', $isAdmin); |
|
|
|
|
$userConfig->_param($field, $value); |
|
|
|
|
|
|
|
|
|
$ok = $userConfig->save(); |
|
|
|
|
FreshRSS_UserDAO::touch($username); |
|
|
|
|
|
|
|
|
|
if ($ok) { |
|
|
|
|
Minz_Request::good(_t('feedback.user.updated', $username), array('c' => 'user', 'a' => 'manage')); |
|
|
|
@ -597,7 +613,6 @@ class FreshRSS_user_Controller extends Minz_ActionController { |
|
|
|
|
Minz_Error::error(404); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$this->view->isDefaultUser = $username === FreshRSS_Context::$system_conf->default_user; |
|
|
|
|
$this->view->username = $username; |
|
|
|
|
$this->view->details = $this->retrieveUserDetails($username); |
|
|
|
|
} |
|
|
|
@ -615,8 +630,10 @@ class FreshRSS_user_Controller extends Minz_ActionController { |
|
|
|
|
'database_size' => $databaseDAO->size(), |
|
|
|
|
'language' => $userConfiguration->language, |
|
|
|
|
'mail_login' => $userConfiguration->mail_login, |
|
|
|
|
'enabled' => $userConfiguration->enabled, |
|
|
|
|
'is_admin' => $userConfiguration->is_admin, |
|
|
|
|
'last_user_activity' => date('c', FreshRSS_UserDAO::mtime($username)), |
|
|
|
|
'is_default' => FreshRSS_Context::$system_conf->default_user === $username, |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|