--------------------------------------------------------
--  DDL for View LDAP_LIST
--------------------------------------------------------

  CREATE OR REPLACE FORCE EDITIONABLE VIEW "ENVX_OPER"."LDAP_LIST" ("USUARIOS", "ID_ROLE") AS 
  SELECT val usuarios, 1 as id_role
 FROM table(apex_ldap.search (
          p_username        => 'cn=LdapSed,ou=CuentasdeServicio,o=Cas',
          p_pass            => 'LDAPSEDsistemas20caracteres',
          p_host            => 'ldapsvr.caja.com',
          p_search_base     => 'ou=Grupos,ou=Menu,ou=LOGICA,o=Cas',
          p_search_filter   => '&(objectClass=groupOfNames)(cn=GRP_SEDDES_SEDADMIN)',
          p_attribute_names => 'member' ))
union all          
 SELECT val usuarios, 2 as id_role
 FROM table(apex_ldap.search (
          p_username        => 'cn=LdapSed,ou=CuentasdeServicio,o=Cas',
          p_pass            => 'LDAPSEDsistemas20caracteres',
          p_host            => 'ldapsvr.caja.com',
          p_search_base     => 'ou=Grupos,ou=Menu,ou=LOGICA,o=Cas',
          p_search_filter   => '&(objectClass=groupOfNames)(cn=GRP_SEDDES_ANALISTA)',
          p_attribute_names => 'member' ))         
union all          
 SELECT val usuarios, 3 as id_role
 FROM table(apex_ldap.search (
          p_username        => 'cn=LdapSed,ou=CuentasdeServicio,o=Cas',
          p_pass            => 'LDAPSEDsistemas20caracteres',
          p_host            => 'ldapsvr.caja.com',
          p_search_base     => 'ou=Grupos,ou=Menu,ou=LOGICA,o=Cas',
          p_search_filter   => '&(objectClass=groupOfNames)(cn=GRP_SEDDES_DESA_SUPERVISOR)',
          p_attribute_names => 'member' ))
union all          
 SELECT val usuarios, 4 as id_role
 FROM table(apex_ldap.search (
          p_username        => 'cn=LdapSed,ou=CuentasdeServicio,o=Cas',
          p_pass            => 'LDAPSEDsistemas20caracteres',
          p_host            => 'ldapsvr.caja.com',
          p_search_base     => 'ou=Grupos,ou=Menu,ou=LOGICA,o=Cas',
          p_search_filter   => '&(objectClass=groupOfNames)(cn=GRP_SEDDES_OPER)',
          p_attribute_names => 'member' ))
;
