]> git.llucax.com Git - mecon/samurai.git/commitdiff
Ahora sel-sistema solo muestra los sistemas a los cuales el usuario tiene acceso...
authorMartín Marrese <marrese@gmail.com>
Thu, 16 Oct 2003 23:03:09 +0000 (23:03 +0000)
committerMartín Marrese <marrese@gmail.com>
Thu, 16 Oct 2003 23:03:09 +0000 (23:03 +0000)
doc/Samurai.xmi
lib/SAMURAI/Perfil.php
lib/SAMURAI/Sistema.php
lib/SAMURAI/Sistema/consultas.ini
sistema/www/sel-sistema.php

index 57546fe223a5803335a356a2588b0d29214f7676..6ad652c3ff97e79e78beb9e44f55407812fc9825 100644 (file)
@@ -10,7 +10,7 @@
   <XMI.metamodel xmi.name="UML" href="UML.xml" xmi.version="1.3" />
  </XMI.header>
  <XMI.content>
-  <docsettings viewid="336" documentation="" uniqueid="396" />
+  <docsettings viewid="336" documentation="" uniqueid="397" />
   <umlobjects>
    <UML:Class stereotype="" package="" xmi.id="207" abstract="0" documentation="Clase para el manejo de los usuarios.
 @see \ref page_samurai_html_usuario" name="SAMURAI_Usuario" static="0" scope="200" >
@@ -194,6 +194,9 @@ x2c: get set" name="permisos" static="0" scope="201" />
      <UML:Parameter stereotype="" package="" xmi.id="1" value="" type="&amp;SAMURAI_DB" abstract="0" documentation="Base de Datos" name="db" static="0" scope="200" />
      <UML:Parameter stereotype="" package="" xmi.id="2" value="true" type="bool" abstract="0" documentation="Indica si se deben buscar solamente los sistemas activos" name="activos" static="0" scope="201" />
     </UML:Operation>
+    <UML:Operation stereotype="" package="" xmi.id="397" type="array()" abstract="0" documentation="Devuelve un array asociativo en donde la clave es el identificador y el valor es el nombre del sistema. Solo devuelve aquellos sistemas en los cuales el usuario tiene permisos." name="getArraySistemasSeleccionar" static="0" scope="200" >
+     <UML:Parameter stereotype="" package="" xmi.id="1" value="" type="&amp;DB" abstract="0" documentation="Conexion a la base de datos" name="DB" static="0" scope="201" />
+    </UML:Operation>
     <UML:Attribute stereotype="" package="" xmi.id="235" value="null" type="int" abstract="0" documentation="Identificador del sistema." name="id" static="0" scope="202" />
     <UML:Attribute stereotype="" package="" xmi.id="237" value="null" type="string" abstract="0" documentation="Nombre del sistema." name="nombre" static="0" scope="202" />
     <UML:Attribute stereotype="" package="" xmi.id="238" value="null" type="string" abstract="0" documentation="Descripcion del sistema." name="descripcion" static="0" scope="202" />
@@ -283,7 +286,7 @@ x2c:set" name="sistema" static="0" scope="202" />
     <widgets>
      <UML:ClassWidget usesdiagramfillcolour="0" width="157" showattsigs="601" usesdiagramusefillcolour="0" x="750" linecolour="#ff0000" y="290" showopsigs="600" instancename="" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="280" usefillcolor="1" showattributes="1" isinstance="0" xmi.id="207" showoperations="1" showpackage="0" showscope="1" showstereotype="0" font="helvetica,8,-1,0,50,0,0,0,0,0" />
      <UML:ClassWidget usesdiagramfillcolour="0" width="110" showattsigs="601" usesdiagramusefillcolour="0" x="640" linecolour="#ff0000" y="10" showopsigs="600" instancename="" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="294" usefillcolor="1" showattributes="1" isinstance="0" xmi.id="208" showoperations="1" showpackage="0" showscope="1" showstereotype="0" font="helvetica,8,-1,0,50,0,0,0,0,0" />
