NetworkMaps
Try it NowSource CodeDocs
The Admin CLI.
Introduction.
NetworkMaps comes with an admin cli that allows you to manage users of networkmaps. This admin cli is specially important if networkmaps is configured not to allow users to self register (and we are not using LDAP to manage these users).
The admin CLI can be found on the root directory: nm_admin_cli.js
Using this cli, we can create/modify/delete users, change their password, change diagram ownership, ... as well as get list of users, diagrams, active sessions, ...
The admin cli uses the admin library for this purpose: networkmapsadminlib.js. You can also use the library directly to programatically manage users.
Usage.
To use the admin cli, we have to follow these steps:
  1. Create an authenticated session (if we don't already have one). This will give use a session ID (64 characters), which we can use in further calls
    nm_admin_cli.js <options> login <admin_user> <admin_password>
  2. Run the commands for the actions we want to execute using the obtained session id.
  3. Logout on the created session.
    nm_admin_cli.js --session <session id$gt; <options> logout
Syntax.
~/networkmaps$ ./nm_admin_cli.js
NetworkMaps Admin CLI. Developed by Pablo Martin Leon.
Usage: nm_admin_cli.js <options> <command> <arguments>
Mandatory options:
    --server <server>: server name or ip.
    --port <port>: port where the server is listening
    --session <session_id>: session id to be used. We get this session on the login call (on login call, this parameters is not mandatory).
Optional Options:
    -t: use ssl/tls.
    -n: don't verify server certificate
Commands:
    nm_admin_cli.js help
        Display this message.

    nm_admin_cli.js <options> login <admin_user> <admin_password>
        Authenticate and create a session with the server. Will return the session id that can be used in subsecuent calls.

    nm_admin_cli.js <options> logout
        Logout the session. Recommended to run this command once the session is not needed anymore.

    nm_admin_cli.js <options> get_users
        Get a JSON string with all the users and their data.

    nm_admin_cli.js <options> get_diagrams
        Get a JSON string with all the diagrams and their data.

    nm_admin_cli.js <options> get_sessions
        Get a JSON string with all the sessions and their data.

    nm_admin_cli.js <options> add_user <email> <name> <lastname> <password>
        Create a user with the parameters provided.

    nm_admin_cli.js <options> change_user_data <email> <name> <lastname>
        Change the name and lastname of a user identified by email.

    nm_admin_cli.js <options> change_user_password <email> <password>
        Change user password.

    nm_admin_cli.js <options> delete_user <email>
        Delete user identified by 'email'.

    nm_admin_cli.js <options> delete_diagram <uuid>
        Delete diagram 'uuid'.

    nm_admin_cli.js <options> change_diagram_ownership <uuid> <email>
        Change the owner of diagram 'uuid' to 'email'.

Sample:
    Login:
        nm_admin_cli.js --server 10.0.0.1 --port 443 -t login admin my_password

        This call will give us a session ID that we can use later on other calls.

    Add User:
        nm_admin_cli.js --server 10.0.0.1 --port 443 --session f7da3c65b07aca17ccc1a37a36c6c7b47df2363d8523d9347adf127f49b2e543 -t add_user john@somedomain.com John Smith john_password
                div(class="doc_head").
                    Samples.
                div(class="doc_paragraph").
                    TODO