bug 2847 : Right, the session timeout behaviour is now as follows; in ADL, all pages now timeout after $page-timeout seconds (default is 300) to $default-page (default id default.aspx) unless $page-timeout is set to zero. This behaviour is overridden in SRU Hospitality to redirect to dblogin/dologout.rails, thus guaranteeing both the database and forms authentication settings are also cleared.

status 2847: resolved FIXED
This commit is contained in:
sb 2009-04-30 08:56:33 +00:00
parent c1e9c49647
commit e83ba2c9ac
2 changed files with 263 additions and 135 deletions

View file

@ -15,8 +15,8 @@
Transform ADL into velocity view templates
$Author: sb $
$Revision: 1.39 $
$Date: 2009-04-28 13:44:51 $
$Revision: 1.40 $
$Date: 2009-04-30 08:56:33 $
-->
<!-- WARNING WARNING WARNING: Do NOT reformat this file!
Whitespace (or lack of it) is significant! -->
@ -67,6 +67,11 @@
If not 'Application', then 'Database'. -->
<xsl:param name="authentication-layer" select="'Application'"/>
<!-- bug 2847: how long to wait on a page before it auto-redirects to the default URL -->
<xsl:param name="page-timeout" select="300"/>
<!-- bug 2847: the default URL, probably a 'please login' screen -->
<xsl:param name="default-url" select="'../default.aspx'"/>
<xsl:template match="adl:application">
<output>
<!-- 'output' is a dummy wrapper root tag to make the entire output work as
@ -118,14 +123,12 @@
<xsl:call-template name="i18n-really-delete"/>
</xsl:variable>
#set( $title = "<xsl:value-of select="concat( $really-delete, ' ', @name)"/> $instance.UserIdentifier")
#capturefor( headextras)
<xsl:comment>
<xsl:value-of select="$product-version"/>
Auto generated Velocity maybe-delete form for <xsl:value-of select="@name"/>,
generated from ADL.
Generated using adl2views.xslt <xsl:value-of select="substring( '$Revision: 1.39 $', 10)"/>
</xsl:comment>
<xsl:call-template name="head"/>
#end
<xsl:call-template name="maybe-delete">
<xsl:with-param name="entity" select="."/>
</xsl:call-template>
@ -156,15 +159,10 @@
</xsl:variable>
#set( $title = "<xsl:value-of select="concat( $really-delete, ' ', @name)"/> $instance.UserIdentifier")
<head>
<xsl:call-template name="head"/>
<xsl:comment>
Auto generated Velocity maybe-delete form for <xsl:value-of select="@name"/>,
generated from ADL.
Generated using adl2views.xslt <xsl:value-of select="substring( '$Revision: 1.39 $', 10)"/>
<xsl:value-of select="/adl:application/@revision"/>
</xsl:comment>
<xsl:call-template name="head"/>
<xsl:call-template name="install-scripts"/>
</head>
<body>
@ -238,25 +236,6 @@
<xsl:comment>[ cut here: next file '<xsl:value-of select="concat( ancestor::adl:entity/@name, '/', @name)"/>.auto.vm' ]</xsl:comment>
<xsl:text>
</xsl:text>
<xsl:comment>
<xsl:value-of select="$product-version"/>
Auto generated Velocity <xsl:value-of select="@name"/> form for <xsl:value-of select="ancestor::adl:entity/@name"/>,
generated from ADL.
Generated using adl2views.xslt <xsl:value-of select="substring( '$Revision: 1.39 $', 10)"/>
Generation parameters were:
locale: <xsl:value-of select="$locale"/>
generate-site-navigation: <xsl:value-of select="$generate-site-navigation"/>
show-errors: <xsl:value-of select="$show-errors"/>
show-messages: <xsl:value-of select="$show-messages"/>
max-widget-width: <xsl:value-of select="$max-widget-width"/>
product-version: <xsl:value-of select="$product-version"/>
layout-name: <xsl:value-of select="$layout-name"/>
area-name: <xsl:value-of select="$area-name"/>
<xsl:value-of select="/adl:application/@revision"/>
</xsl:comment>
#capturefor( title)
#if ( $instance)
#if ( ! $instance.IsNew)
@ -273,6 +252,9 @@
#end
#end
#capturefor( headextras)
<xsl:comment>
Auto generated Velocity form for <xsl:value-of select="ancestor::adl:entity/@name"/>,
</xsl:comment>
<xsl:call-template name="head"/>
<xsl:call-template name="generate-head-javascript">
<xsl:with-param name="form" select="."/>
@ -325,25 +307,17 @@
#end
</xsl:comment>
<head>
<xsl:call-template name="head"/>
<xsl:comment>
<xsl:value-of select="$product-version"/>
Auto generated Velocity form for <xsl:value-of select="ancestor::adl:entity/@name"/>,
generated from ADL.
Generated using adl2views.xsl <xsl:value-of select="substring( '$Revision: 1.39 $', 10)"/>
Generation parameters were:
locale: <xsl:value-of select="$locale"/>
generate-site-navigation: <xsl:value-of select="$generate-site-navigation"/>
show-errors: <xsl:value-of select="$show-errors"/>
show-messages: <xsl:value-of select="$show-messages"/>
max-widget-width: <xsl:value-of select="$max-widget-width"/>
product-version: <xsl:value-of select="$product-version"/>
layout-name: <xsl:value-of select="$layout-name"/>
area-name: <xsl:value-of select="$area-name"/>
<xsl:value-of select="/adl:application/@revision"/>
</xsl:comment>
<xsl:call-template name="head"/>
<xsl:if test="$page-timeout &gt; 0">
<meta http-equiv="refresh" content="5; URL=http://www.cryer.co.uk">
<xsl:attribute name="content">
<xsl:value-of select="concat($page-timeout, '; URL=', $default-url)"/>
</xsl:attribute>
</meta>
</xsl:if>
<xsl:call-template name="install-scripts"/>
<xsl:call-template name="generate-head-javascript">
<xsl:with-param name="form" select="."/>
@ -525,6 +499,18 @@
</xsl:template>
<xsl:template match="adl:fieldgroup">
<xsl:if test="$authentication-layer = 'Database'">
<xsl:variable name="property" select="."/>
<xsl:variable name="readgroups">
<xsl:call-template name="fieldgroup-read-groups">
<xsl:with-param name="fieldgroup" select="."/>
</xsl:call-template>
</xsl:variable>
<!-- NOTE! NOTE! NOTE! Whitespace is significant - any linefeeds inside the #if ( ) clause cause the Velocity parser to break! -->
<xsl:comment>If the user can't read the fieldgroup, don't output it at all.</xsl:comment>
#if ( <xsl:for-each select="exsl:node-set( $readgroups)/*"> ${SecurityHelper.InGroup( "<xsl:value-of select="./@name"/>")} ||</xsl:for-each> false)
</xsl:if>
<div class="tab-pane">
<xsl:attribute name="id">
<xsl:value-of select="concat( @name, 'pane')"/>
@ -547,6 +533,9 @@
<xsl:apply-templates select="adl:field|adl:verb|adl:auxlist"/>
</table>
</div>
<xsl:if test="$authentication-layer = 'Database'">
#end
</xsl:if>
</xsl:template>
<xsl:template match="adl:auxlist">
@ -623,6 +612,14 @@
</xsl:template>
<xsl:template match="adl:verb">
<xsl:variable name="executegroups">
<xsl:call-template name="verb-execute-groups">
<xsl:with-param name="verb" select="."/>
</xsl:call-template>
</xsl:variable>
<!-- NOTE! NOTE! NOTE! Whitespace is significant - any linefeeds inside the #if ( ) clause
cause the Velocity parser to break! -->
#if ( <xsl:for-each select="exsl:node-set( $executegroups)/*"> ${SecurityHelper.InGroup( "<xsl:value-of select="./@name"/>")} ||</xsl:for-each> false)
<xsl:variable name="class">
<xsl:choose>
<xsl:when test="@dangerous='true'">actionDangerous</xsl:when>
@ -659,6 +656,7 @@
</tr>
#end
#end
#end
</xsl:template>
<xsl:template match="adl:field">
@ -726,6 +724,16 @@
it may be we need to add a mode to indicate this! -->
<!-- for links and lists we implement a shuffle widget, which extends over both columns -->
<xsl:param name="oddness" select="odd"/>
<xsl:if test="$authentication-layer = 'Database'">
<xsl:variable name="property" select="."/>
<xsl:variable name="readgroups">
<xsl:call-template name="entity-read-groups">
<xsl:with-param name="entity" select="//adl:entity[@name=$property/@entity]"/>
</xsl:call-template>
</xsl:variable>
<!-- NOTE! NOTE! NOTE! Whitespace is significant - any linefeeds inside the #if ( ) clause cause the Velocity parser to break! -->
#if ( <xsl:for-each select="exsl:node-set( $readgroups)/*">${SecurityHelper.InGroup( "<xsl:value-of select="./@name"/>")} || </xsl:for-each> false)
</xsl:if>
<tr>
<xsl:attribute name="class">
<xsl:value-of select="$oddness"/>
@ -737,30 +745,9 @@
</xsl:call-template>")}
</td>
<td class="widget shuffle" colspan="2">
<xsl:choose>
<xsl:when test="$authentication-layer = 'Database'">
<xsl:variable name="property" select="."/>
<xsl:variable name="readgroups">
<xsl:call-template name="entity-read-groups">
<xsl:with-param name="entity" select="//adl:entity[@name=$property/@entity]"/>
</xsl:call-template>
</xsl:variable>
<!-- NOTE! NOTE! NOTE! Whitespace is significant - any linefeeds inside the #if ( ) clause cause the Velocity parser to break! -->
#if ( <xsl:for-each select="exsl:node-set( $readgroups)/*">${SecurityHelper.InGroup( "<xsl:value-of select="./@name"/>")} ||</xsl:for-each> false)
<xsl:call-template name="shuffle-widget">
<xsl:with-param name="property" select="."/>
</xsl:call-template>
#else
[Not authorised]
#end
</xsl:when>
<xsl:when test="$authentication-layer = 'Application'">
<xsl:call-template name="shuffle-widget">
<xsl:with-param name="property" select="."/>
</xsl:call-template>
</xsl:when>
</xsl:choose>
</td>
</tr>
<tr>
@ -774,6 +761,9 @@
<xsl:apply-templates select="adl:help[@locale = $locale]"/>
</td>
</tr>
<xsl:if test="$authentication-layer = 'Database'">
#end
</xsl:if>
</xsl:template>
<xsl:template name="shuffle-widget">
@ -844,6 +834,18 @@
<xsl:with-param name="property" select="$property"/>
</xsl:call-template>
</xsl:variable>
<xsl:if test="$authentication-layer = 'Database'">
<xsl:choose>
<xsl:when test="exsl:node-set( $readgroups)/*">
<xsl:comment>if the user can't even read the field, don't output it at all.</xsl:comment>
#if ( <xsl:for-each select="exsl:node-set( $readgroups)/*">${SecurityHelper.InGroup( "<xsl:value-of select="./@name"/>")} || </xsl:for-each> false)
</xsl:when>
<xsl:otherwise>
<xsl:comment>we haven't found any group of users who are entitled to see this field.</xsl:comment>
#if ( false)
</xsl:otherwise>
</xsl:choose>
</xsl:if>
<tr>
<xsl:attribute name="class">
<xsl:value-of select="$oddness"/>
@ -915,6 +917,10 @@
<xsl:apply-templates select="adl:help[@locale = $locale]"/>
</td>
</tr>
<xsl:if test="$authentication-layer = 'Database'">
#end
</xsl:if>
</xsl:template>
@ -931,28 +937,14 @@
<xsl:with-param name="noun" select="ancestor::adl:entity/@name"/>
</xsl:call-template>
</xsl:variable>
<xsl:comment>
<xsl:value-of select="$product-version"/>
Auto generated Velocity list for <xsl:value-of select="@name"/>,
generated from ADL.
Generated using adl2views.xslt <xsl:value-of select="substring( '$Revision: 1.39 $', 10)"/>
Generation parameters were:
locale: <xsl:value-of select="$locale"/>
generate-site-navigation: <xsl:value-of select="$generate-site-navigation"/>
show-errors: <xsl:value-of select="$show-errors"/>
show-messages: <xsl:value-of select="$show-messages"/>
max-widget-width: <xsl:value-of select="$max-widget-width"/>
product-version: <xsl:value-of select="$product-version"/>
layout-name: <xsl:value-of select="$layout-name"/>
area-name: <xsl:value-of select="$area-name"/>
</xsl:comment>
#capturefor( title)
<xsl:value-of select="normalize-space( concat( 'List ', $withpluralsuffix))"/>
#end
#capturefor( headextras)
<xsl:comment>
Auto generated Velocity list for <xsl:value-of select="ancestor::adl:entity/@name"/>,
</xsl:comment>
<xsl:call-template name="head"/>
#end
<xsl:call-template name="top"/>
@ -994,23 +986,10 @@
<html>
<head>
#set( $title = "<xsl:value-of select="normalize-space( concat( 'List ', $withpluralsuffix))"/>")
<xsl:call-template name="head"/>
<xsl:comment>
<xsl:value-of select="$product-version"/>
Auto generated Velocity list for <xsl:value-of select="ancestor::adl:entity/@name"/>,
generated from ADL.
Generated using adl2listview.xsl <xsl:value-of select="substring( '$Revision: 1.39 $', 10)"/>
Generation parameters were:
locale: <xsl:value-of select="$locale"/>
generate-site-navigation: <xsl:value-of select="$generate-site-navigation"/>
show-errors: <xsl:value-of select="$show-errors"/>
show-messages: <xsl:value-of select="$show-messages"/>
max-widget-width: <xsl:value-of select="$max-widget-width"/>
product-version: <xsl:value-of select="$product-version"/>
layout-name: <xsl:value-of select="$layout-name"/>
area-name: <xsl:value-of select="$area-name"/>
</xsl:comment>
<xsl:call-template name="head"/>
<xsl:call-template name="install-scripts"/>
</head>
<body>
@ -1776,7 +1755,33 @@
${ScriptsHelper.InstallScript( "Panes")}
</xsl:template>
<!-- standard header material - auto-timeout, etc -->
<xsl:template name="head">
<xsl:comment>
<xsl:value-of select="/adl:application/@name"/> <xsl:value-of select="$product-version"/> - <xsl:value-of select="/adl:application/@revision"/>
Auto generated Velocity macro for <xsl:value-of select="@name"/>,
generated from ADL.
Generated using adl2views.xslt <xsl:value-of select="substring( '$Revision: 1.40 $', 10)"/>
Generation parameters were:
area-name: <xsl:value-of select="$area-name"/>
default-url: <xsl:value-of select="$default-url"/>
generate-site-navigation: <xsl:value-of select="$generate-site-navigation"/>
layout-name: <xsl:value-of select="$layout-name"/>
locale: <xsl:value-of select="$locale"/>
max-widget-width: <xsl:value-of select="$max-widget-width"/>
product-version: <xsl:value-of select="$product-version"/>
page-timeout: <xsl:value-of select="$page-timeout"/>
show-errors: <xsl:value-of select="$show-errors"/>
show-messages: <xsl:value-of select="$show-messages"/>
</xsl:comment>
<xsl:if test="$page-timeout &gt; 0">
<meta http-equiv="refresh">
<xsl:attribute name="content">
<xsl:value-of select="concat($page-timeout, '; URL=', $default-url)"/>
</xsl:attribute>
</meta>
</xsl:if>
<xsl:choose>
<xsl:when test="adl:head">
<xsl:for-each select="adl:head/*">
@ -1791,6 +1796,7 @@
</xsl:choose>
</xsl:template>
<!-- standard top area content on all pages (navigation, etc) -->
<xsl:template name="top">
<xsl:choose>
<xsl:when test="adl:top">
@ -1848,6 +1854,7 @@
</xsl:if>
</xsl:template>
<!-- standard footer on all pages; product identifier and version -->
<xsl:template name="foot">
<xsl:choose>
<xsl:when test="adl:foot">

