====== Vibemosphere ECM Core ====== ECM core on a JNDI data source: users, groups, central ACLs bound to objects, masks, documents; evaluate the access of a user (OpenAPI). ^ Id | ''ecm-core'' | ^ Role | ''rfc'' - needed for the page and the REST API (administrators always may) | ^ Page | **Plugins > Open** (overlay with an X at the top right) or ''/plugins/ecm-core/'' | ^ REST | ''/api/plugins/ecm-core/...'' and, for callers with the role, ''/plugins/ecm-core/...'' | ^ Mount | ''/api/ecm'' | ===== Open the configuration ===== In the administration open **Plugins**, select the row of this plug-in and press **Open**. The page opens in an overlay dialog: close it with the **X** at the top right, with Esc or by clicking outside; //Open in a new tab// next to the title shows it full size. {{vibecat:plugin-ecm-core.png?900|Vibemosphere ECM Core: the plug-in page in its overlay dialog}} ===== The page in detail ===== {{vibecat:plugin-ecm-core-full.png?900|Vibemosphere ECM Core: the whole page (playground instance)}} The page has these sections: **Data source**, **Tables**, **Users and groups**, **Central ACLs**, **Objects**, **Access evaluation**, **API**. ===== Fields and columns ===== ^ Label ^ Meaning ^ | Id (empty: next free) | | | Name | | | Login (the caller of the API) | | | E-mail | | | Member of (names or ids, comma separated) | | | Description | | | Name (optional) | | | ACL string, e.g. 75PYJA (Everyone) | | | ACL id (empty: that of the folder) | | | ACL id (see the ACL tab) | | | JNDI data source (page Data sources) | | | Table prefix | | | Folder of the documents | | | Object without ACL | | | Look at it as | | | needs | | | Table | Column of a table | | Exists | Column of a table | | Rows | Column of a table | | Id | Column of a table | | Type | Column of a table | | Login | Column of a table | | Member of | Column of a table | | Entries | Column of a table | | Objects | Column of a table | | ACL | Column of a table | | Access of the user | Column of a table | | Groups | Column of a table | | ACLs with read | Column of a table | | Readable objects | Column of a table | ===== Actions ===== * **Setup** * **Users and groups** * **ACLs** * **Objects** * **Access evaluation** * **API** * **Save** * **Create the tables** * **New** * **Import ELO ACL string** * **New ACL** * **New folder** * **New document** * **Search** * **Close** ===== Notes from the page ===== * The id is the user id of the ELO system (so ACL strings of VECDS / ELO can be imported); Everyone (9999) applies to every user, groups can be nested. * Search a user or group, see what it can reach, and check one object: which entries of the ACL decide, with the groups the user gets them from. ===== Reference ===== ECM functions for Vibecat on a **JNDI data source**, cloned from the VECDS core and the ECM libraries (''ecm_vscode\libs''): users and groups, **central ACL tables** bound to the objects by ''aclid'', keyword masks, folders and documents, and an **access evaluation** that works like VECDS. The API is described by OpenAPI: ''GET /api/ecm/openapi.json''. ==== Setup ==== - Define the JDBC data source on the page //Data sources// (MariaDB / MySQL, PostgreSQL, Oracle and SQL Server are supported by the DDL). - Choose it on the page of the plug-in (//Setup//), or ''PUT /settings {"dataSource": "jdbc/ecm"}'', then //Create the tables// (''POST /schema/install'', idempotent). ^ table (prefix ''ecm_'') ^ content ^ | userobject, groupmember | users and groups with the ids of the ELO system; nested groups | | **acl, ace** | the central ACLs and their entries (principal, rights bit mask, deny) | | **objekte** | folders and documents; ''aclid'' binds an ACL; soft delete | | docmasks, masklines, objkeys | masks, their keywords, the keyword values of the objects | | report | writes, ACL changes and denied accesses | The documents are files in the storage folder (''guid[0..2]/guid[2..4]/guid.ext'', MD5 checksum). ==== The ACL logic (as in VECDS) ==== ^ right ^ bit ^ needed for ^ | read (R) | 1 | see / read an object, download the document | | write (W) | 2 | change the object and its keywords | | delete (D) | 4 | delete the object (and everything below) | | edit (E) | 8 | store a new document | | list (L) | 16 | add an object to a folder / move it there | | permission (P) | 32 | bind another ACL to the object | | space (S) | 64 | kept for the workspace rights of ELO | * The rights of a user are the **sum** of the entries for the user, for all his groups (nested ones too) and for **Everyone (9999)** - the evaluation of ''ComputeEffectiveAccess''. Keyword entries (ELO "key" entries) are kept but do not count. * Extension: an entry can **deny** rights; the result is ''allow & ~deny''. * An object without an ACL (or an ACL without entries) is open for everybody, like in VECDS; setting ''noAcl = none'' closes it. * A new object takes the ACL of its parent when ''aclId'' / ''aclString'' is not given. * **ELO ACL strings** (''75PYJA'' = Everyone with 31) are read and written: ''POST /acls/import'', ''GET /acls/{id}/export'', ''aclString'' when creating an object or ACL. The ACL with the same entries is reused. * The memberships and ACL entries are cached for 5 seconds (and dropped at every change), like the principal cache of VECDS. ==== Evaluate the API as a user (read only access, search access) ==== An **administrator** sees everything. Add ''asUser='' to any object call and the call is read as that user: lists are filtered (''right=read'' by default), single objects answer **403** without the right, writes need write / list / delete / permission, and every object carries ''access'' (the rights of the user). A caller who is not an administrator is mapped to the user with his login. GET /api/ecm/objects?parentId=root&asUser=alice what may Alice read GET /api/ecm/objects?asUser=alice&right=write&nameLike=offer what may she change GET /api/ecm/objects/12?asUser=carol 403 when she may not read it GET /api/ecm/access/check?user=alice&object=12&right=write allowed? why? (principals, matching entries, all entries) GET /api/ecm/access/search?q=sales users and groups: groups, ACLs with read, readable objects GET /api/ecm/access/user/alice everything alice reaches: ACLs with rights and entries GET /api/ecm/access/user/9998/objects?right=read what a group may read GET /api/ecm/acls/5/effective every user with rights on ACL 5 (groups resolved) POST /api/ecm/access/evaluate {"user":"alice","right":"read","objects":[1,2,3]} POST /api/ecm/token/queryAclToken {"userId":4,"ttlMinutes":30} then ...?aclToken=... reads as that user ==== Users, groups, ACLs, objects ==== POST /principals {"type":"GROUP","name":"Sales"} POST /principals {"type":"USER","name":"Alice","login":"alice","groups":["Sales"]} POST /acls {"name":"Sales read","entries":[{"principal":"Sales","rights":"RL"},{"principal":"Accounting","rights":"R","deny":true}]} POST /objects {"name":"Offers","type":"FOLDER","parentId":1,"aclId":3,"metadata":{"CUSTOMER":"ACME"}} PUT /objects/12/acl {"aclId":4} PUT /objects/12/content?fileName=offer.pdf (the body is the file) GET /objects/12/content GET /objects?metadata=CUSTOMER%3DACME Rights can be a number (''17''), letters (''"RWDELP"''), names (''"read,list"'', ''["read","list"]'', ''all'', ''readonly''). ==== Calling ==== On the web ports the plug-in is mounted at ''/api/ecm'' (Basic login or ''Authorization: Bearer ''); on the administration port the same calls are below ''/api/plugins/ecm-core''. Objects, masks (read) are open to the role ''rfc'', everything that manages users, ACLs, masks, settings or evaluates other users needs the ''admin'' role. Errors are JSON ''{"error": "..."}'' with the status (400 / 403 / 404 / 409). ==== Not (yet) in it ==== Hibernate entities of ''ecm_vscode'' were turned into plain JDBC tables; not taken over: document history (''dochistory''), sticky notes, object history keys and the Elasticsearch sync (the report table records the writes). Keyword entries of ACL strings are stored but do not count (as in VECDS); the ''andGroups'' of ACL items are not supported. [[vibecat:plugins:start|All plug-ins]]