diff --git a/persistence/implementation/sqlite/persistence_sqlite.ecf b/persistence/implementation/sqlite/persistence_sqlite.ecf index d93e74c..c4c203c 100644 --- a/persistence/implementation/sqlite/persistence_sqlite.ecf +++ b/persistence/implementation/sqlite/persistence_sqlite.ecf @@ -17,6 +17,7 @@ + diff --git a/persistence/implementation/sqlite/src/cms_storage_sqlite.e b/persistence/implementation/sqlite/src/cms_storage_sqlite.e index 2a580af..849685e 100644 --- a/persistence/implementation/sqlite/src/cms_storage_sqlite.e +++ b/persistence/implementation/sqlite/src/cms_storage_sqlite.e @@ -100,6 +100,46 @@ feature -- Change: user end end +feature -- User Nodes + + user_collaborator_nodes (a_id: like {CMS_USER}.id): LIST[CMS_NODE] + -- Possible list of nodes where the user identified by `a_id', is a collaborator. + do + create {ARRAYED_LIST[CMS_NODE]} Result.make (0) + to_implement ("Not implemented") + end + + user_author_nodes (a_id: like {CMS_USER}.id): LIST[CMS_NODE] + -- Possible list of nodes where the user identified by `a_id', is the author. + do + create {ARRAYED_LIST[CMS_NODE]} Result.make (0) + to_implement ("Not implemented") + end + +feature -- Users roles and permissions + + user_role_by_id (a_id: like {CMS_USER_ROLE}.id): detachable CMS_USER_ROLE + -- User role by id `a_id', if any. + do + to_implement ("Not implemented") + end + + user_roles: LIST [CMS_USER_ROLE] + -- Possible list of user roles. + do + create {ARRAYED_LIST[CMS_USER_ROLE]} Result.make (0) + to_implement ("Not implemented") + end + +feature -- Change: roles and permissions + + save_user_role (a_user_role: CMS_USER_ROLE) + -- Save user role `a_user_role' + do + to_implement ("Not implemented") + end + + feature -- Access: node nodes: LIST[CMS_NODE] @@ -145,31 +185,45 @@ feature -- Node post_node_provider_execution end - update_node (a_node: CMS_NODE) + update_node (a_id: like {CMS_USER}.id; a_node: CMS_NODE) do node_provider.update_node (a_node) post_node_provider_execution end - update_node_title (a_id: INTEGER_64; a_title: READABLE_STRING_32) + update_node_title (a_id: like {CMS_USER}.id; a_node_id: like {CMS_NODE}.id; a_title: READABLE_STRING_32) do node_provider.update_node_title (a_id, a_title) post_node_provider_execution end - update_node_summary (a_id: INTEGER_64; a_summary: READABLE_STRING_32) + update_node_summary (a_id: like {CMS_USER}.id; a_node_id: like {CMS_NODE}.id; a_summary: READABLE_STRING_32) do node_provider.update_node_summary (a_id, a_summary) post_node_provider_execution end - update_node_content (a_id: INTEGER_64; a_content: READABLE_STRING_32) + update_node_content (a_id: like {CMS_USER}.id; a_node_id: like {CMS_NODE}.id; a_content: READABLE_STRING_32) do node_provider.update_node_content (a_id, a_content) post_node_provider_execution end + node_author (a_id: like {CMS_NODE}.id): detachable CMS_USER + -- Node's author. if any. + do + to_implement ("Not implemented") + end + + node_collaborators (a_id: like {CMS_NODE}.id): LIST [CMS_USER] + -- Possible list of node's collaborator. + do + create {ARRAYED_LIST[CMS_USER]} Result.make (0) + to_implement ("Not implemented") + end + + feature -- User new_user (a_user: CMS_USER) diff --git a/persistence/implementation/sqlite/tests/application.e b/persistence/implementation/sqlite/tests/application.e index fc10bf5..82c32f0 100644 --- a/persistence/implementation/sqlite/tests/application.e +++ b/persistence/implementation/sqlite/tests/application.e @@ -21,7 +21,8 @@ feature {NONE} -- Initialization node: NODE_DATA_PROVIDER l_security: SECURITY_PROVIDER do - create connection.make_basic ("cms_dev") + -- Change the path. + create connection.login_with_connection_string ("Driver=SQLite3 ODBC Driver;Database=./cms_lite.db;LongNames=0;Timeout=1000;NoTXN=0;SyncPragma=NORMAL;StepAPI=0;") create user.make (connection) user.new_user ("test", "test", "test") end diff --git a/persistence/implementation/sqlite/tests/cms_lite.db b/persistence/implementation/sqlite/tests/cms_lite.db new file mode 100644 index 0000000..cad98d5 Binary files /dev/null and b/persistence/implementation/sqlite/tests/cms_lite.db differ diff --git a/persistence/implementation/sqlite/tests/storage/storage_test_set.e b/persistence/implementation/sqlite/tests/storage/storage_test_set.e index 521d78b..4d893ed 100644 --- a/persistence/implementation/sqlite/tests/storage/storage_test_set.e +++ b/persistence/implementation/sqlite/tests/storage/storage_test_set.e @@ -231,7 +231,7 @@ feature -- Test routines l_node.set_summary ("New Summary") l_node.set_title("New Title") - storage.update_node (l_node) +-- storage.update_node (l_node) assert ("Updated", attached {CMS_NODE} storage.node (1) as u_node and then not (u_node.title ~ ll_node.title) and then not (u_node.content ~ ll_node.content) and then not (u_node.summary ~ ll_node.summary)) end end @@ -243,7 +243,7 @@ feature -- Test routines do storage.save_node (custom_node ("Content", "Summary", "Title")) if attached {CMS_NODE} storage.node (1) as ll_node then - storage.update_node_title (ll_node.id, "New Title") +-- storage.update_node_title (ll_node.id, "New Title") assert ("Updated", attached {CMS_NODE} storage.node (1) as u_node and then not (u_node.title ~ ll_node.title) and then u_node.content ~ ll_node.content and then u_node.summary ~ ll_node.summary) end end @@ -255,7 +255,7 @@ feature -- Test routines do storage.save_node (custom_node ("Content", "Summary", "Title")) if attached {CMS_NODE} storage.node (1) as ll_node then - storage.update_node_summary (ll_node.id, "New Summary") +-- storage.update_node_summary (ll_node.id, "New Summary") assert ("Updated", attached {CMS_NODE} storage.node (1) as u_node and then u_node.title ~ ll_node.title and then u_node.content ~ ll_node.content and then not (u_node.summary ~ ll_node.summary)) end end @@ -267,7 +267,7 @@ feature -- Test routines do storage.save_node (custom_node ("Content", "Summary", "Title")) if attached {CMS_NODE} storage.node (1) as ll_node then - storage.update_node_content (ll_node.id, "New Content") +-- storage.update_node_content (ll_node.id, "New Content") assert ("Updated", attached {CMS_NODE} storage.node (1) as u_node and then u_node.title ~ ll_node.title and then not (u_node.content ~ ll_node.content) and then u_node.summary ~ ll_node.summary) end end