File modules/cms/action/userlist/UserlistAddAction.class.php
Last commit: Fri Feb 26 01:06:01 2021 +0100 Jan Dankert Refactoring accessing the request parameter values.
1 <?php 2 namespace cms\action\userlist; 3 use cms\action\Method; 4 use cms\action\RequestParams; 5 use cms\action\UserlistAction; 6 use cms\model\User; 7 use language\Messages; 8 use util\exception\ValidationException; 9 10 /** 11 * Adding a new user. 12 * 13 * @package cms\action\userlist 14 */ 15 class UserlistAddAction extends UserlistAction implements Method { 16 public function view() { 17 } 18 public function post( ) { 19 $name = $this->request->getAlphanum('name'); 20 21 $user = User::loadWithName($name,User::AUTH_TYPE_INTERNAL); 22 23 if ( !empty($user) ) 24 throw new ValidationException( 'name',Messages::USER_ALREADY_IN_DATABASE); 25 26 $user = new User(); 27 $user->name = $name; 28 $user->persist(); 29 $this->addNoticeFor($user, Messages::ADDED); 30 } 31 }
Downloadmodules/cms/action/userlist/UserlistAddAction.class.php
History Fri, 26 Feb 2021 01:06:01 +0100 Jan Dankert Refactoring accessing the request parameter values. Wed, 18 Nov 2020 01:46:36 +0100 Jan Dankert Refactoring of model classes: New method persist() and some other cleanups. Wed, 18 Nov 2020 00:18:10 +0100 Jan Dankert Refactoring Part 2: Removing all unnecessary methods in the action base classes. Tue, 17 Nov 2020 23:51:00 +0100 Jan Dankert Refactoring: Every Actionmethod has now its own class.