# lcmlog-server Server side of a tool for reading and writing the lcm staff logs. - `lcmlog-server`: main script - `lcmlog-server-utils`: utility script ## Input pipeline The first line is always the name of the method and can be only `GET`, `POST` or `UPDATE`. ### GET The `GET` method is used to print all the logs that meet the required criteria. * The second line of the input is the type of log to search for (see below), and it is the only mandatory parameter. * The third line is the date: only logs whose date contains the searched date are printed. * The fourth line is a list of comma separated tags to search for. * The fifth line is the name of the user to search for. ### POST The `POST` method is used to add a log to the database. * The second line of the input is the type (se below). * The third one is the date. * The fourth one is a list of comma separated tags. * The fifth one is, optionally, "MAIL" if the server should email the log contents after storing them in the database (the mail program should be preconfigured for this to work) * The remainder of the file (until EOF is met) is the content of the log. ### UPDATE The `UPDATE` method is used to regenerate the internal server database. It should only be called if a log file is added by hand, or if some of the log files get renamed or corrupted. It assumes that all the log files are correctly formatted. ## Authentication groups There are four authentication groups with the following privileges: - 150: `GET 150`, `GET Admin` and `POST 150`. - Admin: `GET 150`, `GET Admin`, `POST 150`, `POST Admin` and `UPDATE`. - Nirvana (ex admin): `GET 150`, `GET Admin` and `POST Admin`. - Valhalla (ex 150): `GET 150` and `GET Admin`. ## Initialize the environment The default directory is `/var/local/log/lcmlog-data`. ### 1) Initialization of the folder structure Initialize the environment using `lcmlog-server-utils -i`. The structure is: - `auth` - `auth.toml` - `150` - `Admin` - `Nirvana` - `Valhalla` - `data` - `.data` - `logs` - `logfile` ### 2) Add users in authentication groups Edit files in `auth` folder for add users in a group. The format of a row is: ``` UID username ``` ### 3) Update ACL Authentication for read/write is based upon the access control list. To update ACL after _every_ changes in the `auth` folder, use `lcmlog-server-utils -u`. ## Manage the environment - You can lookup authorizations using `lcmlog-server-utils -l`. - You can change authorizations by editing files in `auth` folder and then using `lcmlog-server-utils -u` to update ACL. - You can change the default privileges of an authentication groups by editing the `auth/auth.toml` file: ``` ["example-group"] auth=["priv-1","priv-2",...] ``` The available privileges are: `GET 150`, `GET Admin`, `POST 150`, `POST Admin` and `UPDATE`. No further action is needed after editing this file.