]> git.llucax.com Git - mecon/samurai.git/commitdiff
Se agrega método getObservaciones() a SAMURAI_Perm.
authorLeandro Lucarella <llucax@gmail.com>
Mon, 8 Sep 2003 20:22:14 +0000 (20:22 +0000)
committerLeandro Lucarella <llucax@gmail.com>
Mon, 8 Sep 2003 20:22:14 +0000 (20:22 +0000)
doc/uml/Samurai.xmi
lib/SAMURAI/Perm.php
lib/SAMURAI/Usuario.php

index 5cc8005fad3d93336b70ea107454899081f5eb5b..c52f11aa08dc2bc99866f8c48f1eb3079565572d 100644 (file)
@@ -4,12 +4,13 @@
   <XMI.documentation>
    <XMI.exporter>umbrello uml modeller http://uml.sf.net</XMI.exporter>
    <XMI.exporterVersion>1.1.5</XMI.exporterVersion>
+   <XMI.exporterEncoding>UnicodeUTF8</XMI.exporterEncoding>
   </XMI.documentation>
   <XMI.model xmi.name="Samurai" href="/home/luca/public_html/samurai/doc/uml/Samurai.xmi" />
   <XMI.metamodel xmi.name="UML" href="UML.xml" xmi.version="1.3" />
  </XMI.header>
  <XMI.content>
-  <docsettings viewid="336" documentation="" uniqueid="388" />
+  <docsettings viewid="336" documentation="" uniqueid="391" />
   <umlobjects>
    <UML:Class stereotype="" package="" xmi.id="207" abstract="0" documentation="Clase para el manejo de los usuarios." name="SAMURAI_Usuario" static="0" scope="200" >
     <UML:Operation stereotype="" package="" xmi.id="216" type="void" abstract="0" documentation="Constructor.Recibe como parametro opcional el login del usuario. y busca en la base la informacion referida a el." name="SAMURAI_Usuario" static="0" scope="200" >
@@ -246,12 +247,18 @@ Se puede pasar parametros variables con un identificador de permiso o un array,
 Si no se pasa ningun parametro ($perm->tiene()), devuelve true si tiene un permiso (al menos uno) en el sistema actual.
 @see chequear()" name="tiene" static="0" scope="200" />
     <UML:Operation stereotype="" package="" xmi.id="385" type="array" abstract="0" documentation="Obtiene una lista de permisos. Si se especifica un sistema, obtiene la lista de permisos para ese sistema." name="getPermisos" static="0" scope="200" >
-     <UML:Parameter stereotype="" package="" xmi.id="1" value="''" type="int" abstract="0" documentation="Sistema del cual obtener la lista de permisos." name="sistema" static="0" scope="200" />
+     <UML:Parameter stereotype="" package="" xmi.id="1" value="null" type="int" abstract="0" documentation="Sistema del cual obtener la lista de permisos." name="sistema" static="0" scope="200" />
     </UML:Operation>
     <UML:Operation stereotype="" package="" xmi.id="388" type="void" abstract="0" documentation="" name="chequear" static="0" scope="200" />
+    <UML:Operation stereotype="" package="" xmi.id="391" type="array" abstract="0" documentation="Obtiene las observaciones de un permiso para un sistema." name="getObservaciones" static="0" scope="200" >
+     <UML:Parameter stereotype="" package="" xmi.id="1" value="" type="int" abstract="0" documentation="Obtiene las observaciones de un permiso para un sistema." name="perm" static="0" scope="201" />
+     <UML:Parameter stereotype="" package="" xmi.id="2" value="null" type="int" abstract="0" documentation="Sistema al cual pertenecen los permisos." name="sistema" static="0" scope="201" />
+    </UML:Operation>
     <UML:Attribute stereotype="" package="" xmi.id="378" value="array()" type="array" abstract="0" documentation="Permisos. Es un array asociativo, donde la clave es un identificador de sistema y el valor un array con los permisos que tiene para ese sistema." name="permisos" static="0" scope="202" />
     <UML:Attribute stereotype="" package="" xmi.id="379" value="" type="int" abstract="0" documentation="Sistema usado actualmente.
 x2c:set" name="sistema" static="0" scope="202" />
+    <UML:Attribute stereotype="" package="" xmi.id="389" value="" type="&amp;DB" abstract="0" documentation="Base de datos a usar en las conexiones." name="db" static="0" scope="202" />
+    <UML:Attribute stereotype="" package="" xmi.id="390" value="array()" type="array" abstract="0" documentation="Observaciones de los permisos." name="observaciones" static="0" scope="202" />
    </UML:Class>
    <UML:Association nameb="" stereotype="" visibilitya="200" visibilityb="200" assoctype="500" rolea="265" roleb="264" multia="" doca="" multib="" docb="" package="" xmi.id="-1" abstract="0" documentation="" name="" static="0" scope="200" changeabilitya="900" changeabilityb="900" namea="" />
    <UML:Association nameb="" stereotype="" visibilitya="200" visibilityb="200" assoctype="501" rolea="265" roleb="210" multia="" doca="" multib="" docb="" package="" xmi.id="-1" abstract="0" documentation="" name="" static="0" scope="200" changeabilitya="900" changeabilityb="900" namea="" />
