Added permissions backend and refactored couchbase client code
Added permissions backend and refactored couchbase client code