-     <UML:ClassWidget usesdiagramfillcolour="0" width="174" showattsigs="601" usesdiagramusefillcolour="0" x="200" linecolour="#ff0000" y="10" showopsigs="600" instancename="" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="644" usefillcolor="1" showattributes="1" isinstance="0" xmi.id="209" showoperations="1" showpackage="0" showscope="1" showstereotype="0" font="helvetica,8,-1,0,50,0,0,0,0,0" />
+     <UML:ClassWidget usesdiagramfillcolour="0" width="174" showattsigs="601" usesdiagramusefillcolour="0" x="200" linecolour="#ff0000" y="10" showopsigs="600" instancename="" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="658" usefillcolor="1" showattributes="1" isinstance="0" xmi.id="209" showoperations="1" showpackage="0" showscope="1" showstereotype="0" font="helvetica,8,-1,0,50,0,0,0,0,0" />
      <UML:ClassWidget usesdiagramfillcolour="0" width="118" showattsigs="601" usesdiagramusefillcolour="0" x="480" linecolour="#ff0000" y="310" showopsigs="600" instancename="" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="210" usefillcolor="1" showattributes="1" isinstance="0" xmi.id="210" showoperations="1" showpackage="0" showscope="1" showstereotype="0" font="helvetica,8,-1,0,50,0,0,0,0,0" />
      <UML:ClassWidget usesdiagramfillcolour="0" width="35" showattsigs="601" usesdiagramusefillcolour="0" x="490" linecolour="#ff0000" y="10" showopsigs="600" instancename="" usesdiagramlinecolour="0" fillcolour="#d5d5cf" height="28" usefillcolor="1" showattributes="1" isinstance="0" xmi.id="264" showoperations="1" showpackage="0" showscope="1" showstereotype="0" font="helvetica,8,-1,0,50,0,0,0,0,0" />
      <UML:ClassWidget usesdiagramfillcolour="0" width="79" showattsigs="601" usesdiagramusefillcolour="0" x="480" linecolour="#ff0000" y="120" showopsigs="600" instancename="" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="35" usefillcolor="1" showattributes="1" isinstance="0" xmi.id="265" showoperations="1" showpackage="0" showscope="1" showstereotype="0" font="helvetica,8,-1,0,50,0,0,0,0,0" />
@@ -315,14 +318,14 @@ x2c:set" name="sistema" static="0" scope="202" />
      <UML:AssocWidget totalcounta="2" indexa="1" visibilityB="200" totalcountb="2" indexb="1" widgetbid="209" roleBdoc="" widgetaid="265" roleAdoc="" documentation="" type="501" changeabilityA="900" changeabilityB="900" visibilityA="200" >
       <UML:FloatingTextWidget usesdiagramfillcolour="1" width="0" usesdiagramusefillcolour="1" x="10" linecolour="none" y="0" operation="" instancename="" posttext="" usesdiagramlinecolour="1" role="703" fillcolour="none" height="0" usefillcolor="1" seqnum="" pretext="" isinstance="0" xmi.id="-1" text="" font="helvetica,12,-1,5,50,0,0,0,0,0" />
       <UML:FloatingTextWidget usesdiagramfillcolour="1" width="0" usesdiagramusefillcolour="1" x="0" linecolour="none" y="0" operation="" instancename="" posttext="" usesdiagramlinecolour="1" role="701" fillcolour="none" height="0" usefillcolor="1" seqnum="" pretext="" isinstance="0" xmi.id="-1" text="" font="helvetica,12,-1,5,50,0,0,0,0,0" />
