From d41c45e5ac6c5faef29f813ee104f5e721b9d4b6 Mon Sep 17 00:00:00 2001 From: NikitaZotov Date: Tue, 20 Aug 2024 21:15:09 +0300 Subject: [PATCH] [memory][core][context] Authenticate before erasing negative sc-arcs --- sc-memory/sc-core/src/sc_memory_context_permissions.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sc-memory/sc-core/src/sc_memory_context_permissions.c b/sc-memory/sc-core/src/sc_memory_context_permissions.c index 15370e9ac..5e0c2612b 100644 --- a/sc-memory/sc-core/src/sc_memory_context_permissions.c +++ b/sc-memory/sc-core/src/sc_memory_context_permissions.c @@ -297,6 +297,10 @@ sc_result _sc_memory_context_manager_on_authentication_request_user( sc_memory_element_free(s_memory_default_ctx, connector_addr); + sc_addr const auth_arc_addr = sc_memory_arc_new( + s_memory_default_ctx, sc_type_const_temp_pos_arc, manager->concept_authenticated_user_addr, user_addr); + _sc_context_set_permissions_for_element(auth_arc_addr, SC_CONTEXT_PERMISSIONS_TO_ALL_PERMISSIONS); + // Remove all negative sc-arcs sc_iterator3 * it3 = sc_iterator3_f_a_f_new( s_memory_default_ctx, manager->concept_authenticated_user_addr, sc_type_const_temp_neg_arc, user_addr); @@ -304,10 +308,6 @@ sc_result _sc_memory_context_manager_on_authentication_request_user( sc_memory_element_free(s_memory_default_ctx, sc_iterator3_value(it3, 1)); sc_iterator3_free(it3); - sc_addr const auth_arc_addr = sc_memory_arc_new( - s_memory_default_ctx, sc_type_const_temp_pos_arc, manager->concept_authenticated_user_addr, user_addr); - _sc_context_set_permissions_for_element(auth_arc_addr, SC_CONTEXT_PERMISSIONS_TO_ALL_PERMISSIONS); - return SC_RESULT_OK; }