Ejemplo n.º 1
0
 public function newAction()
 {
     $table = new USVN_Db_Table_Users();
     $this->view->user = $table->createRow();
     $table = new USVN_Db_Table_Groups();
     $this->view->groups = $table->fetchAll(null, 'groups_name');
 }
Ejemplo n.º 2
0
Archivo: User.php Proyecto: phpscr/usvn
 /**
  * Create a new user
  *
  * @param array User attributes
  * @param boolean true : create a homonym group's
  * @param array|null Group's id which this user must be affected
  * @return USVN_User
  */
 public static function create($data, $createGroup, $groups = null)
 {
     $user = new USVN_User();
     $table = new USVN_Db_Table_Users();
     $user->user = $table->createRow($data);
     $user->createGroup = $createGroup;
     $user->groups = $groups;
     return $user;
 }
Ejemplo n.º 3
0
 /**
  * This method will write create an admin
  *
  * Throw an exception in case of problems.
  *
  * @param string Path to the USVN config file
  * @param string Admin login
  * @param string Admin password
  * @param string Admin first name
  * @param string Admin last name
  * @param string Admin email
  * @throw USVN_Exception
  */
 public static function installAdmin($config_file, $login, $password, $firstname, $lastname, $email)
 {
     if (empty($password)) {
         throw new USVN_Exception(T_('Password empty'));
     }
     $userTable = new USVN_Db_Table_Users();
     $user = $userTable->createRow();
     $user->login = $login;
     $user->password = $password;
     $user->firstname = $firstname;
     $user->lastname = $lastname;
     $user->email = $email;
     $user->is_admin = true;
     $user->secret_id = md5(time() . mt_rand());
     $user->save();
 }