-      <UML:FloatingTextWidget usesdiagramfillcolour="1" width="0" usesdiagramusefillcolour="1" x="30" linecolour="none" y="10" operation="" instancename="" posttext="" usesdiagramlinecolour="1" role="702" fillcolour="none" height="0" usefillcolor="1" seqnum="" pretext="" isinstance="0" xmi.id="-1" text="" font="helvetica,12,-1,5,50,0,0,0,0,0" />
+      <UML:FloatingTextWidget usesdiagramfillcolour="1" width="0" usesdiagramusefillcolour="1" x="30" linecolour="none" y="20" operation="" instancename="" posttext="" usesdiagramlinecolour="1" role="702" fillcolour="none" height="0" usefillcolor="1" seqnum="" pretext="" isinstance="0" xmi.id="-1" text="" font="helvetica,12,-1,5,50,0,0,0,0,0" />
       <UML:FloatingTextWidget usesdiagramfillcolour="1" width="0" usesdiagramusefillcolour="1" x="0" linecolour="none" y="0" operation="" instancename="" posttext="" usesdiagramlinecolour="1" role="709" fillcolour="none" height="0" usefillcolor="1" seqnum="" pretext="+" isinstance="0" xmi.id="-1" text="" font="helvetica,12,-1,5,50,0,0,0,0,0" />
-      <UML:FloatingTextWidget usesdiagramfillcolour="1" width="0" usesdiagramusefillcolour="1" x="30" linecolour="none" y="10" operation="" instancename="" posttext="" usesdiagramlinecolour="1" role="710" fillcolour="none" height="0" usefillcolor="1" seqnum="" pretext="+" isinstance="0" xmi.id="-1" text="" font="helvetica,12,-1,5,50,0,0,0,0,0" />
+      <UML:FloatingTextWidget usesdiagramfillcolour="1" width="0" usesdiagramusefillcolour="1" x="30" linecolour="none" y="20" operation="" instancename="" posttext="" usesdiagramlinecolour="1" role="710" fillcolour="none" height="0" usefillcolor="1" seqnum="" pretext="+" isinstance="0" xmi.id="-1" text="" font="helvetica,12,-1,5,50,0,0,0,0,0" />
       <UML:FloatingTextWidget usesdiagramfillcolour="1" width="0" usesdiagramusefillcolour="1" x="0" linecolour="none" y="0" operation="" instancename="" posttext="" usesdiagramlinecolour="1" role="711" fillcolour="none" height="0" usefillcolor="1" seqnum="" pretext="" isinstance="0" xmi.id="-1" text="" font="helvetica,12,-1,5,50,0,0,0,0,0" />
-      <UML:FloatingTextWidget usesdiagramfillcolour="1" width="0" usesdiagramusefillcolour="1" x="30" linecolour="none" y="10" operation="" instancename="" posttext="" usesdiagramlinecolour="1" role="712" fillcolour="none" height="0" usefillcolor="1" seqnum="" pretext="" isinstance="0" xmi.id="-1" text="" font="helvetica,12,-1,5,50,0,0,0,0,0" />
+      <UML:FloatingTextWidget usesdiagramfillcolour="1" width="0" usesdiagramusefillcolour="1" x="30" linecolour="none" y="20" operation="" instancename="" posttext="" usesdiagramlinecolour="1" role="712" fillcolour="none" height="0" usefillcolor="1" seqnum="" pretext="" isinstance="0" xmi.id="-1" text="" font="helvetica,12,-1,5,50,0,0,0,0,0" />
       <linepath>
        <startpoint startx="480" starty="137" />
-       <endpoint endx="374" endy="332" />
+       <endpoint endx="374" endy="339" />
       </linepath>
      </UML:AssocWidget>
      <UML:AssocWidget totalcounta="3" indexa="2" visibilityB="200" totalcountb="2" indexb="1" widgetbid="208" roleBdoc="" widgetaid="265" roleAdoc="" documentation="" type="501" changeabilityA="900" changeabilityB="900" visibilityA="200" >
@@ -353,13 +356,13 @@ x2c:set" name="sistema" static="0" scope="202" />
      </UML:AssocWidget>
     </associations>
    </diagram>
