anchor.diff:  %% Checks if file has acl defined.
   %% @end
   %%--------------------------------------------------------------------
  --spec has_acl(FileUUID :: file_meta:uuid()) -> boolean().
  -has_acl(FileUUID) ->
  -    xattr:exists_by_name(FileUUID, ?ACL_XATTR_NAME).
  -
  -%%--------------------------------------------------------------------
  -%% @doc Get acl of given file, returns undefined when acls are empty
  -%%--------------------------------------------------------------------
  --spec get_acl(Uuid :: file_meta:uuid(), Acls :: maps:map()) -> {[#accesscontrolentity{}] | undefined, maps:map()}.
  -get_acl(Uuid, Map) ->
  -    case maps:get(Uuid, Map, undefined) of
  -        undefined ->
  -            case xattr:get_by_name(Uuid, ?ACL_XATTR_NAME) of
  -                {ok, Value} ->
  -                    Acl = fslogic_acl:from_json_format_to_acl(Value),
  -                    {Acl, maps:put(Uuid, Acl, Map)};
  -                {error, {not_found, custom_metadata}} ->
  -                    {undefined, maps:put(Uuid, undefined, Map)}
  -            end;
  -        Acl ->
  -            {Acl, Map}
  -    end.
  -
  -%%--------------------------------------------------------------------
  -%% @doc Get file_doc matching given item definition
  -%%--------------------------------------------------------------------
  --spec get_file(item_definition(), maps:map(), od_user:id(), list()) -> {datastore:document(), maps:map()}.
  -get_file(ItemDefinition, Map, UserId, FunctionInputs) ->
  -    case maps:get(ItemDefinition, Map, undefined) of
  -        undefined ->
  -            FileDoc = get_validation_subject(UserId, resolve_file_entry(ItemDefinition, FunctionInputs)),
  -            {FileDoc, maps:put(ItemDefinition, FileDoc, Map)};
  -        FileDoc ->
  -            {FileDoc, Map}
  -    end.
  -
  -%%--------------------------------------------------------------------
  -%% @doc Get user_doc for given user id
  -%%--------------------------------------------------------------------
  --spec get_user(od_user:id(), maps:map()) -> {datastore:document(), maps:map()}.
  -get_user(UserId, Map) ->
  -    case maps:get(UserId, Map, undefined) of
  -        undefined ->
  -            {ok, UserDoc} = od_user:get(UserId),
  -            {UserDoc, maps:put(UserId, UserDoc, Map)};
  -        UserDoc ->
  -            {UserDoc, Map}
  -    end.
  +-spec has_acl(file_meta:uuid()) -> boolean().
  +has_acl(FileUuid) ->
  +    xattr:exists_by_name(FileUuid, ?ACL_XATTR_NAME).
  +
  +%%--------------------------------------------------------------------
  +%% @doc
  +%% Get acl of given file, returns undefined when acls are empty
  +%% @end
  +%%--------------------------------------------------------------------
  +-spec get_acl(file_meta:uuid()) -> [#accesscontrolentity{}].
  +get_acl(Uuid) ->
  +    case xattr:get_by_name(Uuid, ?ACL_XATTR_NAME) of
  +        {ok, Value} ->
  +            fslogic_acl:from_json_format_to_acl(Value);
  +        {error, {not_found, custom_metadata}} ->
  +            undefined
  +    end.
  +
  +%%--------------------------------------------------------------------
  +%% @doc
  +%% Get file_doc matching given item definition
  +%% @end
  +%%--------------------------------------------------------------------
  +-spec get_file(item_definition(), od_user:id(), list()) -> {datastore:document(), maps:map()}.
  +get_file(ItemDefinition, UserId, FunctionInputs) ->
  +    get_validation_subject(UserId, resolve_file_entry(ItemDefinition, FunctionInputs)).
  +
  +%%--------------------------------------------------------------------
  +%% @doc
  +%% Get user_doc for given user id
  +%% @end
  +%%--------------------------------------------------------------------
  +-spec get_user(od_user:id()) -> od_user:doc().
  +get_user(UserId) ->
  +    {ok, UserDoc} = od_user:get(UserId),
  +    UserDoc.
   
   %%--------------------------------------------------------------------
   %% @doc
  
positive.code: %%%===================================================================
  
  %%--------------------------------------------------------------------
  %% @doc annotation's before_advice implementation.
  %%      #annotation.data type is [access_definition()] | access_definition()
  %%--------------------------------------------------------------------
  -spec before_advice(#annotation{data :: [access_definition()]}, module(), atom(), [term()]) -> term().
  before_advice(#annotation{data = AccessDefinitions}, _M, _F,
      [#sfm_handle{session_id = SessionId, file_uuid = FileUUID, share_id = ShareId} = Handle | RestOfArgs] = Args) ->
      {ok, #document{value = #session{identity = #user_identity{user_id = UserId}}}} = session:get(SessionId),
      ExpandedAccessDefinitions = expand_access_definitions(AccessDefinitions, UserId, ShareId, Args, #{}, #{}, #{}),
      [ok = rules:check(Def) || Def <- ExpandedAccessDefinitions],
      case (catch has_acl(FileUUID)) of
          true ->
              [Handle#sfm_handle{session_id = ?ROOT_SESS_ID} | RestOfArgs];
          _ ->
  
negative.code: before_advice(#annotation{data = AccessDefinitions}, _M, _F, Args = [UserCtx, File | _]) ->
      UserId = user_ctx:get_user_id(UserCtx),
      ShareId = file_ctx:get_share_id_const(File),
      ExpandedAccessDefinitions = expand_access_definitions(AccessDefinitions, UserId, ShareId, Args),
      lists:foreach(fun check_rule_and_cache_result/1, ExpandedAccessDefinitions),
      lists:foreach(fun cache_ok_result/1, ExpandedAccessDefinitions),
      Args.
  