[ Index ] |
PHP Cross Reference of Unnamed Project |
[Summary view] [Print] [Text view]
1 <?xml version="1.0" encoding="iso-8859-1"?> 2 <xsl:stylesheet xmlns:xsl = "http://www.w3.org/1999/XSL/Transform" version = "1.0" > 3 <xsl:output method="xml" version="1.0" encoding="iso-8859-1" indent="yes"/> 4 <!-- ## $Id: updatewpkgXml.xsl 2870 2008-04-23 17:36:15Z jlebail $ ## 5 Met à jour wpkg.xml 6 s'applique à profiles.xml 7 --> 8 <xsl:param name="user" select="''" /> 9 <xsl:param name="date" select="''" /> 10 11 <!-- xsl:variable name="PROFILES" select="document(concat('/var/se3/unattended/install/wpkg/tmp/profiles.', $user, '.xml'))/profiles"/ --> 12 <xsl:variable name="PROFILES" select="/profiles"/> 13 <xsl:variable name="HOSTS" select="document('/var/se3/unattended/install/wpkg/hosts.xml')/wpkg"/> 14 <xsl:variable name="RAPPORTS" select="document('/var/se3/unattended/install/wpkg/rapports/rapports.xml')/rapports"/> 15 <xsl:variable name="PACKAGES" select="document('/var/se3/unattended/install/wpkg/packages.xml')/packages"/> 16 <xsl:variable name="DROITS" select="document('/var/se3/unattended/install/wpkg/droits.xml')/droits"/> 17 <!-- Profils accessibles à cet utilisateur --> 18 <xsl:variable name="isAdmin" select="$DROITS/droit[(@parc = '_TousLesPostes') and (@user=$user) and ((@droit='manage') or (@droit='admin'))]"/> 19 <xsl:variable name="UserProfiles" select="$DROITS/droit[@user=$user]"/> 20 <xsl:variable name="ProfilCanRead" select="$UserProfiles/@parc"/> 21 <xsl:variable name="ProfilCanWrite" select="$UserProfiles[(@droit='manage') or (@droit='admin')]/@parc"/> 22 23 <xsl:key name="profile" match="/profiles/profile" use="@id" /> 24 <xsl:key name="estPoste" match="/profiles/profile[depends/@profile-id = '_TousLesPostes']" use="@id" /> 25 <xsl:key name="rapport" match="/rapports/rapport" use="@id" /> 26 27 <xsl:template match="/"> 28 <wpkg> 29 30 <xsl:comment> 31 <xsl:value-of select="$date" /> 32 <xsl:text> Données accessibles à '</xsl:text> 33 <xsl:value-of select="$user" /> 34 <xsl:text>' : </xsl:text> 35 <xsl:for-each select="$ProfilCanRead" > 36 <xsl:value-of select="." /> 37 <xsl:text> </xsl:text> 38 </xsl:for-each> 39 </xsl:comment> 40 41 <hosts> 42 <xsl:for-each select="$HOSTS/host" > 43 <xsl:sort select="@name" /> 44 <xsl:variable name="CePoste" select="."/> 45 <xsl:variable name="NomPoste" select="@name"/> 46 <!-- changement de document en cours --> 47 <xsl:for-each select="$PROFILES" > 48 <xsl:choose> 49 <xsl:when test="$isAdmin or key('profile', $NomPoste)/depends[@profile-id = $ProfilCanRead]"> 50 <host> 51 <xsl:attribute name="name"><xsl:value-of select="$NomPoste" /></xsl:attribute> 52 <xsl:for-each select="$RAPPORTS" > 53 <xsl:apply-templates select="key('rapport', $NomPoste)" /> 54 </xsl:for-each> 55 </host> 56 </xsl:when> 57 </xsl:choose> 58 </xsl:for-each> 59 </xsl:for-each> 60 </hosts> 61 <!-- les profiles sont à nouveau dans wpkg.php --> 62 <profiles> 63 <xsl:for-each select="$PROFILES/profile" > 64 <xsl:sort select="@id" /> 65 <xsl:variable name="CeProfile" select="."/> 66 <xsl:choose> 67 <xsl:when test="key('estPoste', @id)"> 68 <xsl:choose> 69 <xsl:when test="$isAdmin or (key('profile', @id)/depends[@profile-id = $ProfilCanWrite])"> 70 <xsl:copy select="."> 71 <xsl:apply-templates select="@*" /> 72 <xsl:attribute name="canWrite">1</xsl:attribute> 73 <xsl:apply-templates select="*" /> 74 </xsl:copy> 75 </xsl:when> 76 <xsl:when test="key('profile', @id)/depends[@profile-id = $ProfilCanRead]"> 77 <xsl:apply-templates select="." /> 78 </xsl:when> 79 </xsl:choose> 80 </xsl:when> 81 <xsl:otherwise> 82 <xsl:choose> 83 <xsl:when test="$isAdmin or (@id = $ProfilCanWrite)"> 84 <xsl:copy select="."> 85 <xsl:apply-templates select="@*" /> 86 <xsl:attribute name="canWrite">1</xsl:attribute> 87 <xsl:apply-templates select="*" /> 88 </xsl:copy> 89 </xsl:when> 90 <xsl:when test="@id = '_TousLesPostes'"> 91 <xsl:apply-templates select="." /> 92 </xsl:when> 93 <xsl:when test="@id = $ProfilCanRead"> 94 <xsl:comment>ProfilCanRead</xsl:comment> 95 <xsl:apply-templates select="." /> 96 </xsl:when> 97 </xsl:choose> 98 </xsl:otherwise> 99 </xsl:choose> 100 </xsl:for-each> 101 </profiles> 102 <packages> 103 <!-- Recopie les noeuds package avec seulement les attributs --> 104 <xsl:for-each select="$PACKAGES/package" > 105 <xsl:sort select="@id" /> 106 <xsl:copy select="."> 107 <xsl:apply-templates select="@*" /> 108 <xsl:apply-templates select="depends" /> 109 </xsl:copy> 110 </xsl:for-each> 111 </packages> 112 </wpkg> 113 </xsl:template> 114 115 <xsl:template match="@*"> 116 <!-- recopie les attributs --> 117 <xsl:copy /> 118 </xsl:template> 119 120 <xsl:template match="*"> 121 <!-- recopie le noeud --> 122 <xsl:copy> 123 <xsl:apply-templates select="@*" /> 124 <xsl:apply-templates select="*"/> 125 </xsl:copy> 126 </xsl:template> 127 128 </xsl:stylesheet>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Tue Mar 17 22:47:18 2015 | Cross-referenced by PHPXref 0.7.1 |