[ 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: profilesXml.xsl 2559 2007-11-04 00:24:40Z jlebail $ ## 5 Met à jour tmp/profiles.$login.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('/var/se3/unattended/install/wpkg/profiles.xml')/profiles"/> 12 <xsl:variable name="DROITS" select="document('/var/se3/unattended/install/wpkg/droits.xml')/droits"/> 13 <!-- Profils accessibles à cet utilisateur --> 14 <xsl:variable name="isAdmin" select="$DROITS/droit[(@parc = '_TousLesPostes') and (@user=$user) and ((@droit='manage') or (@droit='admin'))]"/> 15 <xsl:variable name="UserProfiles" select="$DROITS/droit[@user=$user]"/> 16 <xsl:variable name="ProfilCanRead" select="$UserProfiles/@parc"/> 17 <xsl:variable name="ProfilCanWrite" select="$UserProfiles[(@droit='manage') or (@droit='admin')]/@parc"/> 18 19 <xsl:key name="profile" match="/profiles/profile" use="@id" /> 20 <xsl:key name="estPoste" match="/profiles/profile[depends/@profile-id = '_TousLesPostes']" use="@id" /> 21 <xsl:key name="rapport" match="/rapports/rapport" use="@id" /> 22 23 <xsl:template match="/"> 24 <profiles> 25 <xsl:comment><xsl:value-of select="concat(' Généré le ', $date, ' pour ', $user)" /></xsl:comment> 26 <xsl:for-each select="$PROFILES/profile" > 27 <xsl:sort select="@id" /> 28 <xsl:variable name="CeProfile" select="."/> 29 <xsl:choose> 30 <xsl:when test="key('estPoste', @id)"> 31 <xsl:choose> 32 <xsl:when test="$isAdmin or (key('profile', @id)/depends[@profile-id = $ProfilCanWrite])"> 33 <xsl:copy select="."> 34 <xsl:apply-templates select="@*" /> 35 <xsl:attribute name="canWrite">1</xsl:attribute> 36 <xsl:apply-templates select="*" /> 37 </xsl:copy> 38 </xsl:when> 39 <xsl:when test="key('profile', @id)/depends[@profile-id = $ProfilCanRead]"> 40 <xsl:apply-templates select="." /> 41 </xsl:when> 42 </xsl:choose> 43 </xsl:when> 44 <xsl:otherwise> 45 <xsl:choose> 46 <xsl:when test="$isAdmin or (@id = $ProfilCanWrite)"> 47 <xsl:copy select="."> 48 <xsl:apply-templates select="@*" /> 49 <xsl:attribute name="canWrite">1</xsl:attribute> 50 <xsl:apply-templates select="*" /> 51 </xsl:copy> 52 </xsl:when> 53 <xsl:when test="@id = '_TousLesPostes'"> 54 <xsl:apply-templates select="." /> 55 </xsl:when> 56 <xsl:when test="@id = $ProfilCanRead"> 57 <xsl:comment>ProfilCanRead</xsl:comment> 58 <xsl:apply-templates select="." /> 59 </xsl:when> 60 </xsl:choose> 61 </xsl:otherwise> 62 </xsl:choose> 63 </xsl:for-each> 64 </profiles> 65 </xsl:template> 66 67 <xsl:template match="@*"> 68 <!-- recopie les attributs --> 69 <xsl:copy /> 70 </xsl:template> 71 72 <xsl:template match="*"> 73 <!-- recopie le noeud --> 74 <xsl:copy> 75 <xsl:apply-templates select="@*" /> 76 <xsl:apply-templates select="*"/> 77 </xsl:copy> 78 </xsl:template> 79 80 </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 |