<?xml version="1.0" encoding="iso-8859-1"?>
<chapter id="administration_users">
  <title>User administration</title>
  
  <para>This chapter should help you with the administration of your
    moregroupware installation and explains the tools available for
    administrators in the admin module.
  </para>
  
  <section id="administration_users_create_batch">
    
    <title>Create new users from a file</title>
    
    <para>
      Make a CSV file (e. g. <filename>users.csv</filename>) with your
      favourite text editor with the following fields and structure:
    </para>
    
    <programlisting>
    "username","last name","first name","occupation","workplace","birthday","gender","mobile","phone","email","password"
    </programlisting>
    
    <para>Make one line for each user. Use a line feed between each
      user. If you use Word or another word processing tool you must be sure
      that you save the file in plain text without any formatting. The quotes
      around the fields are important. User names may only contain alphanumeric
      characters (A-Z, a-z, 0-9).
    </para>
    
    <para>Start moregroupware as admin, go to the admin module and enter
      the user manager. Start the import with the choice "Create new users
      (from file)".
    </para>
    
    <para>You will see a form with three input fields. With the file input
      locate and select your created CSV file. Additionally you can set
      defaults for language and group the new users shall have. A click on
      the submit button starts the import process.
    </para>
    
  </section>
  
</chapter>

<chapter id="administration_complaints">
  <title>Common user complaints</title>
  
  <para>This chapter will give answers that come in handy for common
    things users (not) want to have when working with
    moregroupware.
  </para>
  
  <section id="administration_complaints_session_timeout">
    <title>Session timeout</title>
    
    <para>If you leave your computer for a while logged in into
      moregroupware you can "loose the connection" and you must do a new
      login. This is caused by the session becoming too old. To get rid of
      the session timeout problem you can open <filename>php.ini</filename>
      in a text editor and search for:
    </para>
    
    <programlisting>
      session.gc_maxlifetime = 1440
    </programlisting>
    
    <para>The default setting is set to 1440 seconds for the timeout
      (automatically removing of the stored session after 24
      minutes).
    </para>
    
    <para>If you increase the value, save the changed file and restart the
      web server the problem shall be solved or at least reduced.
    </para>
    
    <note>
      <para>This has (of course) a drawback: the longer the session
        "lives" without user activity, the greater the danger of intrusion
        is. If you leave your computer unattended, and some other person can
        use your login, this may cause trouble. Keep this in mind when
        changing this setting (or educate your users to always log out when
        leaving the computer). This mostly applies to "untrusted
        environments", of course.
      </para>
    </note>
    
  </section>
  
</chapter>

<chapter id="administration_backup">
  <title>Backing up your more.groupware data</title>
  
  <para>Backups are tedious. Especially since we have no backup module
    yet. But believe me, a backup can save you day, so you should really
    think about it.
  </para>
  
  <section id="administration_backup_mysql">
    
    <title>Backup of your MySQL database</title>
    
    <para>One way to do a manually backup from the command prompt will be
      described below.
    </para>
    
    <note>
      <para>Agraphical web based tool to help you with the tasks
        described in this section is phpMyAdmin which can be downloaded from
        <ulink url="http://www.phpmyadmin.net/">http://www.phpmyadmin.net/
      </ulink>
    </para>
  </note>
  
  <para>Start a terminal session (Linux) or command prompt
    (Windows) and enter the following command:
  </para>
  
  <para>
    <command>mysqldump --add-drop-table -a -u username -p database
      &gt; path/to/backup.sql
    </command>
  </para>
  
  <para>
    You must replace <literal>username</literal> with the name of a
    user that can read the tables in the <literal>database</literal> you
    use for more.groupware. <literal>path/to/backup.sql</literal> is the
    path and name to the file that will be written during backup,
    e. g. <filename>C:\backup\mgwbackup.sql</filename>.
  </para>
  
  <para>
    If you get <computeroutput>bad command</computeroutput> or
    something like that you have to use <command>cd</command> to go to the
    MySQL bin system folder (e. g.  <command>cd C:\mysql\bin</command>)
    before you run the command again.
  </para>
  
  <para>After entering the command you have to press the enter
    key. Input the MySQL password of the user <literal>username</literal>
    and press enter yet another time. The backup will be dumped to the
    given file.
  </para>
  
  <para>Now you have a backup of the database which can be stored at a
    safe place. But you should also make a copy of the whole moregroupware
    folder (<command>cp -R mgwfolder backupfolder</command> if you use
    Linux or the graphical Explorer if you use Windows).
  </para>
  
  <para>You must do a folder copy to get a backup of your emails which
    are stored in <filename>modules\webmail2\store</filename>, the
    contents of the files module and the configuration file called
    <filename>config.inc.php</filename>.
  </para>
  
</section>

<section id="administration_backup_mysql_restore">
  
  <title>Restore of your MySQL database</title>
  
  <para>A backup only makes sense if you can actually restore it. So you
    should try this at least once before a desaster, to make sure it all
    works as expected!
  </para>
  
  <note>
    <para>Agraphical web based tool to help you with the tasks
      described in this section is phpMyAdmin which can be downloaded from
      <ulink url="http://www.phpmyadmin.net/">http://www.phpmyadmin.net/
    </ulink>
  </para>
</note>

<para><orderedlist>
    <listitem>
      <para>Configure your computer with the same Apache and MySQL
        settings as before the 'computer crash'.
      </para>
    </listitem>
    <listitem>
      <para>Copy your mgw folder backup back to the same place
        your old installation was placed in.
      </para>
    </listitem>
    <listitem>
      <para>Run this to create an empty database:</para>
      <para>
        <command>mysql -u username -p -e 'CREATE DATABASE database'</command>
      </para>
      <para>
        Use the same <literal>database</literal> name as the old
        database had. Replace <literal>username</literal> with the name of a
        user that can create a database.
      </para>
    </listitem>
    <listitem>
      <para>Restore the data with the command:</para>
      <para>
        <command>mysql -u username -p database &lt; path/to/backup.sql</command>
      </para>
      <para>
        You must replace <literal>username</literal> with the name of a
        user that can create tables in the <literal>database</literal> you use
        just created. <literal>path/to/backup.sql</literal> is the path and
        name to the file that was written during backup,
        e. g. <filename>C:\backup\mgwbackup.sql</filename>. After entering the
        command you have to press enter. Insert the MySQL password and press
        enter yet another time. The database will be restored with all the
        information from the backup file.
      </para>
    </listitem>
  </orderedlist>
</para>

<para>Hopefully you can log into Moregroupware now without
  any data loss!
</para>

</section>

</chapter>