-   <diagram snapgrid="1" showattsig="1" fillcolor="#ffffc0" zoom="100" showgrid="1" showopsig="1" usefillcolor="1" snapx="10" canvaswidth="901" snapy="10" showatts="1" xmi.id="336" documentation="" type="402" showops="1" showpackage="0" name="Clases" localid="30000" showstereotype="0" showscope="1" snapcsgrid="0" font="helvetica,4,-1,0,50,0,0,0,0,0" linecolor="#ff0000" canvasheight="1198" >
+   <diagram snapgrid="1" showattsig="1" fillcolor="#ffffc0" zoom="100" showgrid="1" showopsig="1" usefillcolor="1" snapx="10" canvaswidth="901" snapy="10" showatts="1" xmi.id="336" documentation="" type="402" showops="1" showpackage="0" name="Clases" localid="30000" showstereotype="0" showscope="1" snapcsgrid="0" font="helvetica,4,-1,0,50,0,0,0,0,0" linecolor="#ff0000" canvasheight="1212" >
     <widgets>
      <UML:ClassWidget usesdiagramfillcolour="0" width="35" showattsigs="601" usesdiagramusefillcolour="0" x="470" linecolour="#ff0000" y="20" showopsigs="601" instancename="" usesdiagramlinecolour="0" fillcolour="#d5d5cf" height="28" usefillcolor="1" showattributes="1" isinstance="0" xmi.id="264" showoperations="1" showpackage="0" showscope="1" showstereotype="0" font="helvetica,8,-1,0,50,0,0,0,0,0" />
      <UML:ClassWidget usesdiagramfillcolour="0" width="429" showattsigs="601" usesdiagramusefillcolour="0" x="10" linecolour="#ff0000" y="230" showopsigs="601" instancename="" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="294" usefillcolor="1" showattributes="1" isinstance="0" xmi.id="208" showoperations="1" showpackage="0" showscope="1" showstereotype="0" font="helvetica,8,-1,0,50,0,0,0,0,0" />
      <UML:ClassWidget usesdiagramfillcolour="0" width="360" showattsigs="601" usesdiagramusefillcolour="0" x="10" linecolour="#ff0000" y="10" showopsigs="601" instancename="" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="210" usefillcolor="1" showattributes="1" isinstance="0" xmi.id="210" showoperations="1" showpackage="0" showscope="1" showstereotype="0" font="helvetica,8,-1,0,50,0,0,0,0,0" />
      <UML:ClassWidget usesdiagramfillcolour="0" width="87" showattsigs="601" usesdiagramusefillcolour="0" x="450" linecolour="#ff0000" y="80" showopsigs="601" instancename="" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="35" usefillcolor="1" showattributes="1" isinstance="0" xmi.id="265" showoperations="1" showpackage="0" showscope="1" showstereotype="0" font="helvetica,8,-1,0,50,0,0,0,0,0" />
-     <UML:ClassWidget usesdiagramfillcolour="0" width="430" showattsigs="601" usesdiagramusefillcolour="0" x="10" linecolour="#ff0000" y="550" showopsigs="601" instancename="" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="644" usefillcolor="1" showattributes="1" isinstance="0" xmi.id="209" showoperations="1" showpackage="0" showscope="1" showstereotype="0" font="helvetica,8,-1,0,50,0,0,0,0,0" />
+     <UML:ClassWidget usesdiagramfillcolour="0" width="430" showattsigs="601" usesdiagramusefillcolour="0" x="10" linecolour="#ff0000" y="550" showopsigs="601" instancename="" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="658" usefillcolor="1" showattributes="1" isinstance="0" xmi.id="209" showoperations="1" showpackage="0" showscope="1" showstereotype="0" font="helvetica,8,-1,0,50,0,0,0,0,0" />
      <UML:ClassWidget usesdiagramfillcolour="0" width="447" showattsigs="601" usesdiagramusefillcolour="0" x="450" linecolour="#ff0000" y="230" showopsigs="601" instancename="" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="280" usefillcolor="1" showattributes="1" isinstance="0" xmi.id="207" showoperations="1" showpackage="0" showscope="1" showstereotype="0" font="helvetica,8,-1,0,50,0,0,0,0,0" />
      <UML:ClassWidget usesdiagramfillcolour="0" width="287" showattsigs="601" usesdiagramusefillcolour="0" x="570" linecolour="#ff0000" y="20" showopsigs="601" instancename="" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="140" usefillcolor="1" showattributes="1" isinstance="0" xmi.id="377" showoperations="1" showpackage="0" showscope="1" showstereotype="0" font="helvetica,8,-1,0,50,0,0,0,0,0" />
     </widgets>
