anchor.diff:  %%    end.
   
   
  -did_relations_change(ProplistA, ProplistB) ->
  -    % to sa ordsets wiec dziala
  -    proplists:get_keys(ProplistA) =/= proplists:get_keys(ProplistB).
  +
  +aggregate_eff_neighbours([{_, _} | _] = ProplistA, [{_, _} | _] = ProplistB) ->
  +    privileges_proplists_union(ProplistA ++ ProplistB);
  +aggregate_eff_neighbours(PrivilegesA, PrivilegesB) ->
  +    privileges_union(PrivilegesA, PrivilegesB).
  +
  +
  +
  +privileges_union(PrivilegesA, PrivilegesB) ->
  +    ordsets:union(
  +        ordsets:from_list(PrivilegesA),
  +        ordsets:from_list(PrivilegesB)
  +    ).
  +
  +
  +privileges_proplists_union(PrivilegesProplist) ->
  +    PrivilegesMap = lists:foldl(
  +        fun({Id, Privs}, AccMap) ->
  +            NewPrivs = case maps:get(Id, AccMap, undefined) of
  +                undefined ->
  +                    ordsets:from_list(Privs);
  +                OtherPrivs ->
  +                    privileges_union(Privs, OtherPrivs)
  +            end,
  +            maps:put(Id, NewPrivs, AccMap)
  +        end, #{}, PrivilegesProplist),
  +    ordsets:from_list(maps:to_list(PrivilegesMap)).
   
   
   override_privileges(PrivilegesProplist, NewPrivileges) ->
       lists:map(
           fun({Id, _}) ->
               {Id, NewPrivileges}
  -        end, PrivilegesProplist).+        end, PrivilegesProplist).
  
positive.code:         od_group => EffGroups, od_space => EffSpaces,
          od_share => EffShares, od_provider => EffProviders,
          od_handle_service => EffHServices, od_handle => EffHandles
      }.
  
  
  update_eff_relations(#od_user{} = User, AggregatedParentRelations) ->
      #{
          od_group => EffGroups, od_space => EffSpaces,
          od_share => EffShares, od_provider => EffProviders,
          od_handle_service => EffHServices, od_handle => EffHandles
      } = AggregatedParentRelations,
      User#od_user{
          eff_groups = EffGroups, eff_spaces = EffSpaces,
          eff_shares = EffShares, eff_providers = EffProviders,
          eff_handle_services = EffHServices, eff_handles = EffHandles
      }.
  
  
  extract_children(#od_space{users = Users, groups = Groups}) ->
      #{users => Users, groups => Groups}.
  
  
  
  
  %%refresh_entity_bottom_up(od_group, GroupId) ->
  
negative.code:             NewState = case {WhichWay, Flag} of
                  {bottom_up, true} ->
                      ?emergency("bottom-up dirty: ~p#~s", [Model, Id]),
                      EffGraphState#entity_graph_state{
                          bottom_up_dirty = lists:sort([{Priority, Model, Id} | BottomUpDirty])
                      };
                  {bottom_up, false} ->
                      ?emergency("bottom-up clean: ~s", [Id]),
                      EffGraphState#entity_graph_state{
                          bottom_up_dirty = lists:keydelete(Id, 3, BottomUpDirty)
                      };
                  {top_down, true} ->
                      ?emergency("top-down dirty: ~p#~s", [Model, Id]),
                      EffGraphState#entity_graph_state{
                          top_down_dirty = lists:sort([{Priority, Model, Id} | TopDownDirty])
                      };
                  {top_down, false} ->
                      ?emergency("top-down clean: ~s", [Id]),
                      EffGraphState#entity_graph_state{
                          top_down_dirty = lists:keydelete(Id, 3, TopDownDirty)
                      }
              end,
              {ok, NewState#entity_graph_state{dirty = true}}
          end),
      set_dirty_flag(WhichWay, Flag, Entity).
  
  