For api documentation on the interfaces used by the cli see api documentation.
For general information on TinyDS see tinyds.
With Python3 installed:
$ python -c "from mmcli import mmcli; mmcli.run()"
(Cmd) help
Commands:
| add_signer | add a signer to a document |
| add_viewer | add a viewer to a document |
| audit | print audit logs for a document |
| comment | add a comment to a document |
| count | count documents |
| createfromtemplate | create a document from a template and metadata |
| delete | deletes a document |
| delete_version | deletes a specific version of a document |
| download | download and show a document in the webbrowser |
| exit | exit the CLI |
| external_sign | open sign page for a document in browser |
| external_view | open view page for a document in browser |
| freesearch | free text search for words or parts thereof in document content |
| getcomment | get comments for a document |
| getlock | get lock status for a document |
| getprofile | get user profile |
| help | display help information |
| link | link two documents together |
| list | list linked documents |
| listtemplates | list templates for the current user |
| lock | lock a document |
| login | used to log in to the server |
| login_server | change login server |
| logout | log out from the server |
| metadata | prints metadata for a document |
| quit | quit the CLI |
| register | register a user |
| reset_password | reset user password |
| search | search documents |
| server | change target server from the default |
| setprofile | set user profile |
| signers | list signers for a document |
| types | lists available document types |
| unlink | unlink two documents |
| unlock | unlock a document |
| update | updates a document's metadata |
| updateprofile | update user profile |
| upload | upload either a new document or a new version |
| url | get shareable URL for a document |
| users | list users |
| view | view a document in the browser |
| view_version | view a specific version of a document |
| viewers | list viewers for a document |
For detailed help for a command type: 'help '
However, if you belong to a group, your group administrator has to give you permissions before you can start. You will then be able to share documents within the group.
All commands except register and login need permissions. One can either register as a standalone user or as belonging to a group. In the first case the user has full permission but only the documents created by the user. In the latter case permissions have to be set up by a group administrator. For standalone users available document types and attributes are a set of standand and common for all. For group users those are defined in an admin gui. See below. In a future release admin operations will be available via an api and cli. Notifications can be received upon document creation or deletion. For an example this can be look at this link: notification client The client takes the url parameter ?group=group_name, where the group_name is the name of your group. The default server is a serverless lambda located on AWS, which also is the default server for this CLI. However, the client can be set to connect to a server anywhere, for example locally while testing, or againt a server running in a Docker container. MMDok can be accessed via a REST API. MMCli contains a Python client using this api.$ python3 -c "from mmcli import mmcli; mmcli.run()"
(Cmd) register Email:magnus@foo.bar Password: Do you belong to a group[Y|N]:Y Registration succeded. An email will be sent to you for confirmation. Please ask your group administration to give you permissions.
(Cmd) login Email:magnus@foo.bar Password: Login succeded Group: edok
(Cmd) types {'Faktura': {'_id': '611c18862271d9e4a5dae511', 'customer': 'edok', 'fields': {'Fakturanr': {'displayname': 'Invoice number', 'displayname_sv': 'Fakturanummer', 'format': '\d+', 'general': False, 'index': True, 'mandatory': True, 'name': 'Fakturanr', 'order': 1, 'placeholder': '123456', 'search': True, 'type': 'text', 'update': True, 'values': None}}, 'id': 1, 'name': 'Faktura', 'order': 1}} (Cmd) search Filter: {"Fakturanr":123459} Sort: From: Number: [{'_id': '611c2032d444ac00094333b5', 'creator': 'gustav@foo.bar', 'metadata': {'Fakturanr': '123459', 'type': 'Faktura'}, 'ts': '2021-08-17T20:46:42.853Z', 'type': 'Faktura', 'updated_by': 'gustav@foo.bar'}]
(Cmd) metadata Documentid: 611c2032d444ac00094333b5 {'Fakturanr': '123459', 'type': 'Faktura'}
(Cmd) count {'count': 14}
(Cmd) audit Documentid: 611c2032d444ac00094333b5 [{'op': 'create', 'ts': '2021-08-17T20:46:42.853Z', 'user': 'gustav@foo.bar'}, {'op': 'view', 'ts': '2021-08-17T21:24:33.977Z', 'user': 'gustav@foo.bar'}, {'op': 'view', 'ts': '2021-08-19T21:27:01.185Z', 'user': 'sture@foo.bar'}]
(Cmd) upload Provide a document id if it is a new version, leave empty for new document Docid: Chose document type: Faktura Metadata: {"Fakturanr":123} Path to files: /tmp/dummy.pdf True 612404f1c0c7380008f019ad
(Cmd) count {'count': 15}
There is a gui client available at gui client. The same login will work. Administrations of documenttypes, users and their permissions can also be done via MMCli using the mmadmin module. Admin commands are available via mmadmin for managing resources:
$ python -c "from mmcli import mmadmin; mmadmin.run()"
Admin Commands:
| create | create a new admin resource from JSON file |
| delete | delete an admin resource by ID |
| exit | exit the admin CLI |
| login | authenticate user via bankid, freja, apikey, or user-password |
| quit | exit the admin CLI |
| read | read an admin resource by name or list all |
| update | update an admin resource from JSON file |
Resources handled by the admin cli are fields, document types, roles, users and templates.
Let's say that we want to create a new document type with one field. We can create a JSON files with the following content:
[
{
"name": "test_field",
"displayname": "Test",
"displayname_sv": "Test",
"type": "number",
"placeholder": "900",
"order": 7,
"format": "^\\d+$",
"search": true,
"index": false,
"update": true,
"general": false,
"mandatory": false
}
]and a file
[
{
"name": "test_type",
"order": 1,
"fields": [
"test_field"
]
}
]Then we can create the document type using the following command, assuming that admin@foo.bar is a user with admin permissions for the group:
% python3 -c "from mmcli import mmadmin; mmadmin.run()"
(Cmd) login
bankid|freja|apikey|user-password: u
Email: admin@foo.bar
Password:
Code: 121212
Login succeded
(Cmd) create field data/fields/fields.json
Object 1: Status: 200
ok
(Cmd) create type data/types/types.json
Object 1: Status: 200
okPermission, roles, users and templates can be created in a similar way, with json-files that can be stored in for example a git repository. A full description is not given here.