View file

@ -15,8 +15,8 @@
Utility templates to find permissions on various things
$Author: sb $
$Revision: 1.3 $
$Date: 2009-04-28 13:53:17 $
$Revision: 1.4 $
$Date: 2009-04-30 08:56:33 $
-->
<!-- collect all groups which can edit the specified property -->
@ -220,7 +220,61 @@
</xsl:for-each>
</xsl:template>
<!-- find, as a string, the permission which applies to this property in the context of the named group.
<!-- collect the groups which can read a fieldgroup -->
<xsl:template name="fieldgroup-read-groups">
<xsl:param name="fieldgroup"/>
<xsl:for-each select="//adl:group">
<xsl:variable name="perm">
<xsl:call-template name="fieldgroup-permission">
<xsl:with-param name="fieldgroup" select="$fieldgroup"/>
<xsl:with-param name="groupname" select="@name"/>
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<xsl:when test="$perm='all'">
<xsl:copy-of select="."/>
</xsl:when>
<xsl:when test="$perm='edit'">
<xsl:copy-of select="."/>
</xsl:when>
<xsl:when test="$perm='insert'">
<xsl:copy-of select="."/>
</xsl:when>
<xsl:when test="$perm='noedit'">
<xsl:copy-of select="."/>
</xsl:when>
<xsl:when test="$perm='read'">
<xsl:copy-of select="."/>
</xsl:when>
<xsl:otherwise/>
</xsl:choose>
</xsl:for-each>
</xsl:template>
<!-- collect the groups which can execute a verb -->
<xsl:template name="verb-execute-groups">
<xsl:param name="verb"/>
<xsl:for-each select="//adl:group">
<xsl:variable name="perm">
<xsl:call-template name="verb-permission">
<xsl:with-param name="verb" select="$verb"/>
<xsl:with-param name="groupname" select="@name"/>
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<xsl:when test="$perm='all'">
<xsl:copy-of select="."/>
</xsl:when>
<xsl:when test="$perm='edit'">
<xsl:copy-of select="."/>
</xsl:when>
<xsl:otherwise/>
</xsl:choose>
</xsl:for-each>
</xsl:template>
<!-- find, as a string, the permission which applies to this page in the context of the named group.
NOTE: recurses up the group hierarchy - if it has cycles that's your problem, buster.
page: a page, list or form element
groupname: a string, being the name of a group
@ -245,6 +299,36 @@
</xsl:choose>
</xsl:template>
<!-- find, as a string, the permission which applies to this fieldgroup in the context of the named group.
NOTE: recurses up the group hierarchy - if it has cycles that's your problem, buster.
page: a page, list or form element
groupname: a string, being the name of a group
-->
<xsl:template name="fieldgroup-permission">
<xsl:param name="fieldgroup"/>
<xsl:param name="groupname" select="'public'"/>
<xsl:choose>
<xsl:when test="$fieldgroup/adl:permission[@group=$groupname]">
<xsl:value-of select="$fieldgroup/adl:permission[@group=$groupname]/@permission"/>
</xsl:when>
<xsl:when test="$fieldgroup/ancestor::adl:page/adl:permission[@group=$groupname]">
<xsl:value-of select="$fieldgroup/ancestor::adl:page/adl:permission[@group=$groupname]/@permission"/>
</xsl:when>
<xsl:when test="$fieldgroup/ancestor::adl:entity/adl:permission[@group=$groupname]">
<xsl:value-of select="$fieldgroup/ancestor::adl:entity/adl:permission[@group=$groupname]/@permission"/>
</xsl:when>
<xsl:when test="//adl:group[@name=$groupname]/@parent">
<xsl:call-template name="fieldgroup-permission">
<xsl:with-param name="fieldgroup" select="$fieldgroup"/>
<xsl:with-param name="groupname" select="//adl:group[@name=$groupname]/@parent"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>none</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- find, as a string, the permission which applies to this property in the context of the named group.
NOTE: recurses up the group hierarchy - if it has cycles that's your problem, buster.
property: a property element
@ -270,6 +354,37 @@
</xsl:choose>
</xsl:template>
<!-- find, as a string, the permission which applies to this property in the context of the named group.
NOTE: recurses up the group hierarchy - if it has cycles that's your problem, buster.
NOTE: this is practically identical to property-permission - to the extent it might be
possible/desirable to combine the two.
verb: a verb element
groupname: a string, being the name of a group
-->
<xsl:template name="verb-permission">
<xsl:param name="verb"/>
<xsl:param name="groupname" select="'public'"/>
<xsl:choose>
<xsl:when test="$verb/adl:permission[@group=$groupname]">
<xsl:value-of select="$verb/adl:permission[@group=$groupname]/@permission"/>
</xsl:when>
<xsl:when test="$verb/ancestor::adl:form/adl:permission[@group=$groupname]">
<xsl:value-of select="$verb/ancestor::adl:form/adl:permission[@group=$groupname]/@permission"/>
</xsl:when>
<xsl:when test="$verb/ancestor::adl:entity/adl:permission[@group=$groupname]">
<xsl:value-of select="$verb/ancestor::adl:entity/adl:permission[@group=$groupname]/@permission"/>
</xsl:when>
<xsl:when test="//adl:group[@name=$groupname]/@parent">
<xsl:call-template name="verb-permission">
<xsl:with-param name="verb" select="$verb"/>
<xsl:with-param name="groupname" select="//adl:group[@name=$groupname]/@parent"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>none</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- find, as a string, the permission which applies to this field in the context of the named group
field: a field element
groupname: a string, being the name of a group
@ -281,6 +396,12 @@
<xsl:when test="$field/adl:permission[@group=$groupname]">
<xsl:value-of select="$field/adl:permission[@group=$groupname]/@permission"/>
</xsl:when>
<xsl:when test="$field/ancestor::adl:fieldgroup/adl:permission[@group=$groupname]">
<xsl:value-of select="$field/ancestor::adl:fieldgroup/adl:permission[@group=$groupname]/@permission"/>
</xsl:when>
<xsl:when test="$field/ancestor::adl:form/adl:permission[@group=$groupname]">
<xsl:value-of select="$field/ancestor::adl:form/adl:permission[@group=$groupname]/@permission"/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="property-permission">
<xsl:with-param name="property" select="$field/ancestor::adl:entity//adl:property[@name=$field/@name]"/>