Create user

    CLI Example:

    .. code-block:: bash

        salt '*' ilo.create_user damian secretagent VIRTUAL_MEDIA_PRIV

    If no permissions are specify the user will only have a read-only account.

    Supported privelges:

    * ADMIN_PRIV
      Enables the user to administer user accounts.

    * REMOTE_CONS_PRIV
      Enables the user to access the Remote Console functionality.

    * RESET_SERVER_PRIV
      Enables the user to remotely manipulate the server power setting.

    * VIRTUAL_MEDIA_PRIV
      Enables the user permission to access the virtual media functionality.

    * CONFIG_ILO_PRIV
      Enables the user to configure iLO settings.

def create_user(name, password, *privileges):
    '''
    Create user

    CLI Example:

    .. code-block:: bash

        salt '*' ilo.create_user damian secretagent VIRTUAL_MEDIA_PRIV

    If no permissions are specify the user will only have a read-only account.

    Supported privelges:

    * ADMIN_PRIV
      Enables the user to administer user accounts.

    * REMOTE_CONS_PRIV
      Enables the user to access the Remote Console functionality.

    * RESET_SERVER_PRIV
      Enables the user to remotely manipulate the server power setting.

    * VIRTUAL_MEDIA_PRIV
      Enables the user permission to access the virtual media functionality.

    * CONFIG_ILO_PRIV
      Enables the user to configure iLO settings.
    '''
    _priv = ['ADMIN_PRIV',
             'REMOTE_CONS_PRIV',
             'RESET_SERVER_PRIV',
             'VIRTUAL_MEDIA_PRIV',
             'CONFIG_ILO_PRIV']

    _xml = """<RIBCL version="2.2">
                <LOGIN USER_LOGIN="x" PASSWORD="y">
                  <RIB_INFO mode="write">
                    <MOD_GLOBAL_SETTINGS>
                      <MIN_PASSWORD VALUE="7"/>
                    </MOD_GLOBAL_SETTINGS>
                  </RIB_INFO>

                 <USER_INFO MODE="write">
                   <ADD_USER USER_NAME="{0}" USER_LOGIN="{0}" PASSWORD="{1}">
                     {2}
                   </ADD_USER>
                 </USER_INFO>
               </LOGIN>
             </RIBCL>""".format(name, password, '\n'.join(['<{0} value="Y" />'.format(i.upper()) for i in privileges if i.upper() in _priv]))

    return __execute_cmd('Create_user', _xml)