@@ -261,11 +268,11 @@ x2c:set" name="sistema" static="0" scope="202" />
    <UML:Association nameb="" stereotype="" visibilitya="200" visibilityb="200" assoctype="500" rolea="265" roleb="264" multia="" doca="" multib="" docb="" package="" xmi.id="-1" abstract="0" documentation="" name="" static="0" scope="200" changeabilitya="900" changeabilityb="900" namea="" />
   </umlobjects>
   <diagrams>
-   <diagram snapgrid="1" showattsig="1" fillcolor="#ffffc0" zoom="100" showgrid="1" showopsig="1" usefillcolor="1" snapx="10" canvaswidth="911" snapy="10" showatts="1" xmi.id="206" documentation="" type="402" showops="1" showpackage="0" name="Clases y Relaciones" localid="30000" showstereotype="0" showscope="1" snapcsgrid="0" font="helvetica,8,-1,0,50,0,0,0,0,0" linecolor="#ff0000" canvasheight="648" >
+   <diagram snapgrid="1" showattsig="1" fillcolor="#ffffc0" zoom="100" showgrid="1" showopsig="1" usefillcolor="1" snapx="10" canvaswidth="911" snapy="10" showatts="1" xmi.id="206" documentation="" type="402" showops="1" showpackage="0" name="Clases y Relaciones" localid="30000" showstereotype="0" showscope="1" snapcsgrid="0" font="Helvetica,12,-1,5,48,0,0,0,0,0" linecolor="#ff0000" canvasheight="648" >
     <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="234" 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="111" showattsigs="601" usesdiagramusefillcolour="0" x="640" linecolour="#ff0000" y="10" showopsigs="600" instancename="" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="273" 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="149" showattsigs="601" usesdiagramusefillcolour="0" x="200" linecolour="#ff0000" y="10" showopsigs="600" instancename="" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="585" 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="110" showattsigs="601" usesdiagramusefillcolour="0" x="640" linecolour="#ff0000" y="10" showopsigs="600" instancename="" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="273" 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="148" showattsigs="601" usesdiagramusefillcolour="0" x="200" linecolour="#ff0000" y="10" showopsigs="600" instancename="" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="585" 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="195" 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="25" 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="32" 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" />
@@ -304,7 +311,7 @@ x2c:set" name="sistema" static="0" scope="202" />
       <UML:FloatingTextWidget usesdiagramfillcolour="1" width="0" usesdiagramusefillcolour="1" x="0" linecolour="none" y="0" 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="136" />
-       <endpoint endx="349" endy="302" />
+       <endpoint endx="348" endy="302" />
       </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" >
@@ -335,15 +342,15 @@ 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="902" 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,8,-1,0,50,0,0,0,0,0" linecolor="#ff0000" canvasheight="1129" >
+   <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,12,-1,5,48,0,0,0,0,0" linecolor="#ff0000" canvasheight="1129" >
     <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="25" 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="430" showattsigs="601" usesdiagramusefillcolour="0" x="10" linecolour="#ff0000" y="240" showopsigs="601" instancename="" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="273" 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="361" showattsigs="601" usesdiagramusefillcolour="0" x="10" linecolour="#ff0000" y="10" showopsigs="601" instancename="" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="195" 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="88" showattsigs="601" usesdiagramusefillcolour="0" x="450" linecolour="#ff0000" y="80" showopsigs="601" instancename="" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="32" 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="431" showattsigs="601" usesdiagramusefillcolour="0" x="10" linecolour="#ff0000" y="540" showopsigs="601" instancename="" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="585" 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="448" showattsigs="601" usesdiagramusefillcolour="0" x="450" linecolour="#ff0000" y="230" showopsigs="601" instancename="" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="234" 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="288" showattsigs="601" usesdiagramusefillcolour="0" x="450" linecolour="#ff0000" y="130" showopsigs="601" instancename="" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="91" 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" />
+     <UML:ClassWidget usesdiagramfillcolour="0" width="429" showattsigs="601" usesdiagramusefillcolour="0" x="10" linecolour="#ff0000" y="240" showopsigs="601" instancename="" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="273" 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="195" 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="32" 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="540" showopsigs="601" instancename="" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="585" 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="234" 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="130" 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>
     <messages/>
     <associations>
