Skip to content

Commit

Permalink
imem_seco:seco_authorized/1 exported, used in imem_sec #276
Browse files Browse the repository at this point in the history
  • Loading branch information
shamis committed Aug 5, 2019
1 parent da5cb30 commit fa46149
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 15 deletions.
17 changes: 2 additions & 15 deletions src/imem_sec.erl
Original file line number Diff line number Diff line change
Expand Up @@ -919,21 +919,8 @@ have_module_permission(SKey, Module, Operation) ->

%% ------- local private security extension for sql and tables (do not export!!) ------------

seco_authorized(SKey) ->
case imem_meta:read(ddSeCo@, SKey) of
[#ddSeCo{pid=Pid, authState=authorized} = SeCo] when Pid == self() ->
SeCo;
[#ddSeCo{pid=Pid, authState=authorized} = SeCo] ->
{links, Links} = erlang:process_info(self(), links),
case lists:member(Pid, Links) of
true ->
SeCo;
false ->
?SecurityViolation({"Not logged in", SKey})
end;
[] ->
?SecurityException({"Not logged in", SKey})
end.
seco_authorized(SKey) ->
imem_seco:seco_authorized(SKey).

% have_table_ownership(SKey, {Schema,Table,_Alias}) ->
% have_table_ownership(SKey, {Schema,Table});
Expand Down
1 change: 1 addition & 0 deletions src/imem_seco.erl
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
, has_permission/3
, has_permission/2
, get_skey_pid/1
, seco_authorized/1
]).

-export([ have_role/2
Expand Down

0 comments on commit fa46149

Please sign in to comment.