Commit b0113856 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki Committed by Vincent Pelletier

use getId() instead of getUserName() where user is supposed to be neither...

use getId() instead of getUserName() where user is supposed to be neither Anonyous User nor System Processes.
parent a20b4e4b
...@@ -6,7 +6,7 @@ return destination ...@@ -6,7 +6,7 @@ return destination
# OLD METHOD user logged in # OLD METHOD user logged in
#user_id = context.portal_membership.getAuthenticatedMember().getUserName() #user_id = context.portal_membership.getAuthenticatedMember().getId()
# NEW METHOD must use owner to know site letter # NEW METHOD must use owner to know site letter
old_group_list = context.get_local_roles() old_group_list = context.get_local_roles()
......
...@@ -14,7 +14,7 @@ resource = transaction.CashDelivery_checkCounterInventory(source = destination, ...@@ -14,7 +14,7 @@ resource = transaction.CashDelivery_checkCounterInventory(source = destination,
#if len(vliste) != 0: #if len(vliste) != 0:
# raise ValidationFailed, (vliste[0].getMessage(),) # raise ValidationFailed, (vliste[0].getMessage(),)
user_id = transaction.portal_membership.getAuthenticatedMember().getUserName() user_id = transaction.portal_membership.getAuthenticatedMember().getId()
site_list = context.Baobab_getUserAssignedSiteList(user_id=user_id) site_list = context.Baobab_getUserAssignedSiteList(user_id=user_id)
# context.log('validateVaultBalance site_list',site_list) # context.log('validateVaultBalance site_list',site_list)
destination = transaction.getDestination() destination = transaction.getDestination()
......
...@@ -5,7 +5,7 @@ transaction = state_change['object'] ...@@ -5,7 +5,7 @@ transaction = state_change['object']
# Compute the source form the vault choosen by # Compute the source form the vault choosen by
# the accountant and find the counter with the # the accountant and find the counter with the
# user logged in # user logged in
user_id = transaction.portal_membership.getAuthenticatedMember().getUserName() user_id = transaction.portal_membership.getAuthenticatedMember().getId()
site_list = context.Baobab_getUserAssignedSiteList(user_id=user_id) site_list = context.Baobab_getUserAssignedSiteList(user_id=user_id)
# context.log('validateVaultBalance site_list',site_list) # context.log('validateVaultBalance site_list',site_list)
source = transaction.getSource() source = transaction.getSource()
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
from Products.ERP5Type.Cache import CachingMethod from Products.ERP5Type.Cache import CachingMethod
if user_id is None: if user_id is None:
user_id = context.portal_membership.getAuthenticatedMember().getUserName() user_id = context.portal_membership.getAuthenticatedMember().getId()
def getFunctionList(user_id=user_id): def getFunctionList(user_id=user_id):
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
from Products.ERP5Type.Cache import CachingMethod from Products.ERP5Type.Cache import CachingMethod
if user_id is None: if user_id is None:
user_id = context.portal_membership.getAuthenticatedMember().getUserName() user_id = context.portal_membership.getAuthenticatedMember().getId()
def getGroupList(user_id=user_id): def getGroupList(user_id=user_id):
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
from Products.ERP5Type.Cache import CachingMethod from Products.ERP5Type.Cache import CachingMethod
if user_id is None: if user_id is None:
user_id = context.portal_membership.getAuthenticatedMember().getUserName() user_id = context.portal_membership.getAuthenticatedMember().getId()
def getSiteList(user_id=user_id): def getSiteList(user_id=user_id):
......
from Products.ERP5Type.Cache import CachingMethod from Products.ERP5Type.Cache import CachingMethod
user_id = context.portal_membership.getAuthenticatedMember().getUserName() user_id = context.portal_membership.getAuthenticatedMember().getId()
def getUserSiteUid(user_id): def getUserSiteUid(user_id):
return context.Baobab_getUserAssignedRootSite(user_id=user_id, object=1).getSiteUid() return context.Baobab_getUserAssignedRootSite(user_id=user_id, object=1).getSiteUid()
......
<tal:block tal:condition="python: options.get('current_state') is None"> <tal:block tal:condition="python: options.get('current_state') is None">
<div id="logged_in_as"> <div id="logged_in_as">
Hello, <tal:block tal:condition="not: here/portal_membership/isAnonymousUser"> Hello, <tal:block tal:condition="not: here/portal_membership/isAnonymousUser">
<span tal:replace="python:here.portal_membership.getAuthenticatedMember().getUserName()" /> <span tal:replace="python:here.portal_membership.getAuthenticatedMember().getId()" />
</tal:block> </tal:block>
</div> </div>
<tal:block tal:replace="structure python: options.get('form_html')" /> <tal:block tal:replace="structure python: options.get('form_html')" />
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<tal:block tal:condition="not: here/portal_membership/isAnonymousUser"> <tal:block tal:condition="not: here/portal_membership/isAnonymousUser">
<span class="logged_txt"><tal:block i18n:translate="" <span class="logged_txt"><tal:block i18n:translate=""
i18n:domain="ui">User</tal:block> :</span><span class="login"> i18n:domain="ui">User</tal:block> :</span><span class="login">
<tal:block tal:replace="python:here.portal_membership.getAuthenticatedMember().getUserName()" /> <tal:block tal:replace="python:here.portal_membership.getAuthenticatedMember().getId()" />
</span> </span>
</tal:block> </tal:block>
<!--<tal:block tal:condition="here/portal_membership/isAnonymousUser"> <!--<tal:block tal:condition="here/portal_membership/isAnonymousUser">
......
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
<ul> <ul>
<li><a href="#" i18n:translate="" i18n:domain="ui" <li><a href="#" i18n:translate="" i18n:domain="ui"
tal:condition="not:is_anonymous" tal:condition="not:is_anonymous"
tal:attributes="href python:'%s/person_module/view?reset:int=1&owner=%s' % (portal_path, here.portal_membership.getAuthenticatedMember().getUserName())">My Contacts</a></li> tal:attributes="href python:'%s/person_module/view?reset:int=1&owner=%s' % (portal_path, here.portal_membership.getAuthenticatedMember().getId())">My Contacts</a></li>
<li><a href="#" i18n:translate="" i18n:domain="ui" <li><a href="#" i18n:translate="" i18n:domain="ui"
tal:attributes="href string:${portal_path}/person_module/view?reset:int=1">Everybody</a></li> tal:attributes="href string:${portal_path}/person_module/view?reset:int=1">Everybody</a></li>
</ul> </ul>
......
...@@ -38,7 +38,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ...@@ -38,7 +38,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
<!-- <!--
<tal:block tal:condition="not: here/portal_membership/isAnonymousUser"> <tal:block tal:condition="not: here/portal_membership/isAnonymousUser">
<span class="link2" i18n:translate="" i18n:domain="ui">of</span> <span class="link2" i18n:translate="" i18n:domain="ui">of</span>
<span class="link2" tal:content="python:here.portal_catalog(reference=here.portal_membership.getAuthenticatedMember().getUserName(), portal_type='Person')[0].getObject().getTitle()+' :'" /> <span class="link2" tal:content="python:here.portal_catalog(reference=here.portal_membership.getAuthenticatedMember().getId(), portal_type='Person')[0].getObject().getTitle()+' :'" />
</tal:block> </tal:block>
--> -->
</div> </div>
...@@ -134,7 +134,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ...@@ -134,7 +134,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
<span class="link2"></span> <span class="link2"></span>
<tal:block tal:condition="not: here/portal_membership/isAnonymousUser"> <tal:block tal:condition="not: here/portal_membership/isAnonymousUser">
<span class="modu" i18n:translate="" i18n:domain="ui">Logged In as :</span> <span class="modu" i18n:translate="" i18n:domain="ui">Logged In as :</span>
<span class="link2" tal:content="python:here.portal_membership.getAuthenticatedMember().getUserName()" /> <span class="link2" tal:content="python:here.portal_membership.getAuthenticatedMember().getId()" />
</tal:block> </tal:block>
<span class="link2"></span> <span class="link2"></span>
</div> --> </div> -->
......
...@@ -104,7 +104,7 @@ ...@@ -104,7 +104,7 @@
<div id="logged_in_as" class="logged_in_as"> <div id="logged_in_as" class="logged_in_as">
<tal:block tal:condition="not: portal/portal_membership/isAnonymousUser"> <tal:block tal:condition="not: portal/portal_membership/isAnonymousUser">
<span class="logged_txt" i18n:translate="" i18n:domain="ui">Logged In as :</span> <span class="logged_txt" i18n:translate="" i18n:domain="ui">Logged In as :</span>
<tal:block tal:replace="python:portal.portal_membership.getAuthenticatedMember().getUserName()" /> <tal:block tal:replace="python:portal.portal_membership.getAuthenticatedMember().getId()" />
</tal:block> </tal:block>
</div> </div>
<p class="clear"></p> <p class="clear"></p>
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
<tal:block tal:condition="not:here/portal_membership/isAnonymousUser"> <tal:block tal:condition="not:here/portal_membership/isAnonymousUser">
<li><a tal:attributes="href python:'%s/logout' % web_site_url"> <li><a tal:attributes="href python:'%s/logout' % web_site_url">
<tal:block i18n:translate="" i18n:domain="ui">Logout</tal:block> <tal:block i18n:translate="" i18n:domain="ui">Logout</tal:block>
(<tal:block tal:replace="python:here.portal_membership.getAuthenticatedMember().getUserName()" />)</a></li> (<tal:block tal:replace="python:here.portal_membership.getAuthenticatedMember().getId()" />)</a></li>
</tal:block> </tal:block>
</ul> </ul>
</div> </div>
......
...@@ -90,7 +90,7 @@ IDEAS: ...@@ -90,7 +90,7 @@ IDEAS:
<div id="logged_in_as"> <div id="logged_in_as">
<tal:block tal:condition="not: portal/portal_membership/isAnonymousUser"> <tal:block tal:condition="not: portal/portal_membership/isAnonymousUser">
<span class="logged_txt" i18n:translate="" i18n:domain="ui">Logged In as :</span> <span class="logged_txt" i18n:translate="" i18n:domain="ui">Logged In as :</span>
<tal:block tal:replace="python:portal.portal_membership.getAuthenticatedMember().getUserName()" /> <tal:block tal:replace="python:portal.portal_membership.getAuthenticatedMember().getId()" />
</tal:block> </tal:block>
</div> </div>
--> -->
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<div id="logged_in_as" class="logged_in_as"> <div id="logged_in_as" class="logged_in_as">
<tal:block tal:condition="not: portal/portal_membership/isAnonymousUser"> <tal:block tal:condition="not: portal/portal_membership/isAnonymousUser">
<span class="logged_txt" i18n:translate="" i18n:domain="ui">Logged In as :</span> <span class="logged_txt" i18n:translate="" i18n:domain="ui">Logged In as :</span>
<tal:block tal:replace="python:portal.portal_membership.getAuthenticatedMember().getUserName()" /> <tal:block tal:replace="python:portal.portal_membership.getAuthenticatedMember().getId()" />
</tal:block> </tal:block>
</div> </div>
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
from Products.ERP5Type.Log import log from Products.ERP5Type.Log import log
portal = context.getPortalObject() portal = context.getPortalObject()
reference = portal.portal_membership.getAuthenticatedMember().getUserName() reference = portal.portal_membership.getAuthenticatedMember().getId()
kw = {'reference': reference} kw = {'reference': reference}
# XXX: This try except is used in case of connection refused # XXX: This try except is used in case of connection refused
......
...@@ -84,7 +84,7 @@ ...@@ -84,7 +84,7 @@
i18n:translate="" i18n:domain="ui">Login</a></span> i18n:translate="" i18n:domain="ui">Login</a></span>
<span id="tiologin" <span id="tiologin"
tal:define="user_name python:here.portal_membership.getAuthenticatedMember().getUserName()" tal:define="user_name python:here.portal_membership.getAuthenticatedMember().getId()"
tal:condition="not:here/portal_membership/isAnonymousUser"><a href="#" id="link-login" tal:condition="not:here/portal_membership/isAnonymousUser"><a href="#" id="link-login"
tal:attributes="href string:${context_url}/logout" tal:attributes="href string:${context_url}/logout"
i18n:translate="" i18n:domain="ui">Logout</a> i18n:translate="" i18n:domain="ui">Logout</a>
......
from AccessControl import getSecurityManager from AccessControl import getSecurityManager
portal = context.getPortalObject() portal = context.getPortalObject()
username = getSecurityManager().getUser().getUserName() username = getSecurityManager().getUser().getId()
if username is not None: if username is not None:
portal.portal_sessions.manage_delObjects( portal.portal_sessions.manage_delObjects(
portal.Base_getAutoLogoutSessionKey( portal.Base_getAutoLogoutSessionKey(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment