CREATE FOREIGN TABLE ldap.users (
mail character varying,
cn character varying,
description character varying,
ou character varying,
distinguishedName character varying,
sAMAccountName character varying,
displayName character varying
) server ldap_srv options (
uri 'my_ldapserver',
path 'OU=Utenti,DC=....,DC=...,DC=...',
scope 'sub',
binddn '............',
bindpwd 'mypwd',
objectClass 'user'
);
CREATE FOREIGN TABLE ldap.groups(
distinguishedName character varying,
sAMAccountName character varying
) server ldap_srv options (
uri 'my_ldapserver',
path 'OU=Utenti,DC=.....,DC=.....,DC=......',
scope 'sub',
binddn '............',
bindpwd 'mypwd',
objectClass 'group'
);
ldap.users contains all users
ldap.groups contains all groups
I create two foreign table
CREATE FOREIGN TABLE ldap.users ( mail character varying, cn character varying, description character varying, ou character varying, distinguishedName character varying, sAMAccountName character varying, displayName character varying ) server ldap_srv options ( uri 'my_ldapserver', path 'OU=Utenti,DC=....,DC=...,DC=...', scope 'sub', binddn '............', bindpwd 'mypwd', objectClass 'user' );
CREATE FOREIGN TABLE ldap.groups( distinguishedName character varying, sAMAccountName character varying ) server ldap_srv options ( uri 'my_ldapserver', path 'OU=Utenti,DC=.....,DC=.....,DC=......', scope 'sub', binddn '............', bindpwd 'mypwd', objectClass 'group' );
ldap.users contains all users ldap.groups contains all groups
How can I get all groups a user is member of ?
Thanks in advance.