[erlang-questions] Declarative Security in Erlang

Andrew Berman rexxe98@REDACTED
Mon May 21 22:22:03 CEST 2012


Cool, thanks Tim.  I am using a before_advice since it is only security.  I
figured that your two suggestions are the best way to do it.  As you said,
passing around the user is the purest way, so I'll probably just go with
that method.  I like your suggestion of passing in the index of the user
record in the inputs.

I was planning on using a gen_server and every time a function is accessed
it creates a new process which stores the user.  I feel like this could get
messy though.

Thanks again for the annotations project, I love it!

--Andrew

On Mon, May 21, 2012 at 1:04 PM, Tim Watson <watson.timothy@REDACTED>wrote:

> 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.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20120521/5e5006da/attachment.htm>


More information about the erlang-questions mailing list