Still struggline with getting everything working with database layer security.
This commit is contained in:
parent
7a977d5acd
commit
5f129c98fc
4 changed files with 233 additions and 115 deletions
|
|
@ -9,8 +9,8 @@
|
|||
Transform ADL into (partial) controller classes
|
||||
|
||||
$Author: sb $
|
||||
$Revision: 1.26 $
|
||||
$Date: 2009-02-06 12:08:28 $
|
||||
$Revision: 1.27 $
|
||||
$Date: 2009-02-06 17:48:58 $
|
||||
-->
|
||||
|
||||
<!-- WARNING WARNING WARNING: Do NOT reformat this file!
|
||||
|
|
@ -70,7 +70,7 @@
|
|||
//
|
||||
// Automatically generated abstract super class for controllers for the
|
||||
// <xsl:value-of select="/adl:application/@name"/> application; generated using
|
||||
// adl2controllerclasses.xslt version <xsl:value-of select="substring( '$Revision: 1.26 $', 10)"/>
|
||||
// adl2controllerclasses.xslt version <xsl:value-of select="substring( '$Revision: 1.27 $', 10)"/>
|
||||
//
|
||||
// <xsl:value-of select="/adl:application/@revision"/>
|
||||
//
|
||||
|
|
@ -181,7 +181,7 @@
|
|||
//
|
||||
// Controller for auto-generated forms for editing <xsl:value-of select="@name"/>s
|
||||
// Automatically generated from application description using
|
||||
// adl2controllerclasses.xslt version <xsl:value-of select="substring( '$Revision: 1.26 $', 10)"/>
|
||||
// adl2controllerclasses.xslt version <xsl:value-of select="substring( '$Revision: 1.27 $', 10)"/>
|
||||
//
|
||||
// This file is automatically generated; DO NOT EDIT IT.
|
||||
//
|
||||
|
|
@ -439,7 +439,9 @@
|
|||
{
|
||||
record.<xsl:value-of select="@name"/> = <xsl:call-template name="fetch-property-instance">
|
||||
<xsl:with-param name="property" select="."/>
|
||||
<xsl:with-param name="value">Form[ "<xsl:value-of select="concat( 'instance.', @name)"/>"]</xsl:with-param>
|
||||
<xsl:with-param name="value">
|
||||
Form[ "<xsl:value-of select="concat( 'instance.', @name)"/>"]
|
||||
</xsl:with-param>
|
||||
</xsl:call-template>;
|
||||
}
|
||||
</xsl:when>
|
||||
|
|
@ -454,15 +456,27 @@
|
|||
|
||||
<xsl:for-each select="descendant::adl:property[@type='link']">
|
||||
<xsl:variable name="farentityname" select="@entity"/>
|
||||
<xsl:variable name="farkey" select="//adl:entity[@name=$farentityname]/adl:key/adl:property[position()=1]/@name"/>
|
||||
<xsl:variable name="entity" select="//adl:entity[@name=$farentityname]"/>
|
||||
<xsl:variable name="farkey" select="$entity/adl:key/adl:property[position()=1]/@name"/>
|
||||
<xsl:variable name="farkeybasetype">
|
||||
<xsl:call-template name="base-type">
|
||||
<xsl:with-param name="property" select="//adl:entity[@name=$farentityname]/adl:key/adl:property[position()=1]"/>
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
<xsl:variable name="deletegroups">
|
||||
<xsl:call-template name="entity-delete-groups">
|
||||
<xsl:with-param name="entity" select="$entity"/>
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
/* to update a link table which has no other data than the near and far keys, it is
|
||||
* sufficient to smash the existing values and create new ones. It's also a lot easier! */
|
||||
|
||||
<xsl:if test="$authentication-layer = 'Database'">
|
||||
if ( <xsl:for-each select="exsl:node-set( $deletegroups)/*">
|
||||
InGroup( "<xsl:value-of select="./@name"/>") ||
|
||||
</xsl:for-each> false) {
|
||||
/* however, we cannot do anything unless we have delete permissions on the table, so
|
||||
* should not try. */
|
||||
</xsl:if>
|
||||
string[] <xsl:value-of select="concat(@name, 'Values')"/> = Form.GetValues( "<xsl:value-of select="concat( 'instance.', @name)"/>");
|
||||
|
||||
/* update the linking table for my <xsl:value-of select="@name"/>; first smash the old values */
|
||||
|
|
@ -473,7 +487,7 @@
|
|||
else
|
||||
{
|
||||
<xsl:value-of select="concat( 'record.', @name)"/> = new HashedSet<<xsl:value-of select="concat( $entityns, '.', @entity)"/>>();
|
||||
}
|
||||
} /* if ( <xsl:value-of select="concat( 'record.', @name)"/> != null) */
|
||||
|
||||
if ( <xsl:value-of select="concat(@name, 'Values')"/> != null)
|
||||
{
|
||||
|
|
@ -487,13 +501,19 @@
|
|||
<xsl:with-param name="value" select="'index'"/>
|
||||
</xsl:call-template>
|
||||
.UniqueResult<<xsl:value-of select="concat( $entityns, '.', @entity)"/>>());
|
||||
}
|
||||
}
|
||||
} /* foreach ( string index in <xsl:value-of select="concat(@name, 'Values')"/>) */
|
||||
} /* if ( <xsl:value-of select="concat(@name, 'Values')"/> != null) */
|
||||
<xsl:if test="$authentication-layer = 'Database'">
|
||||
} /* if ( <xsl:for-each select="exsl:node-set( $deletegroups)/*">
|
||||
InGroup( "<xsl:value-of select="./@name"/>") ||
|
||||
</xsl:for-each> false) */
|
||||
</xsl:if>
|
||||
</xsl:for-each>
|
||||
|
||||
<xsl:for-each select="descendant::adl:property[@type='list']">
|
||||
<xsl:variable name="farentityname" select="@entity"/>
|
||||
<xsl:variable name="farkey" select="//adl:entity[@name=$farentityname]/adl:key/adl:property[position()=1]/@name"/>
|
||||
<xsl:variable name="entity" select="//adl:entity[@name=$farentityname]"/>
|
||||
<xsl:variable name="farkey" select="$entity/adl:key/adl:property[position()=1]/@name"/>
|
||||
<xsl:variable name="farkeybasetype">
|
||||
<xsl:call-template name="base-type">
|
||||
<xsl:with-param name="property" select="//adl:entity[@name=$farentityname]/adl:key/adl:property[position()=1]"/>
|
||||
|
|
@ -511,8 +531,19 @@
|
|||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
<xsl:variable name="deletegroups">
|
||||
<xsl:call-template name="entity-delete-groups">
|
||||
<xsl:with-param name="entity" select="$entity"/>
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
/* with a list we cannot just smash the old values! Instead we need to check
|
||||
* each one and exclude it if no longer required */
|
||||
* each one and exclude it if no longer required; */
|
||||
<xsl:if test="$authentication-layer = 'Database'">
|
||||
if ( <xsl:for-each select="exsl:node-set( $deletegroups)/*">
|
||||
InGroup( "<xsl:value-of select="./@name"/>") ||
|
||||
</xsl:for-each> false) {
|
||||
/* but once again only if we can delete and create entities at the far end. */
|
||||
</xsl:if>
|
||||
if ( Form.GetValues( "<xsl:value-of select="concat( 'instance.', @name)"/>") != null)
|
||||
{
|
||||
string[] <xsl:value-of select="concat(@name, 'Values')"/> = Form.GetValues( "<xsl:value-of select="concat( 'instance.', @name)"/>");
|
||||
|
|
@ -568,6 +599,10 @@
|
|||
}
|
||||
} /* foreach ( string index... */
|
||||
} /* if ( Form.GetValues( "<xsl:value-of select="concat( 'instance.', @name)"/>") != null) */
|
||||
<xsl:if test="$authentication-layer = 'Database'">
|
||||
} /* if ( <xsl:for-each select="exsl:node-set( $deletegroups)/*">InGroup( "<xsl:value-of select="./@name"/>") ||</xsl:for-each> false) */
|
||||
</xsl:if>
|
||||
|
||||
</xsl:for-each>
|
||||
|
||||
/* write the record to the database, in order to guarantee we have a valid key */
|
||||
|
|
@ -578,10 +613,14 @@
|
|||
messages.Add( "<xsl:call-template name="i18n-record-saved"/>");
|
||||
} /* try actually commit */
|
||||
catch ( Exception any) {
|
||||
tx.Rollback();
|
||||
messages.Add( "<xsl:call-template name="i18n-record-not-saved"/>");
|
||||
throw any;
|
||||
AddError( any);
|
||||
try {
|
||||
tx.Rollback();
|
||||
} catch ( ObjectDisposedException ode) {
|
||||
AddError( ode);
|
||||
}
|
||||
} /* catch ( Exception any) */
|
||||
} /* if ( record != null) */
|
||||
else {
|
||||
throw new ApplicationException( String.Format( "<xsl:call-template name="i18n-record-not-found">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue