1:- module(bc_api_actor, [
2 bc_set_actor/1, % +User
3 bc_actor/1, % -User
4 bc_unset_actor/0
5]).
9% Threadlocal for the current user. 10% Automatically set/unset by the admin interface. 11 12:- thread_local(actor/1).
19bc_set_actor(User):-
20 retractall(actor(_)),
21 assertz(actor(User)),
22 Username = User.username,
23 debug(bc_api_actor, 'set current actor to ~p', [Username]).
error(no_actor_set)
when no user is set.
31bc_actor(User):-
32 ( actor(User)
33 ; throw(error(no_actor_set))), !.
40bc_unset_actor:-
41 retractall(actor(_)),
42 debug(bc_data_cur_actor, 'actor unset', [])
Access to the current API user */