@@ -352,7 +359,7 @@ x2c:set" name="sistema" static="0" scope="202" />
       <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="0" linecolour="none" y="0" 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="494" starty="80" />
+       <startpoint startx="493" starty="80" />
        <endpoint endx="487" endy="45" />
       </linepath>
      </UML:AssocWidget>
@@ -361,15 +368,18 @@ x2c:set" name="sistema" static="0" scope="202" />
   </diagrams>
   <listview>
    <listitem open="1" type="800" id="-1" label="Vistas" >
-    <listitem open="1" type="801" id="-1" label="Vista lógica" >
+    <listitem open="1" type="801" id="-1" label="Vista lógica" >
      <listitem open="1" type="803" id="-1" label="Diagramas" >
       <listitem open="1" type="807" id="336" label="Clases" />
       <listitem open="1" type="807" id="206" label="Clases y Relaciones" />
       <listitem open="1" type="813" id="377" label="SAMURAI_Perm" >
+       <listitem open="0" type="814" id="389" label="db" />
+       <listitem open="0" type="814" id="390" label="observaciones" />
        <listitem open="0" type="814" id="378" label="permisos" />
        <listitem open="0" type="814" id="379" label="sistema" />
        <listitem open="0" type="815" id="380" label="SAMURAI_Perm" />
        <listitem open="0" type="815" id="388" label="chequear" />
+       <listitem open="0" type="815" id="391" label="getObservaciones" />
        <listitem open="0" type="815" id="385" label="getPermisos" />
        <listitem open="0" type="815" id="381" label="tiene" />
       </listitem>
index 965665c3825e1c1550f792526199a5baa094fa54..ad31b05b02ce7caf54ca431b6667e2553ac0b4a9 100644 (file)
@@ -51,6 +51,22 @@ class SAMURAI_Perm {
      */
     var $_sistema;
 
+    /**
+     * Base de datos a usar en las conexiones.
+     *
+     * @var    DB $db
+     * @access protected
+     */
+    var $_db;
+
+    /**
+     * Observaciones de los permisos.
+     *
+     * @var    array $observaciones
+     * @access protected
+     */
+    var $_observaciones = array();
+
     /**
      * Sets Sistema.
      *
@@ -88,6 +104,7 @@ class SAMURAI_Perm {
         foreach ($db->getAll($query, DB_FETCHMODE_ASSOC) as $row) {
             $this->_permisos[$row['sistema']][] = $row['permiso'];
         }
+        $this->_db =& $db;
     }
     // -X2C
 
@@ -133,9 +150,9 @@ Si no se pasa ningun parametro ($perm->tiene()), devuelve true si tiene un permi
      * @return array
      * @access public
      */
-    function getPermisos($sistema = '') // ~X2C
+    function getPermisos($sistema = null) // ~X2C
     {
-        $sistema = $sistema ? $sistema : $this->_sistema;
+        $sistema = is_null($sistema) ? $this->_sistema : $sistema;
         return @$this->_permisos[$sistema] ? $this->_permisos[$sistema] : array();
     }
     // -X2C
@@ -155,6 +172,34 @@ Si no se pasa ningun parametro ($perm->tiene()), devuelve true si tiene un permi
     }
     // -X2C
 
+    // +X2C Operation 391
+    /**
+     * Obtiene las observaciones de un permiso para un sistema.
+     *
+     * @param  int $perm Obtiene las observaciones de un permiso para un sistema.
+     * @param  int $sistema Sistema al cual pertenecen los permisos.
+     *
+     * @return array
+     * @access public
+     */
+    function getObservaciones($perm, $sistema = null) // ~X2C
+    {
+        $sistema = is_null($sistema) ? $this->_sistema : $sistema;
+        if (!@is_array($this->_observaciones[$sistema][$perm])) {
+            $this->_observaciones[$sistema][$perm] = array();
+            $query = '
+                SELECT ps.observaciones AS observaciones
+                FROM samurai.perm_sist AS ps
+                WHERE ps.id_permiso = '.$this->_db->quote($perm).'
+                  AND ps.id_sistema = '.$this->_db->quote($sistema);
+            foreach ($this->_db->getAll($query, DB_FETCHMODE_ASSOC) as $row) {
+                $this->_observaciones[$sistema][$perm][] = $row['observaciones'];
+            }
+        }
+        return $this->_observaciones[$sistema][$perm];
+    }
+    // -X2C
+
 } // -X2C Class :SAMURAI_Perm
 
 ?>
\ No newline at end of file
index b8006ba1ad2d6804e95a7fc09393a3d0421bf5d4..015349e1f725e0959a337821b487ebb3a74dd41b 100644 (file)
@@ -473,4 +473,4 @@ class SAMURAI_Usuario {
     // -X2C
 
 } // -X2C Class :SAMURAI_Usuario
-?>
+?>
\ No newline at end of file