@@ -402,7 +405,7 @@ x2c:set" name="sistema" static="0" scope="202" />
       <listitem open="0" type="813" id="265" label="SAMURAI_DB" >
        <listitem open="0" type="815" id="269" label="connect" />
       </listitem>
-      <listitem open="1" type="813" id="208" label="SAMURAI_Perfil" >
+      <listitem open="0" type="813" id="208" label="SAMURAI_Perfil" >
        <listitem open="0" type="814" id="271" label="db" />
        <listitem open="0" type="814" id="226" label="descripcion" />
        <listitem open="0" type="814" id="225" label="id" />
@@ -440,7 +443,7 @@ x2c:set" name="sistema" static="0" scope="202" />
        <listitem open="0" type="815" id="319" label="modificarDb" />
        <listitem open="0" type="815" id="295" label="obtenerDatosDb" />
       </listitem>
-      <listitem open="0" type="813" id="209" label="SAMURAI_Sistema" >
+      <listitem open="1" type="813" id="209" label="SAMURAI_Sistema" >
        <listitem open="0" type="814" id="310" label="asociaciones" />
        <listitem open="0" type="814" id="242" label="contacto" />
        <listitem open="0" type="814" id="272" label="db" />
@@ -459,6 +462,7 @@ x2c:set" name="sistema" static="0" scope="202" />
        <listitem open="0" type="815" id="313" label="eliminarAsociacion" />
        <listitem open="0" type="815" id="315" label="existeAsociacion" />
        <listitem open="0" type="815" id="343" label="getArraySistemas" />
+       <listitem open="0" type="815" id="397" label="getArraySistemasSeleccionar" />
        <listitem open="0" type="815" id="250" label="getContacto" />
        <listitem open="0" type="815" id="246" label="getDescripcion" />
        <listitem open="0" type="815" id="248" label="getFechaFin" />
index 6088ad610b8584ddb5e08ccc36c8b11f74017453..3a58940fa2584adeff4b4ee8343f0a1a0b96f696 100644 (file)
@@ -628,4 +628,4 @@ class SAMURAI_Perfil {
 
 } // -X2C Class :SAMURAI_Perfil
 
-?>
+?>
\ No newline at end of file
index f82f36fe7a1b03ce7a393d3779404f69ce6d70c0..fe7eb7549fb2d352e230a528af9ea69f64545ee6 100644 (file)
@@ -1003,6 +1003,52 @@ class SAMURAI_Sistema {
     }
     // -X2C
 
