[erlang-questions] Declarative Security in Erlang

Tim Watson <>
Mon May 21 22:04:00 CEST 2012


Holy crap the indentation on that post got screwed somehow. Allow me to 
tidy up a bit.....

around_advice(#annotation{data={mode, pdict}}, M, F, Inputs) ->
     case get(current_user) of
         undefined ->
             handle_restricted(M, F, Inputs);
         #user{} ->
             annotation:call_advised(M, F, Inputs)
     end.

around_advice(#annotation{data={user_record_idx, Idx}}, M, F, Inputs) ->
     User = lists:nth(Idx, Inputs),
     case check(User) of
         restricted ->
             handle_restricted(M, F, Inputs);
         ok ->
             annotation:call_advised(M, F, Inputs)
     end.




More information about the erlang-questions mailing list