--------------------------------------------------------
--  DDL for View LDAP_AD_LIST
--------------------------------------------------------

  CREATE OR REPLACE FORCE EDITIONABLE VIEW "ENVX_OPER"."LDAP_AD_LIST" ("USUARIOS", "ID_ROLE") AS 
  SELECT val usuarios, 1 as id_role
 FROM table(apex_ldap.search (
          p_username => 'CN=LCU SICD LDAP,OU=Usuarios de Servicios,DC=lc,DC=gc,DC=local', 
          p_pass => 'martesSICDsegura10', 
          p_host => 'ldaplc.lc.gc.local', 
          p_search_base => 'DC=lc,DC=gc,DC=local', 
          p_search_filter   => '&(objectClass=group)(cn=LCGU_SICD_DES_Admin_Users)',
          p_attribute_names => 'member' ))
union all          
 SELECT val usuarios, 2 as id_role
 FROM table(apex_ldap.search (
          p_username => 'CN=LCU SICD LDAP,OU=Usuarios de Servicios,DC=lc,DC=gc,DC=local', 
          p_pass => 'martesSICDsegura10', 
          p_host => 'ldaplc.lc.gc.local', 
          p_search_base => 'DC=lc,DC=gc,DC=local', 
          p_search_filter   => '&(objectClass=group)(cn=LCGU_SICD_DES_Analista_Users)',
          p_attribute_names => 'member' ))        
union all          
 SELECT val usuarios, 3 as id_role
 FROM table(apex_ldap.search (
          p_username => 'CN=LCU SICD LDAP,OU=Usuarios de Servicios,DC=lc,DC=gc,DC=local', 
          p_pass => 'martesSICDsegura10', 
          p_host => 'ldaplc.lc.gc.local', 
          p_search_base => 'DC=lc,DC=gc,DC=local', 
          p_search_filter   => '&(objectClass=group)(cn=LCGU_SICD_DES_Aprobador_Users)',
          p_attribute_names => 'member' ))  
union all          
 SELECT val usuarios, 4 as id_role
 FROM table(apex_ldap.search (
          p_username => 'CN=LCU SICD LDAP,OU=Usuarios de Servicios,DC=lc,DC=gc,DC=local', 
          p_pass => 'martesSICDsegura10', 
          p_host => 'ldaplc.lc.gc.local', 
          p_search_base => 'DC=lc,DC=gc,DC=local', 
          p_search_filter   => '&(objectClass=group)(cn=LCGU_SICD_DES_Operador_Users)',
          p_attribute_names => 'member' ))
;
