[rabbitmq-discuss] Fine-grained LDAP access to resources

Simon MacMullen simon at rabbitmq.com
Mon Sep 23 16:56:35 BST 2013


On 23/09/13 15:18, James M. wrote:
> I took a shot at modifying and compiling the ldap plugin and came up
> with a seemingly working solution. I'm just getting my feet wet with
> Erlang but does this have any glaring issues at first glance? I'm
> basically adding a new derived value to the Args list so that when it's
> sent to fill() ${prefix} is properly expanded.

Based on a quick look at the code, nothing is too wrong from a low level 
point of view. However, this is wrong:

case Predicate of
     true  -> Var = Something;
     false -> Var = SomethingElse
end,

since although Var happens to escape the inner scope in all cases, it's 
not very clear and modern Erlang compilers will complain. Instead you want:

Var = case Predicate of
           true  -> Something;
           false -> SomethingElse
       end,

> My follow up question would be, what are the chances of getting
> something similar to this added to the official code base?

However, I'd be reluctant to merge this; conceptually it's very specific 
to your use case - what if you want to match something other than up to 
the first '.'? What if you want to do that on something other than the 
resource name?

Really you want to be able to write something like ${name.prefix('.')}. 
That is (obviously) much more complicated though.

It's possible some half-way house could exist between these two 
extremes; if so I can't immediately think of it.

Cheers, Simon

-- 
Simon MacMullen
RabbitMQ, Pivotal


More information about the rabbitmq-discuss mailing list