OpenACD/OpenACD — pull request #63 by jvliwanag (2012-02-20 08:02:07+00:00)
Title: Agent Auth Hooks

Separated mnesia specific details of agent_auth to agent_auth_mnesia enabling multiple pluggable back-ends as a replacement for mnesia using cpx_hooks.

I retained almost all of the existing interface details of agent_auth (except possibly for errors -- from 'error' to {error, any()} on some). this however meant that some responses follow the mnesia format of {atomic, ok} even if the underlying implementation may not be in Mnesia.

agent_auth_mnesia needed to change response formats however to be complaint with cpx_hooks.

All with unit tests, and fixed some tests in agent_auth_mnesia as well.

Some errors may still go through however (not tested). Getting agents and profiles do not return duplicate entries -- however setting/adding agents and profiles with duplicate ids/names may push through esp if it's from a separate hook. Not sure if it is best to block it early on.

Moving on from this, perhaps it's best to keep agent_auth be for read-only and keep the new/update details be on the specific implementation such as agent_auth_mnesia. cpx_web for instance would work directly with agent_auth_mnesia rather than agent_auth.