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/kurolegr.xsl

<?xml version="1.0"?>
<!-- 
NAME
    kurolegr.xsl
DESCRIPTION
    XSLT stylesheet for XML => DDL conversion of ku$_rogrant_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
    bwright     08/16/13 - Bug 17312600: Remove hard tabs from DP src code
    ebatbout    11/09/11 - Project 36951: On_User_Grant support
    ebatbout    11/23/11 - Proj. 36950: Code based role grants
    rapayn      11/02/05 - Bug 4715313: Reformat with XMLSpy
    htseng      08/02/02 - add grantee parse param
    htseng      07/26/02 - add more parse params
    htseng      09/19/01 - Merged htseng_add_xsl_stylesheets
    htseng      05/25/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:template match="ROGRANT_T">
  <!-- kzd.h defines the following role grant option bits:
       KZDSYSWAO     0x01  == WITH ADMIN OPTION
       KZDSYSWDO     0x02  == WITH DELEGATE OPTION
       KZDSYSCMNONLY 0x04
       KZDSYSCMN     0x08  == common privilege
       KZDSYSCMNWAO  0x10  == common privilege WITH ADMIN OPTION
       KZDSYSCMNWDO  0x20  == common privilege WITH DELEGATE OPTION
  -->
  <xsl:variable name="AdminOption">
   <xsl:choose>
    <xsl:when test="(ADMIN mod 2) >= 1 or (ADMIN mod 32) >= 16">
     <xsl:text>1</xsl:text>
    </xsl:when>
    <xsl:otherwise>0</xsl:otherwise>
   </xsl:choose>
  </xsl:variable>
  <xsl:variable name="DelegateOption">
   <xsl:choose>
    <xsl:when test="(ADMIN mod 4) >= 2 or (ADMIN mod 64) >= 32">
     <xsl:text>1</xsl:text>
    </xsl:when>
    <xsl:otherwise>0</xsl:otherwise>
   </xsl:choose>
  </xsl:variable>
  <xsl:choose>
   <xsl:when test="$AdminOption = 1 or $DelegateOption = 1">
    <xsl:if test="$AdminOption = 1">
     <xsl:call-template name="DoRoleGrant">
      <xsl:with-param name="OptionString">
       <xsl:text> WITH ADMIN OPTION</xsl:text>
      </xsl:with-param>
     </xsl:call-template>
    </xsl:if>
    <xsl:if test="$DelegateOption = 1">
     <xsl:call-template name="DoRoleGrant">
      <xsl:with-param name="OptionString">
       <xsl:text> WITH DELEGATE OPTION</xsl:text>
      </xsl:with-param>
     </xsl:call-template>
    </xsl:if>
   </xsl:when>
   <xsl:otherwise>
    <xsl:call-template name="DoRoleGrant"/>
   </xsl:otherwise>
  </xsl:choose>
 </xsl:template>
 <xsl:template name="DoRoleGrant">
  <xsl:param name="OptionString" select="''"/>
  <xsl:call-template name="DoParse">
   <xsl:with-param name="Verb">GRANT</xsl:with-param>
   <xsl:with-param name="ObjectType">ROLE_GRANT</xsl:with-param>
   <xsl:with-param name="Grantee" select="GRANTEE"/>
  </xsl:call-template>
  <xsl:text> GRANT </xsl:text>
  <xsl:call-template name="QuoteObject">
   <xsl:with-param name="Object" select="ROLE"/>
  </xsl:call-template>
  <xsl:text> TO </xsl:text>
  <xsl:call-template name="QuoteObject">
   <xsl:with-param name="Object" select="GRANTEE"/>
  </xsl:call-template>
  <xsl:value-of select="$OptionString"/>
  <xsl:if test="$SQLTERMINATOR=1">
   <xsl:text>;</xsl:text>
  </xsl:if>
 </xsl:template>
 <xsl:template match="ON_USER_GRANT_T">
  <xsl:call-template name="DoParse">
   <xsl:with-param name="Verb">GRANT</xsl:with-param>
   <xsl:with-param name="ObjectType">ON_USER_GRANT</xsl:with-param>
   <xsl:with-param name="Grantee" select="GRANTEE"/>
  </xsl:call-template>
  <xsl:text> GRANT INHERIT PRIVILEGES ON USER </xsl:text>
  <xsl:call-template name="QuoteObject">
   <xsl:with-param name="Object" select="USER_NAME"/>
  </xsl:call-template>
  <xsl:text> TO </xsl:text>
  <xsl:call-template name="QuoteObject">
   <xsl:with-param name="Object" select="GRANTEE"/>
  </xsl:call-template>
  <xsl:if test="$SQLTERMINATOR=1">
   <xsl:text>;</xsl:text>
  </xsl:if>
 </xsl:template>
 <xsl:template match="CODE_BASE_GRANT_T">
  <xsl:call-template name="DoParse">
   <xsl:with-param name="Verb">GRANT</xsl:with-param>
   <xsl:with-param name="ObjectType">CODE_BASE_GRANT</xsl:with-param>
   <xsl:with-param name="Grantee" select="GRANTEE"/>
   <xsl:with-param name="Grantor" select="GRANTEE"/>
  </xsl:call-template>
  <xsl:text> GRANT </xsl:text>
  <xsl:call-template name="QuoteObject">
   <xsl:with-param name="Object" select="ROLE"/>
  </xsl:call-template>
  <xsl:text> TO </xsl:text>
  <xsl:value-of select="CODE_TYPE"/>
  <xsl:text> </xsl:text>
  <xsl:call-template name="QuoteObject">
   <xsl:with-param name="Object" select="GRANTEE"/>
  </xsl:call-template>
  <xsl:text>.</xsl:text>
  <xsl:call-template name="QuoteObject">
   <xsl:with-param name="Object" select="TYPE_NAME"/>
  </xsl:call-template>
  <xsl:if test="$SQLTERMINATOR=1">
   <xsl:text>;</xsl:text>
  </xsl:if>
 </xsl:template>
</xsl:stylesheet>

OHA YOOOO