<?xml version="1.0"?>
<!-- ===========================================================================
	Access Control Interface Script
	
		This script has been modified to be compatible BOTH with Space Manager
		AND with SpacemanWeb.
		
		There are elements that MUST be present in order for this script
		to be compatible with SpacemanWeb. SpacemanWeb will check that they
		are present, and will not run this script if they are not present and 
		correct.
		
		SpacemanWeb Compatibility SECTION 0
			There MUST be a <Block></Block> which contains ALL the 
			Access Control logic.
			
		SpacemanWeb Compatibility SECTION 1
			There MUST be a section that checks for the existence of the 
			connection variable SMWXMLMess.
			It then creates a variable called callingProcess which identifies
			which process has called this script.
			This section MUST immediately follow the <Parameters> block
			
		SpacemanWeb Compatibility SECTION 2
			There MUST be a section that sets SMWXMLMess = 'SUCCESS' when the
			callingProcess is 'SpacemanWeb' so that SpacemanWeb can see that 
			this script was successful.
			This section MUST follow AFTER all the Access Control code.
			
		SpacemanWeb Compatibility SECTION 3
			There MUST be a <Catch> block.
			The <Catch> MUST set SMWXMLMess = 'Error from {JobName} {exception}'
		
============================================================================ -->
<Job autoclose="YES" xml:space="preserve" breakpoint="No" messagelogfile="{JobDir}\AccessControlLogs\AccessControl.log" >
	<Block>
		<Parameters>
			<Parameter name="Area"/>
			<Parameter name="Thisbatchno"/>
		</Parameters>
		
		<!-- ============================================================= -->
		<!-- SpacemanWeb Compatibility SECTION 1                           -->
		<!-- CHECK for the existence of the connection variable            -->
		<!-- SMWXMLMess which is used ONLY by SpacemanWeb.                 -->
		<!-- Then identify the callingProcess accordingly                  -->
		<!-- ============================================================= -->
		<IfSQL condition="varexists('SMWXMLMess') = 0">
			<SetVariable type="String" name="callingProcess" value="Space Manager"/>
		</IfSQL>
		<Else>
			<SetVariable type="String" name="callingProcess" value="SpacemanWeb"/>
		</Else>
		<!-- =============================================================== -->
		<!-- end of SpacemanWeb compatibility SECTION 1                      -->
		<!-- Now do the things necessary for Access Control                  -->
		<!-- =============================================================== -->
		
		
		<!-- =============================================================== -->
		<!-- Space Manager Access Interface Script                           -->
		<!-- put the body of the Access Interface Script                     -->
		<!-- BELOW this comment section...                                   -->
		<!-- ............................................................... -->
		
		<!--  your Access Interface code goes here -->
		
		<!-- ............................................................... -->
		<!-- Space Manager Access Interface Script                           -->
		<!-- put the body of the Access Interface Script                     -->
		<!-- ABOVE this comment section...                                   -->
		<!-- =============================================================== -->
		
		
		<!-- ============================================================= -->
		<!-- SpacemanWeb Compatibility SECTION 2                           -->
		<!-- Set the value of SMWXMLMess to return SUCCESS to SpacemanWeb  -->
		<!-- ============================================================= -->
		<IfSQL condition=":CallingProcess = 'SpacemanWeb'">
			<SQLExec>SET SMWXMLMess='SUCCESS';</SQLExec>
		</IfSQL>
		<Else>
			<!-- Space Manager needs no return value -->
		</Else>
	</Block>
	
	
	<Catch>
		<Rollback/>
		<!-- =================================================================== -->
		<!-- SpacemanWeb Compatibility SECTION 3                                 -->
		<!-- Set the value of SMWXMLMess to return the exception to SpacemanWeb  -->
		<!-- =================================================================== -->
		<IfSQL condition=":CallingProcess = 'SpacemanWeb'">
			<SQLExec>SET SMWXMLMess='Error from {JobFilename} {exception}';</SQLExec>
		</IfSQL>
		<Else>
			<!-- Add any Space Manager Catch code here -->
		</Else>
	</Catch>
	<Library>
		<Include>smwi.Log.xml</Include>
	</Library>
</Job>