Skip to content

Commit

Permalink
[memory][core][context] Authenticate before erasing negative sc-arcs
Browse files Browse the repository at this point in the history
  • Loading branch information
NikitaZotov committed Dec 25, 2024
1 parent fa90b79 commit d41c45e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions sc-memory/sc-core/src/sc_memory_context_permissions.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,17 +297,17 @@ 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);
while (sc_iterator3_next(it3))
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;
}

Expand Down

0 comments on commit d41c45e

Please sign in to comment.