session.xml 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. IBM Cognos Products: ps
  5. (C) Copyright IBM Corp. 2005, 2015
  6. US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7. -->
  8. <!--
  9. Copyright (C) 2008 Cognos ULC, an IBM Company. All rights reserved.
  10. Cognos (R) is a trademark of Cognos ULC, (formerly Cognos Incorporated).
  11. -->
  12. <xsl:stylesheet version="1.0"
  13. xmlns:xts="http://developer.cognos.com/schemas/xts/"
  14. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  15. xmlns:cml="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/cml/1/"
  16. xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/"
  17. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  18. exclude-result-prefixes="cml cm xts xtsext">
  19. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  20. <!-- If we have m_reload in the request then this means we need to update user prefs -->
  21. <xsl:variable name="refresh-session" select="/root/env/param[@name='m_reload']"/>
  22. <xsl:key name="env-param" match="/root/env/param" use="@name"/>
  23. <xsl:key name="system-param" match="/root/system/param" use="@name"/>
  24. <xsl:template match="/root">
  25. <xsl:variable name="userAccount" select="newSession/cm:queryResponse/cm:queryReply[3]/cm:account"/>
  26. <xsl:variable name="tenantID" select="newSession/tenantInfo//cm:tenantID"/>
  27. <xsl:variable name="tenantDisplayName" select="newSession/tenantInfo//cm:defaultName"/>
  28. <xsl:variable name="readTenantID" select="newSession/camIdentity//*[local-name()='readTenantIDs']"/>
  29. <xsl:variable name="writeTenantID" select="newSession/camIdentity//*[local-name()='writeTenantID']"/>
  30. <xsl:variable name="isImpersonating" select="newSession/camIdentity//*[local-name()='isImpersonating']"/>
  31. <xsl:variable name="camIdentity" select="newSession/camIdentity/*[local-name()='getIdentityResponse']"/>
  32. <xsl:variable name="tenantEnabledInstall" select="count(availableTenants/cm:queryResponse/*/cm:tenantID) &gt; 0"/>
  33. <xsl:variable name="showTenantInfoForAllUsers" select="/root/configSettings/configuration/property[@name='portal.showTenantInfoForAllUsers']='true'"/>
  34. <xsl:variable name="role" select="newSession/cm:queryResponse/cm:queryReply[4]/cm:session/cm:identity/cm:role"/>
  35. <xsl:variable name="isSysAdmin" select="count($role[cm:searchPath='CAMID(&quot;::System Administrators&quot;)'])!= 0"/>
  36. <xsl:variable name="isTenantAdmin" select="count($role[cm:searchPath='CAMID(&quot;::Tenant Administrators&quot;)'])!= 0"/>
  37. <xsl:variable name="showTenantInfo" select="$tenantEnabledInstall and ($showTenantInfoForAllUsers or $isSysAdmin or $isTenantAdmin)"/>
  38. <xsl:variable name="mPath" select="/root/mroot/cm:queryResponse/*/cm:searchPath"/>
  39. <xsl:variable name="cPath" select="/root/croot/cm:queryResponse/*/cm:searchPath"/>
  40. <xsl:variable name="activeNamespaces" select="count(newSession/cm:queryResponse/cm:queryReply[5]/*[./*[local-name() = 'active'] = 'true'])"/>
  41. <xsl:variable name="traversableNamespaces" select="count(newSession/cm:queryResponse/cm:queryReply[5]/*[contains(concat(' ', ./*[local-name() = 'permissions'], ' '), ' traverse ')])"/>
  42. <xsl:variable name="canCallLogon">
  43. <xsl:choose>
  44. <xsl:when test="/root/credential/param[@name='CAM']/*[local-name() ='CAM']/*[local-name() = 'CAMPassport']/*[local-name() = 'canCallLogon']">
  45. <xsl:value-of select="/root/credential/param[@name='CAM']/*[local-name() ='CAM']/*[local-name() = 'CAMPassport']/*[local-name() = 'canCallLogon']"/>
  46. </xsl:when>
  47. <xsl:when test="/root/header/*[local-name() = 'biBusHeader']/*[local-name()= 'CAM']/CAMPassport/canCallLogon">
  48. <xsl:value-of select="/root/header/*[local-name() = 'biBusHeader']/*[local-name()= 'CAM']/CAMPassport/canCallLogon"/>
  49. </xsl:when>
  50. <xsl:otherwise>
  51. <!-- Rare cases where the CAM section is not available -->
  52. <xsl:value-of select="$activeNamespaces > $traversableNamespaces"/>
  53. </xsl:otherwise>
  54. </xsl:choose>
  55. </xsl:variable>
  56. <xts:sequence>
  57. <!-- Set the current session -->
  58. <xsl:choose>
  59. <!-- If we have a session cookie then xts created a <session> element, update any parameters which need updating -->
  60. <xsl:when test="cookies/cookie[@name='cc_session'] and cookies/cookie[@name='cc_session'] != '' ">
  61. <!-- Sort options can be set by passing them in the request.
  62. Therefore, look for these in the current request and update the corresponding session values accordingly
  63. -->
  64. <!-- Sort options-->
  65. <xsl:for-each select="env/param[starts-with(@name,'m_s_')]">
  66. <xts:replace select="/root/session/param[@name='{substring(./@name,3)}']">
  67. <param name="{substring(@name,3)}"><xsl:value-of select="."/></param>
  68. </xts:replace>
  69. </xsl:for-each>
  70. <!-- After changing the default order of entries on the "sort" page we would want to revert back to default sorting -->
  71. <xsl:if test="/root/env/param[@name = 'resetSort']">
  72. <xts:replace select="/root/session/param[@name='s_cc']">
  73. <param name="s_cc"/>
  74. </xts:replace>
  75. </xsl:if>
  76. <xsl:if test="key('env-param', 'ui')">
  77. <xts:replace select="/root/session/param[@name='ui']">
  78. <param name="ui"><xsl:value-of select="xtsext:urlencode(string(key('env-param', 'ui')))"/></param>
  79. </xts:replace>
  80. </xsl:if>
  81. <!-- If user prefs have changed then update the session -->
  82. <xsl:if test="$refresh-session">
  83. <!-- Clear the cache state (portal tabs) -->
  84. <xts:delete select="/root/session/param[@name='cachestamp']"/>
  85. <!-- Refresh User Name -->
  86. <xsl:if test="boolean($userAccount/cm:defaultName) and not($userAccount/cm:defaultName='')">
  87. <xts:replace select="/root/session/param[@name='e_user']">
  88. <param name="e_user"><xsl:value-of select="$userAccount/cm:defaultName"/></param>
  89. </xts:replace>
  90. </xsl:if>
  91. <xts:replace select="/root/session/param[@name='e_isSysAdmin']">
  92. <param name="e_isSysAdmin"><xsl:value-of select="$isSysAdmin"/></param>
  93. </xts:replace>
  94. <xts:replace select="/root/session/param[@name='e_isTenantAdmin']">
  95. <param name="e_isTenantAdmin"><xsl:value-of select="$isTenantAdmin"/></param>
  96. </xts:replace>
  97. <!-- Refresh Tenant Info -->
  98. <xts:replace select="/root/session/param[@name='e_tenantDisplayName']">
  99. <param name="e_tenantDisplayName"><xsl:value-of select="$tenantDisplayName"/></param>
  100. </xts:replace>
  101. <xts:replace select="/root/session/param[@name='e_tenantID']">
  102. <param name="e_tenantID"><xsl:value-of select="$tenantID"/></param>
  103. </xts:replace>
  104. <xts:replace select="/root/session/param[@name='e_showTenantInfo']">
  105. <param name="e_showTenantInfo"><xsl:value-of select="$showTenantInfo"/></param>
  106. </xts:replace>
  107. <!-- Refresh read TenantID -->
  108. <xts:delete select="/root/session/param[@name='e_readTenantID']"/>
  109. <xsl:if test="boolean($readTenantID)">
  110. <xts:append select="/root/session">
  111. <param name="e_readTenantID"><xsl:value-of select="$readTenantID"/></param>
  112. </xts:append>
  113. </xsl:if>
  114. <!-- Refresh write TenantID -->
  115. <xts:delete select="/root/session/param[@name='e_writeTenantID']"/>
  116. <xts:delete select="/root/session/param[@name='e_writeTenantName']"/>
  117. <xsl:if test="boolean($writeTenantID)">
  118. <xts:append select="/root/session">
  119. <param name="e_writeTenantID"><xsl:value-of select="$writeTenantID"/></param>
  120. <param name="e_writeTenantName"><xsl:value-of select="newSession/camIdentity/writeTenantName//*[local-name()='defaultName']"/></param>
  121. </xts:append>
  122. </xsl:if>
  123. <!-- Refresh Home page -->
  124. <xts:replace select="/root/session/param[@name='e_hp']">
  125. <param name="e_hp"><xsl:value-of select="$userAccount/cm:searchPath"/></param>
  126. </xts:replace>
  127. <!-- Refresh permissions -->
  128. <xts:replace select="/root/session/param[@name='write']">
  129. <param name="write"><xsl:value-of select="string(contains($userAccount/cm:permissions, 'write'))"/></param>
  130. </xts:replace>
  131. <!-- Refresh public root folder name id and path-->
  132. <xts:replace select="/root/session/param[@name='e_proot']">
  133. <param name="e_proot"><xsl:value-of select="newSession/cm:queryResponse/cm:queryReply[1]/*/cm:defaultName"/></param>
  134. </xts:replace>
  135. <xts:replace select="/root/session/param[@name='prootid']">
  136. <param name="prootid"><xsl:value-of select="newSession/cm:queryResponse/cm:queryReply[1]/*/cm:storeID"/></param>
  137. </xts:replace>
  138. <xts:replace select="/root/session/param[@name='e_prootpath']">
  139. <param name="e_prootpath"><xsl:value-of select="newSession/cm:queryResponse/cm:queryReply[1]/*/cm:searchPath"/></param>
  140. </xts:replace>
  141. <!-- Refresh private root folder name id and path -->
  142. <xts:replace select="/root/session/param[@name='e_mroot']">
  143. <param name="e_mroot"><xsl:value-of select="newSession/cm:queryResponse/cm:queryReply[2]/*/cm:defaultName"/></param>
  144. </xts:replace>
  145. <!-- Refresh public root folder id -->
  146. <xts:replace select="/root/session/param[@name='mrootid']">
  147. <param name="mrootid"><xsl:value-of select="newSession/cm:queryResponse/cm:queryReply[2]/*/cm:storeID"/></param>
  148. </xts:replace>
  149. <xts:replace select="/root/session/param[@name='e_mrootpath']">
  150. <param name="e_mrootpath"><xsl:value-of select="newSession/cm:queryResponse/cm:queryReply[2]/*/cm:searchPath"/></param>
  151. </xts:replace>
  152. <!-- refresh the content locale used to snapshot e_proot and e_mroot -->
  153. <xts:replace select="/root/session/param[@name='cl']">
  154. <param name="cl"><xsl:value-of select="/root/session/param[@name='contentLocale']"/></param>
  155. </xts:replace>
  156. <!-- Refresh default context id (id of the first tab in the user's my pages) -->
  157. <xts:replace select="/root/session/param[@name='dcid']">
  158. <param name="dcid">
  159. <xsl:call-template name="set-dcid">
  160. <xsl:with-param name="account" select="$userAccount"/>
  161. </xsl:call-template>
  162. </param>
  163. </xts:replace>
  164. <!-- Refresh UI control groups -->
  165. <xts:replace select="/root/session/param[@name='uig']">
  166. <param name="uig">
  167. <xsl:call-template name="setUIControlGroups"/>
  168. </param>
  169. </xts:replace>
  170. <!-- Refresh RS UI Profiles (Professional and BUA - formerly Express) -->
  171. <xts:replace select="/root/session/param[@name='rsuiprofile']">
  172. <param name="rsuiprofile">
  173. <xsl:variable name="rsProfilesPro" select="/root/rsProfiles/*/*[local-name()='uiProfile']/*[local-name()='name']/*[local-name()='multilingualToken' and string(.)='Professional']/../../*[local-name()='permissions' and (contains(string(.),'execute') or contains(string(.),'traverse'))]"/>
  174. <xsl:variable name="rsProfilesBia" select="/root/rsProfiles/*/*[local-name()='uiProfile']/*[local-name()='name']/*[local-name()='multilingualToken' and string(.)='Express']/../../*[local-name()='permissions' and (contains(string(.),'execute') or contains(string(.),'traverse'))]"/>
  175. <xsl:variable name="lastUIProfile" select="/root/lastUserInterfaceProfile/*/*[local-name()='userInterfaceProfile']"/>
  176. <xsl:variable name="uiProfilesPro" select="/root/readableUserInterfaceProfile/*/*[local-name()='userInterfaceProfile']/*[local-name()='name']/*[local-name()='multilingualToken' and string(.)='Report Studio Professional']/../../*[local-name()='permissions' and (contains(string(.),'read'))]"/>
  177. <xsl:variable name="uiProfilesNum" select="count(/root/readableUserInterfaceProfile/*/*[local-name()='userInterfaceProfile'])"/>
  178. <xsl:choose>
  179. <xsl:when test="not($lastUIProfile)">
  180. <xsl:choose>
  181. <xsl:when test="$rsProfilesPro and $rsProfilesBia">all</xsl:when>
  182. <xsl:when test="$rsProfilesPro">pro</xsl:when>
  183. <xsl:when test="$rsProfilesBia">bua</xsl:when>
  184. </xsl:choose>
  185. </xsl:when>
  186. <xsl:otherwise>
  187. <xsl:choose>
  188. <xsl:when test="$uiProfilesPro and number($uiProfilesNum) > 1">all</xsl:when>
  189. <xsl:when test="$uiProfilesPro and number($uiProfilesNum) = 1">pro</xsl:when>
  190. <xsl:when test="not($uiProfilesPro) and number($uiProfilesNum) > 0">bua</xsl:when>
  191. </xsl:choose>
  192. </xsl:otherwise>
  193. </xsl:choose>
  194. </param>
  195. </xts:replace>
  196. <!-- Refresh LotusConnections HomePage -->
  197. <xts:replace select="/root/session/param[@name='lch']">
  198. <param name="lch">
  199. <xsl:choose>
  200. <xsl:when test="string(/root/collaborationApps/configuration/property[@name='lc_homepage_uri'])!=''">t</xsl:when>
  201. <xsl:otherwise>f</xsl:otherwise>
  202. </xsl:choose>
  203. </param>
  204. </xts:replace>
  205. <!-- Refresh LotusConnections activities -->
  206. <xts:replace select="/root/session/param[@name='lca']">
  207. <param name="lca">
  208. <xsl:choose>
  209. <xsl:when test="string(/root/collaborationApps/configuration/property[@name='lc_activities_uri'])!=''">t</xsl:when>
  210. <xsl:otherwise>f</xsl:otherwise>
  211. </xsl:choose>
  212. </param>
  213. </xts:replace>
  214. <!-- Refresh Desk top install state -->
  215. <xts:replace select="/root/session/param[@name='ci']">
  216. <param name="ci">
  217. <xsl:choose>
  218. <xsl:when test="/root/ciInstalled/cddNotFound">f</xsl:when>
  219. <xsl:otherwise>t</xsl:otherwise>
  220. </xsl:choose>
  221. </param>
  222. </xts:replace>
  223. <!-- Refresh Show Logon -->
  224. <xts:replace select="/root/session/param[@name='show_logon']">
  225. <param name="show_logon"><xsl:value-of select="$canCallLogon='true'"/></param>
  226. </xts:replace>
  227. <!--
  228. We normally reset pager flages when we refresh the session.
  229. Except when explicitly instructed not to (b/c it is important to maintain paging state for one reason or another.
  230. -->
  231. <xsl:if test="not(key('env-param', 'm_retainPagerState'))">
  232. <xts:delete select="/root/env/param[starts-with(@name, 'm_section')]"/>
  233. <xts:delete select="/root/env/param[starts-with(@name, 'm_pagerfrom')]"/>
  234. <xts:delete select="/root/env/param[starts-with(@name, 'm_pagerto')]"/>
  235. <xts:delete select="/root/env/param[starts-with(@name, 'm_pg_e')]"/>
  236. </xsl:if>
  237. </xsl:if>
  238. <!-- Support for m_root URL parameter and consumer_root entry in system.xml -->
  239. <!--
  240. Order of precedence
  241. 1. m_root value is used provided:
  242. - the user is not restricted by the consumer_root.
  243. - the user is restricted by the consumer_root and the restriction level is an ancestor of the value.
  244. - if it is not a part of the /content structure.
  245. 2. consumer_root value is used provided:
  246. - the system.xml file contains a value other than /content.
  247. - the user does not have administrator capabilities.
  248. -->
  249. <!-- It is only necessary to update the e_root value in the session cookie when the m_root is specified or its value is blank -->
  250. <!-- If m_roots are cleared, the consumer_root restrictions then apply - if applicable -->
  251. <!-- m_root restrictions apply until a new m_root is provided -->
  252. <xsl:choose>
  253. <xsl:when test="/root/mroot">
  254. <xsl:variable name="mrVal">
  255. <xsl:choose>
  256. <xsl:when test="not(boolean(/root/session/param[@name='capabilities']/canUseAdministrationPortal)) and /root/croot and starts-with( string($mPath),'/content') and not( contains( string($mPath),string($cPath) ) )"><xsl:value-of select="$cPath"/></xsl:when>
  257. <xsl:otherwise><xsl:value-of select="$mPath"/></xsl:otherwise>
  258. </xsl:choose>
  259. </xsl:variable>
  260. <xts:replace select="/root/session/param[@name='e_root']">
  261. <param name="e_root"><xsl:value-of select="$mrVal"/></param>
  262. </xts:replace>
  263. </xsl:when>
  264. <xsl:when test="/root/croot and string(/root/session/param[@name='e_root'])!=string($cPath) and not(boolean(/root/session/param[@name='capabilities']/canUseAdministrationPortal))">
  265. <xts:replace select="/root/session/param[@name='e_root']">
  266. <param name="e_root"><xsl:value-of select="$cPath"/></param>
  267. </xts:replace>
  268. </xsl:when>
  269. </xsl:choose>
  270. </xsl:when>
  271. <!-- If we have no session cookie then xts created an empty <session/> element - update it with user prefs. -->
  272. <!-- ============================================================================= -->
  273. <xsl:otherwise>
  274. <xsl:variable name="debug">
  275. <xsl:choose>
  276. <xsl:when test="key('env-param', 'd')"><xsl:value-of select="key('env-param', 'd')"/></xsl:when>
  277. <xsl:otherwise>0</xsl:otherwise>
  278. </xsl:choose>
  279. </xsl:variable>
  280. <!-- Construct the default session.. This element will be packed and stored in a session cookie for later use. -->
  281. <!--
  282. Parameters prefixed with e_ are can contain none-ascii and multibyte chars and therefore are carefully encoded/decoded whenever the session is packed or unpacked.
  283. Parameters prefixed with s_ are reserved for sorting options.
  284. -->
  285. <xts:delete select="/root/session/param[string(@type)!='CRN']"/>
  286. <xts:append select="/root/session">
  287. <param name="s_cc"/>
  288. <param name="s_conf">na</param>
  289. <param name="s_sch">td</param>
  290. <param name="s_hd">sa</param>
  291. <param name="s_serv">na</param>
  292. <param name="s_disp">na</param>
  293. <param name="s_set"></param>
  294. <param name="s_dep">na</param>
  295. <param name="s_dir">na</param>
  296. <param name="s_sms">dd</param>
  297. <param name="s_ct">sa</param>
  298. <param name="s_cs">sa</param>
  299. <param name="s_so">sa</param>
  300. <param name="e_hp"><xsl:value-of select="$userAccount/cm:searchPath"/></param>
  301. <param name="e_proot"><xsl:value-of select="newSession/cm:queryResponse/cm:queryReply[1]/*/cm:defaultName"/></param>
  302. <param name="prootid"><xsl:value-of select="newSession/cm:queryResponse/cm:queryReply[1]/*/cm:storeID"/></param>
  303. <param name="e_mroot"><xsl:value-of select="newSession/cm:queryResponse/cm:queryReply[2]/*/cm:defaultName"/></param>
  304. <param name="mrootid"><xsl:value-of select="newSession/cm:queryResponse/cm:queryReply[2]/*/cm:storeID"/></param>
  305. <param name="e_mrootpath"><xsl:value-of select="newSession/cm:queryResponse/cm:queryReply[2]/*/cm:searchPath"/></param>
  306. <param name="e_user"><xsl:value-of select="$userAccount/cm:defaultName"/></param>
  307. <param name="e_tenantID"><xsl:value-of select="$tenantID"/></param>
  308. <param name="e_tenantDisplayName"><xsl:value-of select="$tenantDisplayName"/></param>
  309. <param name="e_showTenantInfo"><xsl:value-of select="$showTenantInfo"/></param>
  310. <param name="e_isSysAdmin"><xsl:value-of select="$isSysAdmin"/></param>
  311. <param name="e_isTenantAdmin"><xsl:value-of select="$isTenantAdmin"/></param>
  312. <xsl:if test="boolean($readTenantID)">
  313. <param name="e_readTenantID"><xsl:value-of select="$readTenantID"/></param>
  314. </xsl:if>
  315. <xsl:if test="boolean($writeTenantID)">
  316. <param name="e_writeTenantID"><xsl:value-of select="$writeTenantID"/></param>
  317. <param name="e_writeTenantName"/>
  318. </xsl:if>
  319. <param name="e_isImpersonating"><xsl:value-of select="$isImpersonating"/></param>
  320. <param name="cl"><xsl:value-of select="/root/session/param[@name='contentLocale']"/></param>
  321. <param name="dcid">
  322. <xsl:call-template name="set-dcid">
  323. <xsl:with-param name="account" select="$userAccount"/>
  324. </xsl:call-template>
  325. </param>
  326. <param name="show_logon"><xsl:value-of select="$canCallLogon='true'"/></param>
  327. <param name="uig">
  328. <xsl:call-template name="setUIControlGroups"/>
  329. </param>
  330. <param name="ui"><xsl:value-of select="xtsext:urlencode(string(key('env-param', 'ui')))"/></param>
  331. <xsl:if test="string(key('system-param', 'enable-package-capability-check'))='true'">
  332. <param name="pccEnabled"/>
  333. </xsl:if>
  334. <param name="rsuiprofile">
  335. <xsl:variable name="rsProfilesPro" select="/root/rsProfiles/*/*[local-name()='uiProfile']/*[local-name()='name']/*[local-name()='multilingualToken' and string(.)='Professional']/../../*[local-name()='permissions' and (contains(string(.),'execute') or contains(string(.),'traverse'))]"/>
  336. <xsl:variable name="rsProfilesBia" select="/root/rsProfiles/*/*[local-name()='uiProfile']/*[local-name()='name']/*[local-name()='multilingualToken' and string(.)='Express']/../../*[local-name()='permissions' and (contains(string(.),'execute') or contains(string(.),'traverse'))]"/>
  337. <xsl:variable name="lastUIProfile" select="/root/lastUserInterfaceProfile/*/*[local-name()='userInterfaceProfile']"/>
  338. <xsl:variable name="uiProfilesPro" select="/root/readableUserInterfaceProfile/*/*[local-name()='userInterfaceProfile']/*[local-name()='name']/*[local-name()='multilingualToken' and string(.)='Report Studio Professional']/../../*[local-name()='permissions' and (contains(string(.),'read'))]"/>
  339. <xsl:variable name="uiProfilesNum" select="count(/root/readableUserInterfaceProfile/*/*[local-name()='userInterfaceProfile'])"/>
  340. <xsl:choose>
  341. <xsl:when test="not($lastUIProfile)">
  342. <xsl:choose>
  343. <xsl:when test="$rsProfilesPro and $rsProfilesBia">all</xsl:when>
  344. <xsl:when test="$rsProfilesPro">pro</xsl:when>
  345. <xsl:when test="$rsProfilesBia">bua</xsl:when>
  346. </xsl:choose>
  347. </xsl:when>
  348. <xsl:otherwise>
  349. <xsl:choose>
  350. <xsl:when test="$uiProfilesPro and number($uiProfilesNum) > 1">all</xsl:when>
  351. <xsl:when test="$uiProfilesPro and number($uiProfilesNum) = 1">pro</xsl:when>
  352. <xsl:when test="not($uiProfilesPro) and number($uiProfilesNum) > 0">bua</xsl:when>
  353. </xsl:choose>
  354. </xsl:otherwise>
  355. </xsl:choose>
  356. </param>
  357. <!-- LotusConnections Homepage -->
  358. <param name="lch">
  359. <xsl:choose>
  360. <xsl:when test="string(/root/collaborationApps/configuration/property[@name='lc_homepage_uri'])!=''">t</xsl:when>
  361. <xsl:otherwise>f</xsl:otherwise>
  362. </xsl:choose>
  363. </param>
  364. <!-- LotusConnections Activities -->
  365. <param name="lca">
  366. <xsl:choose>
  367. <xsl:when test="string(/root/collaborationApps/configuration/property[@name='lc_activities_uri'])!=''">t</xsl:when>
  368. <xsl:otherwise>f</xsl:otherwise>
  369. </xsl:choose>
  370. </param>
  371. <!-- Set session Desk top install state -->
  372. <param name="ci">
  373. <xsl:choose>
  374. <xsl:when test="/root/ciInstalled/cddNotFound">f</xsl:when>
  375. <xsl:otherwise>t</xsl:otherwise>
  376. </xsl:choose>
  377. </param>
  378. <!-- Support for m_root URL parameter and consumer_root entry in system.xml -->
  379. <!--
  380. Order of precedence
  381. 1. m_root value is used provided:
  382. - the user is not restricted by the consumer_root.
  383. - the user is restricted by the consumer_root and the restriction level is an ancestor of the value.
  384. - if it is not a part of the /content structure.
  385. 2. consumer_root value is used provided:
  386. - the system.xml file contains a value other than /content.
  387. - the user does not have administrator capabilities.
  388. -->
  389. <!-- No e_root session cookie entry is created when there are no m_root or consumer_root restrictions -->
  390. <xsl:if test="/root/mroot or /root/croot">
  391. <xsl:variable name="rootValue">
  392. <xsl:choose>
  393. <xsl:when test="/root/mroot">
  394. <xsl:choose>
  395. <xsl:when test="/root/croot and starts-with( string($mPath),'/content ') and ( not(boolean(/root/session/param[@name='capabilities']/canUseAdministrationPortal)) and not( contains( string($mPath),string($cPath) ) ) )"><xsl:value-of select="$cPath"/></xsl:when>
  396. <xsl:otherwise><xsl:value-of select="$mPath"/></xsl:otherwise>
  397. </xsl:choose>
  398. </xsl:when>
  399. <xsl:when test="/root/croot and string($cPath) != '/content' and not(boolean(/root/session/param[@name='capabilities']/canUseAdministrationPortal))"><xsl:value-of select="$cPath"/></xsl:when>
  400. </xsl:choose>
  401. </xsl:variable>
  402. <param name="e_root"><xsl:value-of select="$rootValue"/></param>
  403. </xsl:if>
  404. <param name="write"><xsl:value-of select="string(contains($userAccount/cm:permissions, 'write'))"/></param>
  405. <!-- <param name="showGroupAndRolePages">true</param> -->
  406. <xsl:if test="string(key('system-param', 'http-cache'))='false'">
  407. <param name="no304"/>
  408. </xsl:if>
  409. <xsl:if test="string(key('system-param', 'series7')/enabled)='true'">
  410. <param name="s7e"/>
  411. </xsl:if>
  412. <param name="eom"><xsl:value-of select="key('system-param', 'entry-order-mode')"/></param>
  413. </xts:append>
  414. </xsl:otherwise>
  415. </xsl:choose>
  416. <!-- Cleanup - remove the existing passport entry otherwise duplicates get created -->
  417. <xts:delete select="/root/session/param[@name='pp']"/>
  418. <xts:delete select="/root/session/param[@name='ssshsh']"/>
  419. <xts:append select="/root/session">
  420. <!-- Make the cc_session passport-sensitive by tagging (a portion of) the passport to it. XTS will validate
  421. it to determine if it's valid with the current passport. If it's nolonger valid, XTS will clear it out forcing
  422. a session reconstruction. -->
  423. <xsl:variable name="cam_passport">
  424. <xsl:choose>
  425. <xsl:when test="/root/header/*[local-name()='biBusHeader']/*[local-name()='hdrSession']/*[local-name()='setCookieVars']/item[name='cam_passport']/value">
  426. <xsl:variable name="setPassportCookie" select="/root/header/*[local-name()='biBusHeader']/*[local-name()='hdrSession']/*[local-name()='setCookieVars']/item[name='cam_passport']/value"/>
  427. <xsl:value-of select="xtsext:camcookie_action('getPassportID', $setPassportCookie)"/>
  428. </xsl:when>
  429. <xsl:otherwise>
  430. <xsl:value-of select="/root/credential/param[@name='CAM']/*[local-name() ='CAM']/*[local-name() = 'CAMPassport']/*[local-name() = 'id']"/>
  431. </xsl:otherwise>
  432. </xsl:choose>
  433. </xsl:variable>
  434. <param name="pp"><xsl:value-of select="xtsext:substringAfterLast(string($cam_passport), ':')"/></param>
  435. </xts:append>
  436. <!--
  437. If the CRN cookie is not available in the cookies element but it is available in the header's setCookie vars,
  438. it means that the CRN cookie was not initially available in the request and XTS did not get a chance to decode it an copy it to the session element
  439. We need to update the session with the CRN cookies values since they might be needed later
  440. -->
  441. <xsl:variable name="crn-setcookie" select="/root/header/*[local-name()='biBusHeader']/*[local-name()='hdrSession']/*[local-name()='setCookieVars']/item[name='CRN']/value"/>
  442. <xsl:if test=" not(cookies/cookie[@name='CRN']) and $crn-setcookie and $crn-setcookie != '' ">
  443. <xts:append select="/root/session">
  444. <xts:transform name="XMLDecode">
  445. <xsl:value-of select="xtsext:decodeCRNCookie($crn-setcookie)"/>
  446. </xts:transform>
  447. </xts:append>
  448. </xsl:if>
  449. <!-- MVC -->
  450. <xsl:if test="/root/mvcSettings">
  451. <xts:delete select="/root/session/param[@name='mvc']"/>
  452. <xts:delete select="/root/session/param[@name='mvcsys']"/>
  453. <xts:append select="/root/session">
  454. <xsl:variable name="mvc-remote-gateway" select="string(/root/mvcSettings/configuration/property[@name='MVC_remoteGateway'])"/>
  455. <xsl:variable name="mvc-remote-webcontent" select="string(/root/mvcSettings/configuration/property[@name='MVC_remoteWebContent'])"/>
  456. <xsl:variable name="mvc-N-enabled" select="$mvc-remote-gateway != '' and $mvc-remote-webcontent != ''"/>
  457. <xsl:if test="$mvc-N-enabled">
  458. <!-- The "mvc" cookie establishes MVC environment. This is important
  459. for the N-1 system esp. to handle the redirection/authentication.
  460. This cookie is set up by the N side and is visible to both N and N-1 systems -->
  461. <param name="mvc" type="NOPATH"/>
  462. <!-- The "mvcsys" cookie establishes that this is the N session in an mvc environment.
  463. This cookie is set up by the N side and is only visible to the N system -->
  464. <param name="mvcsys">n</param>
  465. </xsl:if>
  466. </xts:append>
  467. </xsl:if>
  468. <!-- Tell the set session block to repack the cc session cookie -->
  469. <xts:append>
  470. <updateSession/>
  471. </xts:append>
  472. </xts:sequence>
  473. </xsl:template>
  474. <!-- Build UI groups list -->
  475. <xsl:template name="setUIControlGroups">
  476. <xsl:variable name="userMembership" select="/root/newSession/cm:queryResponse/cm:queryReply[4]/cm:session/cm:identity"/>
  477. <xsl:for-each select="key('system-param', 'ui_groups')/group">
  478. <xsl:if test="$userMembership/*[cm:storeID = current()] and string-length(@id) &lt; 3">
  479. <xsl:value-of select="concat(' ', @id, ' ')"/>
  480. </xsl:if>
  481. </xsl:for-each>
  482. </xsl:template>
  483. <!-- Determines the id of the first page in the user's portal tabs array -->
  484. <xsl:template name="set-dcid">
  485. <xsl:param name="account"/>
  486. <xsl:choose>
  487. <xsl:when test="string(key('system-param', 'hideInaccessibleTabs')) = 'true'">
  488. <xsl:value-of select="$account/cm:portalPages/*[contains((concat(' ', cm:permissions, ' ')) , ' read ') and contains((concat(' ', cm:permissions, ' ')) , ' traverse ')][1]/cm:storeID"/>
  489. </xsl:when>
  490. <xsl:otherwise>
  491. <xsl:value-of select="$account/cm:portalPages/*[1]/cm:storeID"/>
  492. </xsl:otherwise>
  493. </xsl:choose>
  494. </xsl:template>
  495. </xsl:stylesheet>