From: Walter M. <wal...@us...> - 2008-07-04 12:17:44
|
User: walterim Date: 08/07/04 05:17:53 Modified: andromda-jsf2/src/main/resources/META-INF/andromda cartridge.xml namespace.xml andromda-jsf2/src/main/resources/templates/jsf2/configuration web.xml.vsl faces-config.xml.vsl Log: Support to optional defaultRole to be applied to all secured elements. Needed to future dynamic role support. Revision Changes Path 1.31 +1 -0 cartridges/andromda-jsf2/src/main/resources/META-INF/andromda/cartridge.xml Index: cartridge.xml =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/META-INF/andromda/cartridge.xml,v retrieving revision 1.30 retrieving revision 1.31 diff -u -w -r1.30 -r1.31 --- cartridge.xml 16 May 2008 22:09:04 -0000 1.30 +++ cartridge.xml 4 Jul 2008 12:17:50 -0000 1.31 @@ -77,6 +77,7 @@ <property reference="portletClass"/> <property reference="paginationResultClassName"/> <property reference="defaultPortletClassName"/> + <property reference="defaultRole"/> <!-- cartridge-property merge-point --> 1.11 +5 -0 cartridges/andromda-jsf2/src/main/resources/META-INF/andromda/namespace.xml Index: namespace.xml =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/META-INF/andromda/namespace.xml,v retrieving revision 1.10 retrieving revision 1.11 diff -u -w -r1.10 -r1.11 --- namespace.xml 18 Apr 2008 21:25:09 -0000 1.10 +++ namespace.xml 4 Jul 2008 12:17:50 -0000 1.11 @@ -287,6 +287,11 @@ The security realm to use when security is enabled. </documentation> </property> + <property name="defaultRole" required="false"> + <documentation> + The default role of all secured elements. + </documentation> + </property> <property name="clientValidation"> <default>true</default> <documentation> 1.18 +13 -2 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/configuration/web.xml.vsl Index: web.xml.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/configuration/web.xml.vsl,v retrieving revision 1.17 retrieving revision 1.18 diff -u -w -r1.17 -r1.18 --- web.xml.vsl 16 May 2008 22:09:05 -0000 1.17 +++ web.xml.vsl 4 Jul 2008 12:17:51 -0000 1.18 @@ -420,8 +420,11 @@ </description> <url-pattern>${useCase.pathRoot}/*</url-pattern> </web-resource-collection> -#if ($useCase.secured) +#if ($useCase.secured || $stringUtils.isNotBlank($defaultRole)) <auth-constraint> +#if ($stringUtils.isNotBlank($defaultRole)) + <role-name>${defaultRole}</role-name> +#end #foreach ($user in $useCase.roles) <role-name>$user.name</role-name> #end @@ -445,8 +448,11 @@ </description> <url-pattern>${manageable.viewFullPath}.${jsfUtils.viewExtension}</url-pattern> </web-resource-collection> -#if (!$manageable.roles.empty) +#if (!$manageable.roles.empty || $stringUtils.isNotBlank($defaultRole)) <auth-constraint> +#if ($stringUtils.isNotBlank($defaultRole)) + <role-name>${defaultRole}</role-name> +#end #foreach ($role in $manageable.roles) <role-name>${role.name}</role-name> #end @@ -472,6 +478,11 @@ <role-name>$user.name</role-name> </security-role> #end +#if ($stringUtils.isNotBlank($defaultRole)) + <security-role> + <role-name>${defaultRole}</role-name> + </security-role> +#end <!-- security-role merge-point --> 1.19 +18 -2 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/configuration/faces-config.xml.vsl Index: faces-config.xml.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/configuration/faces-config.xml.vsl,v retrieving revision 1.18 retrieving revision 1.19 diff -u -w -r1.18 -r1.19 --- faces-config.xml.vsl 16 Jun 2008 19:33:11 -0000 1.18 +++ faces-config.xml.vsl 4 Jul 2008 12:17:51 -0000 1.19 @@ -1,3 +1,16 @@ +## +## This macro adds the default role to the roles string +## +#macro (addDefaultRole $roles) +#if($stringUtils.isNotBlank($defaultRole)) +#if($stringUtils.isBlank($roles)) +#set($roles = $defaultRole) +#else +#set($roles = "${roles},${defaultRole}") +#end +#end +#end +## <?xml version="1.0"?> <!DOCTYPE faces-config PUBLIC @@ -107,6 +120,7 @@ <value>${useCase.controllerAction}</value> </managed-property> #set ($roles = $useCase.actionRoles) +#addDefaultRole($roles) #set ($securityEnabled = $stringUtils.isNotBlank($securityRealm) && $stringUtils.isNotBlank($roles) ) #if ($securityEnabled) <managed-property> @@ -154,11 +168,13 @@ <property-name>controllerAction</property-name> <value>init</value> </managed-property> -#set ($securityEnabled = $stringUtils.isNotBlank($securityRealm) && !$manageable.roles.empty ) +#set ($roles = $manageable.actionRoles) +#addDefaultRole($roles) +#set ($securityEnabled = $stringUtils.isNotBlank($securityRealm) && $stringUtils.isNotBlank($roles)) #if ($securityEnabled) <managed-property> <property-name>roles</property-name> - <value>$manageable.actionRoles</value> + <value>${roles}</value> </managed-property> #end <managed-property> |