MINI MINI MANI MO

Path : /opt/oracle/product/18c/dbhomeXE/rdbms/xml/xsl/
File Upload :
Current File : //opt/oracle/product/18c/dbhomeXE/rdbms/xml/xsl/kuuser.xsl

<?xml version="1.0"?>
<!-- 
 Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
NAME
    kuuser.xsl
DESCRIPTION
    XSLT stylesheet for XML => DDL conversion of ku$_user_t ADTs
NOTES
    Do NOT modify this file under any circumstance. Copy the file
    if you wish to use this stylesheet with an external XML/XSL parser

MODIFIED        MM/DD/YY
    jjanosik    10/21/16 - Project 34974: support no authentication for user
                           create
    jjanosik    08/19/16 - bug 24387072 - fix how/when the collation clause 
                           is output
    rapayne     03/14/16 - bug 22858445: fix local temp tbsp.
    tbhukya     08/04/16 - Bug 24313182: Add double quotes to collation name
    rapayne     03/14/16 - bug 22858445: fix local temp tbsp.
    jjanosik    11/16/15 - bug 21764718 - expire users with 10g style passwords
    tbhukya     09/30/15 - Bug 21886016: Generate collation when
                           max_string_size=extended and version >=12.2
    jjanosik    09/28/15 - Support Local Temp Tablespace
    tbhukya     02/25/15 - Proj 47173: Data bound collation
    sdavidso    03/15/14 - bug18405747: fix externally identified user
    dvekaria    01/20/14 - Bug18095007: Output external user DDL.
    bwright     08/21/13 - Bug 17312600: Remove hard tabs from DP src code
    sdavidso    02/26/13 - bug16491515: escape single quotes
    traney      08/02/12 - 14407652: enable editions for object types
    ssonawan    07/12/12 - bug 13843068: correct the check on ASTATUS
    sdavidso    03/16/12 - bug13808632 propagate user enable editions
    dgagne      03/16/12 - add support for version 12 identifiers
    tbhukya     02/05/10 - Bug 9285262
    lbarton     01/18/07 - bug 5584945: restrict password access to
                           EXP_FULL_DATABASE
    lbarton     04/03/06 - strong verification
    sdavidso    11/02/05 - fix inconsistent stylesheet format 
    htseng      08/02/02 - add grantee parse param
    htseng      07/29/02 - add more parse params
    htseng      09/19/01 - Merged htseng_add_xsl_stylesheets
    htseng      04/17/01 - Creation 
 -->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 <!-- Import required scripts -->
 <xsl:import href="kucommon.xsl"/>
 <!-- Top-level parameters -->
 <xsl:param name="PRETTY">1</xsl:param>
 <xsl:param name="SQLTERMINATOR">1</xsl:param>
 <!-- params for parse -->
 <xsl:param name="PRS_DDL">0</xsl:param>
 <xsl:param name="PRS_DELIM">\{]`</xsl:param>
 <xsl:param name="PRS_VERB">0</xsl:param>
 <xsl:param name="PRS_OBJECT_TYPE">0</xsl:param>
 <xsl:param name="PRS_SCHEMA">0</xsl:param>
 <xsl:param name="PRS_NAME">0</xsl:param>
 <xsl:param name="PRS_GRANTEE">0</xsl:param>
 <xsl:param name="PRS_GRANTOR">0</xsl:param>
 <xsl:param name="PRS_BASE_OBJECT_SCHEMA">0</xsl:param>
 <xsl:param name="PRS_BASE_OBJECT_NAME">0</xsl:param>
 <xsl:param name="PRS_BASE_OBJECT_TYPE">0</xsl:param>
 <xsl:param name="PRS_USER_DISABLED">0</xsl:param>
 <xsl:param name="TEN_G_LOGON_ALLOWED">0</xsl:param>
 <xsl:template match="USER_T">
  <!-- are 10g style verifiers allowed. -->
  <!-- NOTE: See kususer if this needs to be changed -->
  <xsl:variable name="NoAuthenticate">
  <xsl:choose>
   <xsl:when test="(SPARE1 mod 131072) >= 65536">1</xsl:when>
   <xsl:otherwise>0</xsl:otherwise>
  </xsl:choose>
  </xsl:variable>
  <xsl:variable name="DisableUser">
   <xsl:choose>
    <xsl:when test="$NoAuthenticate=1 and not($VERSION>=1202000000)">1</xsl:when>
    <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:when test="$TEN_G_LOGON_ALLOWED=1">0</xsl:when>
    <xsl:otherwise>1</xsl:otherwise>
   </xsl:choose>
  </xsl:variable>
  <!-- this is needed so impdp can report that the user has been disabled -->
  <xsl:if test="$PRS_USER_DISABLED=1 and $DisableUser=1">
   <xsl:value-of select="$PRS_DELIM"/>
   <xsl:text>AUSER_DISABLED</xsl:text>
   <xsl:value-of select="$PRS_DELIM"/>
   <xsl:text>B1</xsl:text>
  </xsl:if>
  <xsl:call-template name="DoParse">
   <xsl:with-param name="Verb">CREATE</xsl:with-param>
   <xsl:with-param name="ObjectType">USER</xsl:with-param>
   <xsl:with-param name="NameNode" select="NAME"/>
  </xsl:call-template>
  <xsl:choose>
   <xsl:when test="NAME='SYS' or NAME='SYSTEM'">
    <xsl:text> ALTER USER </xsl:text>
   </xsl:when>
   <xsl:otherwise>
    <xsl:text> CREATE USER </xsl:text>
   </xsl:otherwise>
  </xsl:choose>
  <xsl:call-template name="QuoteObject">
   <xsl:with-param name="Object" select="NAME"/>
  </xsl:call-template>
  <xsl:choose>
   <xsl:when test="$NoAuthenticate=1">
    <xsl:choose>
     <xsl:when test="not($VERSION>=1202000000)">
      <xsl:text> IDENTIFIED BY VALUES '</xsl:text>
      <xsl:text>S:000000000000000000000000000000000000000000000000000000000000'</xsl:text>
     </xsl:when>
     <xsl:otherwise>
      <xsl:text> NO AUTHENTICATION </xsl:text>
     </xsl:otherwise>
    </xsl:choose>     
   </xsl:when>
   <xsl:when test="PASSWORD='GLOBAL'">
    <xsl:call-template name="EscapeString">
     <xsl:with-param name="OrigStr" select="EXT_USERNAME"/>
     <xsl:with-param name="Leading" select='" IDENTIFIED GLOBALLY AS &apos;"'/>
     <xsl:with-param name="Trailing" select='"&apos;"'/>
    </xsl:call-template>
   </xsl:when>
   <xsl:when test="PASSWORD='EXTERNAL'">
    <xsl:text> IDENTIFIED EXTERNALLY </xsl:text>
    <xsl:if test="EXT_USERNAME">
     <xsl:call-template name="EscapeString">
      <xsl:with-param name="OrigStr" select="EXT_USERNAME"/>
      <xsl:with-param name="Leading" select='"AS &apos;"'/>
      <xsl:with-param name="Trailing" select='"&apos;"'/>
     </xsl:call-template>
    </xsl:if>
   </xsl:when>
   <!-- If spare4_12 is available, use it, it is the real verison, but if it is
     missing, then the dumpfile is from before v12 so use spare4 -->
   <xsl:when test="PASSWORD or SPARE4 or SPARE4_12">
    <xsl:text> IDENTIFIED BY VALUES '</xsl:text>
    <xsl:choose>
     <xsl:when test="SPARE4_12">
      <xsl:value-of select="SPARE4_12"/>
      <xsl:if test="PASSWORD">
       <xsl:text>;</xsl:text>
      </xsl:if>
     </xsl:when>
     <xsl:when test="SPARE4">
      <xsl:value-of select="SPARE4"/>
      <xsl:if test="PASSWORD">
       <xsl:text>;</xsl:text>
      </xsl:if>
     </xsl:when>
     <xsl:otherwise>
      <xsl:if test="$DisableUser=1">
       <xsl:text>S:000000000000000000000000000000000000000000000000000000000000</xsl:text>
      </xsl:if>
     </xsl:otherwise>
    </xsl:choose>
    <xsl:if test="$DisableUser=0">
     <xsl:call-template name="EscapeString">
      <xsl:with-param name="OrigStr" select="PASSWORD"/>
     </xsl:call-template>
    </xsl:if>
    <xsl:text>'</xsl:text>
   </xsl:when>
  </xsl:choose>
  <!-- Default collation when version is 12.2 or higher and there is one -->
  <xsl:if test="$VERSION>=1202000000 and SPARE3"> 
   <xsl:call-template name="DoCollation">
    <xsl:with-param name="IsDefault">1</xsl:with-param>
    <xsl:with-param name="Name" select="SPARE3"/>
   </xsl:call-template>
  </xsl:if> 
  <xsl:if test="DATATS !='SYSTEM'">
   <xsl:if test="$PRETTY=1">
    <xsl:text>&#xa; </xsl:text>
    <xsl:text>    </xsl:text>
   </xsl:if>
   <xsl:text> DEFAULT TABLESPACE </xsl:text>
   <xsl:call-template name="QuoteObject">
    <xsl:with-param name="Object" select="DATATS"/>
   </xsl:call-template>
  </xsl:if>
  <xsl:if test="TEMPTS !='SYSTEM'">
   <xsl:if test="$PRETTY=1">
    <xsl:text>&#xa; </xsl:text>
    <xsl:text>    </xsl:text>
   </xsl:if>
   <xsl:text> TEMPORARY TABLESPACE </xsl:text>
   <xsl:call-template name="QuoteObject">
    <xsl:with-param name="Object" select="TEMPTS"/>
   </xsl:call-template>
  </xsl:if>
  <xsl:if test="PROFNUM != 0">
   <xsl:if test="$PRETTY=1">
    <xsl:text>&#xa; </xsl:text>
    <xsl:text>    </xsl:text>
   </xsl:if>
   <xsl:text> PROFILE </xsl:text>
   <xsl:call-template name="QuoteObject">
    <xsl:with-param name="Object" select="PROFNAME"/>
   </xsl:call-template>
  </xsl:if>
  <xsl:call-template name="DoDisableChecks">
   <xsl:with-param name="DisableUser" select="$DisableUser"/>
  </xsl:call-template>
  <xsl:if test="$SQLTERMINATOR=1">
   <xsl:text>;</xsl:text>
   <!-- Terminate the SQL statement -->
  </xsl:if>
  <xsl:if test="(SPARE1 mod 32) >= 16">
   <xsl:if test="$PRETTY=1">
    <xsl:text>&#xa;</xsl:text>
   </xsl:if>
   <!-- ALTER USER -->
   <xsl:call-template name="DoParse">
    <xsl:with-param name="Verb">ALTER</xsl:with-param>
    <xsl:with-param name="ObjectType">USER</xsl:with-param>
    <xsl:with-param name="NameNode" select="NAME"/>
   </xsl:call-template>
   <xsl:text> ALTER USER </xsl:text>
   <xsl:call-template name="QuoteObject">
    <xsl:with-param name="Object" select="NAME"/>
   </xsl:call-template>
   <xsl:text> ENABLE EDITIONS</xsl:text>
   <!-- In 12.1, the user is editions-enabled for a list of types. -->
   <xsl:if test="$VERSION>=1200000000 and EDN_TYPES">
    <xsl:text> FOR </xsl:text>
    <xsl:for-each select="EDN_TYPES/EDN_TYPES_ITEM">
     <xsl:value-of select="TYPE_NAME"/>
     <xsl:if test="not(position()=last())">
      <xsl:text>, </xsl:text>
     </xsl:if>
    </xsl:for-each>
   </xsl:if>
   <xsl:if test="$SQLTERMINATOR=1">
    <xsl:text>;</xsl:text>
    <!-- Terminate the SQL statement -->
   </xsl:if>
  </xsl:if>
  <!-- ALTER USER for local temporary tablespace (new in 12.2) -->
  <xsl:if test="$VERSION>=1202000000">
   <xsl:call-template name="DoLocalTempTS"/>
  </xsl:if>
 </xsl:template>
 <xsl:template name="DoLocalTempTS">
  <!-- *******************************************************************
Template: DoLocalTempTS - process local temporary tablespace
Description: it returns an alter user stmt to add a local temporary
     tablespace if one exists
******************************************************************** -->
  <xsl:if test="LTEMPTS != 'TEMP'">
   <xsl:if test="$PRETTY=1">
    <xsl:text>&#xa;</xsl:text>
   </xsl:if>
   <!-- ALTER USER -->
   <xsl:call-template name="DoParse">
    <xsl:with-param name="Verb">ALTER</xsl:with-param>
    <xsl:with-param name="ObjectType">USER</xsl:with-param>
    <xsl:with-param name="NameNode" select="NAME"/>
   </xsl:call-template>
   <xsl:text> ALTER USER </xsl:text>
   <xsl:call-template name="QuoteObject">
    <xsl:with-param name="Object" select="NAME"/>
   </xsl:call-template>
   <!-- LOCAL TEMPORARY TABLESPACE -->
   <xsl:text> LOCAL TEMPORARY TABLESPACE </xsl:text>
   <xsl:call-template name="QuoteObject">
    <xsl:with-param name="Object" select="LTEMPTS"/>
   </xsl:call-template>
   <xsl:if test="$SQLTERMINATOR=1">
    <xsl:text>;</xsl:text>
    <!-- Terminate the SQL statement -->
   </xsl:if>
  </xsl:if>
 </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:if test="$PRETTY=1">
    <xsl:text>&#xa; </xsl:text>
    <xsl:text>    </xsl:text>
   </xsl:if>
   <xsl:text> PASSWORD EXPIRE</xsl:text>
  </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:if test="$PRETTY=1">
    <xsl:text>&#xa; </xsl:text>
    <xsl:text>    </xsl:text>
   </xsl:if>
   <xsl:text> ACCOUNT LOCK</xsl:text>
  </xsl:if>
 </xsl:template>
</xsl:stylesheet>

OHA YOOOO