MINI MINI MANI MO
<?xml version="1.0"?>
<!--
Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved.
NAME
kususer.xsl
DESCRIPTION
Convert mdapi USER_T document to USER document (SXML)
MODIFIED MM/DD/YY
tbhukya 02/03/17 - Bug 25468408: Generate Identified by clause
jjanosik 10/21/16 - Project 34974: support no authentication for user
create
jjanosik 09/12/16 - Bug 24387072: unconditionally add collation to SXML
jjanosik 11/17/15 - bug 21764718: expire users with 10g style passwords
jjanosik 09/28/15 - bug 21798129: Add support for LOCAL TEMPORARY
TABLESPACE
tbhukya 02/25/15 - Proj 47173: Data bound collation
dgagne 03/23/12 - update for v12 identifiers
rapayne 06/15/11 - lrg 5665517: fix xmlns violation.
lbarton 01/24/08 - Bug 6724820: move VERSION param to kuscomm.xsl
lbarton 01/08/07 - versioning
lbarton 11/09/05 - bug 4724986: fix handling of xmlns
sdavidso 11/02/05 - fix inconsistent stylesheet format
htseng 11/04/04 - Initial version
-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://xmlns.oracle.com/ku">
<!-- Top level imports -->
<xsl:import href="kuscomm.xsl"/>
<!-- Top level params -->
<!-- Templates -->
<xsl:template match="USER_T">
<!-- *******************************************************************
Template: USER_T - top-level template for USER.
This template puts out
- the opening USER element (with xmlns and version attributes)
- NAME elements
******************************************************************** -->
<xsl:variable name="NoAuthenticate">
<xsl:choose>
<xsl:when test="not($VERSION>=1202000000)">0</xsl:when>
<xsl:when test="(SPARE1 mod 131072) >= 65536">1</xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- NOTE: See kuuser if this needs to be changed -->
<xsl:variable name="DisableUser">
<xsl:choose>
<xsl:when test="not(PASSWORD)">0</xsl:when>
<xsl:when test="SPARE4 or SPARE4_12">0</xsl:when>
<xsl:when test="PASSWORD='GLOBAL' or PASSWORD='EXTERNAL'">0</xsl:when>
<xsl:otherwise>1</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:element name="USER" namespace="http://xmlns.oracle.com/ku">
<xsl:attribute name="version">1.0</xsl:attribute>
<xsl:element name="NAME">
<xsl:value-of select="NAME"/>
</xsl:element>
<xsl:choose>
<xsl:when test="$NoAuthenticate=1">
<xsl:element name="TYPE">NO_AUTHENTICATION</xsl:element>
</xsl:when>
<xsl:when test="PASSWORD='GLOBAL'">
<xsl:element name="TYPE">GLOBAL</xsl:element>
</xsl:when>
<xsl:when test="PASSWORD='EXTERNAL'">
<xsl:element name="TYPE">EXTERNAL</xsl:element>
</xsl:when>
<xsl:otherwise>
<xsl:element name="TYPE">LOCAL</xsl:element>
<xsl:element name="VALUE">
<xsl:choose>
<xsl:when test="$DisableUser=1">
<xsl:text>S:000000000000000000000000000000000000000000000000000000000000;</xsl:text>
</xsl:when>
<xsl:when test="SPARE4_12 and $VERSION>=1200000000">
<xsl:value-of select="SPARE4_12"/>
<xsl:text>;</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:if test="SPARE4 and $VERSION>=1100000000">
<xsl:value-of select="SPARE4"/>
<xsl:text>;</xsl:text>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="$DisableUser=0">
<xsl:value-of select="PASSWORD"/>
</xsl:if>
</xsl:element>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="EXT_USERNAME">
<xsl:element name="EXTERNAL_NAME">
<xsl:value-of select="EXT_USERNAME"/>
</xsl:element>
</xsl:if>
<!-- Generate default collation when version > 12.2 and spare3 -->
<xsl:if test="$VERSION>=1202000000 and SPARE3">
<xsl:element name="DEFAULT_COLLATION">
<xsl:value-of select="SPARE3"/>
</xsl:element>
</xsl:if>
<xsl:element name="DEFAULT_TABLESPACE">
<xsl:value-of select="DATATS"/>
</xsl:element>
<xsl:if test="TEMPTS">
<xsl:element name="TEMPORARY_TABLESPACE">
<xsl:value-of select="TEMPTS"/>
</xsl:element>
</xsl:if>
<xsl:if test="LTEMPTS and LTEMPTS != 'TEMP'">
<xsl:element name="LOCAL_TEMPORARY_TABLESPACE">
<xsl:value-of select="LTEMPTS"/>
</xsl:element>
</xsl:if>
<xsl:if test="PROFNAME">
<xsl:element name="PROFILE">
<xsl:value-of select="PROFNAME"/>
</xsl:element>
</xsl:if>
<xsl:call-template name="DoDisableChecks">
<xsl:with-param name="DisableUser" select="$DisableUser"/>
</xsl:call-template>
</xsl:element>
</xsl:template>
<xsl:template name="DoDisableChecks">
<xsl:param name="DisableUser">0</xsl:param>
<!-- *******************************************************************
Template: DoDisableChecks - This template determines whether or not a user
is expired or locked
Description: The template looks at the ASTATUS* flags and the DisableUser
parameter to make its determination. The ASTATUS_12 flag takes
precedence. ASTATUS_12 will have all possible identiifiers where
astatus has only the v10 identifier.
Parameter: DisableUser - if this is a 10g user it should be expired
and locked.
******************************************************************** -->
<!-- If there is an astatus_12 use it, next, the astatus, or 0 -->
<xsl:variable name="Status">
<xsl:choose>
<xsl:when test="ASTATUS_12">
<xsl:value-of select="ASTATUS_12"/>
</xsl:when>
<xsl:when test="ASTATUS">
<xsl:value-of select="ASTATUS"/>
</xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="Expire">
<xsl:choose>
<xsl:when test="$DisableUser=1">1</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="$Status != 0">
<xsl:choose>
<!-- KTSUCPEX =1 | KTSUCPEG =2 -->
<xsl:when test="($Status mod 4)> 0">1</xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:if test="$Expire=1">
<xsl:element name="PASSWORD_EXPIRE"></xsl:element>
</xsl:if>
<xsl:variable name="Lock">
<xsl:choose>
<xsl:when test="$DisableUser=1">1</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="$Status != 0">
<xsl:choose>
<xsl:when test="($Status mod 16)>=4">1</xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:if test="$Lock=1">
<xsl:element name="ACCOUNT_LOCK">
<xsl:text>Y</xsl:text>
</xsl:element>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
OHA YOOOO