+    // +X2C Operation 397
+    /**
+     * Devuelve un array asociativo en donde la clave es el identificador y el valor es el nombre del sistema. Solo devuelve aquellos sistemas en los cuales el usuario tiene permisos.
+     *
+     * @param  DB &$DB Conexion a la base de datos
+     *
+     * @return array()
+     * @access public
+     */
+    function getArraySistemasSeleccionar(&$DB) // ~X2C
+    {
+        $rta = array();
+        $sql = parse_ini_file(dirname(__FILE__) . '/Sistema/consultas.ini', true);
+        //Verifico si tiene permiso developer en samurai
+        $consulta = $sql['sistemas_seleccionar2'];
+        $dbh = $DB->prepare($consulta);
+        $res = $DB->execute($dbh, array(SAMURAI_PERM, $_SESSION['usuario'],
+                    SAMURAI_PERM_DEVELOPER));
+        $re = $res->fetchrow(DB_FETCHMODE_ASSOC);
+        if ($re['cuenta']) {
+            $consulta = $sql['obtener_datos_sistema']; 
+            $consulta.= $sql['obtener_datos_sistema3'];
+            $consulta.= $sql['obtener_datos_sistema4'];
+            $dbh = $DB->prepare($consulta);
+            $res = $DB->execute($dbh);
+            while ($re = $res->fetchrow(DB_FETCHMODE_ASSOC)) {
+                $rta[$re['id_sistema']] = $re['nombre_sistema'];
+            }        
+            $res->free();
+            return $rta;
+        }
+        //Si no tiene permiso developer en samurai le muestro solo aquellos
+        //sistemas en los cuales puede trabajar
+        $consulta = $sql['sistemas_seleccionar'];
+        $dbh = $DB->prepare($consulta);
+        $res = $DB->execute($dbh, array($_SESSION['usuario']));
+        while ($re = $res->fetchrow(DB_FETCHMODE_ASSOC)) {
+            $rta[$re['id_sistema']] = $re['nombre_sistema'];
+        }        
+        $res->free();
+        
+        return $rta;
+
+    }
+    // -X2C
+
 } // -X2C Class :SAMURAI_Sistema
 
-?>
\ No newline at end of file
+?>
index d6345cd161650fdd727a41f7deb1fa54cdaa9976..b5ac6f32e3270c4a64a7e0b05463c47e70f74cd4 100644 (file)
@@ -14,6 +14,9 @@ borrar_permisos         = " DELETE FROM samurai.perm_sist WHERE id_sistema = ? "
 borrar_permisos2        = " AND observaciones = ?"
 borrar_permisos3        = " AND id_permiso = ?"
 
+sistemas_seleccionar = "SELECT DISTINCT psu.id_sistema AS id_sistema, s.nombre_sistema AS nombre_sistema FROM samurai.perfil_sist_usuario AS psu, samurai.sistema AS s WHERE psu.id_sistema = s.id_sistema AND s.estado = 1 AND psu.login = ? ORDER BY s.nombre_sistema"
+sistemas_seleccionar2 = "SELECT count(psu.id_sistema) AS cuenta FROM samurai.perfil_sist_usuario AS psu, samurai.perm_perfil_sist AS pps WHERE psu.id_sistema = ? AND login = ? AND psu.id_perfil = pps.id_perfil AND psu.id_sistema = pps.id_sistema AND pps.id_permiso = ?"
+
 ;BORRAR ASOCIACIONES
 ea_obt_idperfil = "SELECT id_perfil FROM samurai.perm_perfil_sist WHERE id_permiso = ? AND observaciones = ? AND id_sistema = ?"
 ea_del_perm_perfil_sist = "DELETE FROM samurai.perm_perfil_sist WHERE id_permiso = ? AND observaciones = ? AND id_sistema = ?"
index 6a3e77691d1be64e7bbffcca5a079cd8106d15aa..b76280d159a74568b075744d25e15db7f3ac6084 100644 (file)
@@ -30,7 +30,7 @@
     $FORM     = new MECON_HTML_QuickForm ('sel_sistema','post','sel-sistema');
     $TABLAFORM =& new MECON_HTML_Tabla ('width="400"', 'comun');
     $FORM->renderer->setTable($TABLAFORM);
-    $SISTEMAS = SAMURAI_Sistema::getArraySistemas($DB);
+    $SISTEMAS = SAMURAI_Sistema::getArraySistemasSeleccionar($DB);
 // }}}
 //AGREGO LOS ELEMENTOS DEL FORM {{{
     $FORM->addElement ('header', 'cabecera', 'Seleccione el sistema con el cual quiere trabajar');