Commit 64e73707 authored by Fabien Morin's avatar Fabien Morin

remove the field "authentication required", now authentication is always require

d


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@15621 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 0a6d8604
......@@ -140,10 +140,13 @@ class VCardConduit(ERP5Conduit, SyncCode):
"""
vcard_dict = self.vcard2Dict(vcard)
gid_from_vcard = []
if vcard_dict.has_key('first_name'):
gid_from_vcard.append(vcard_dict['first_name'])
gid_from_vcard.append(' ')
if vcard_dict.has_key('last_name'):
gid_from_vcard.append(vcard_dict['last_name'])
gid_from_vcard = ''.join(gid_from_vcard)
LOG('gid_from_vcard', 0, gid_from_vcard)
return gid_from_vcard
def changePropertyEncoding(self, property_parameters_list,
......
......@@ -144,7 +144,7 @@ class Publication(Subscription):
# Constructor
def __init__(self, id, title, publication_url, destination_path,
source_uri, query, xml_mapping, conduit, gpg_key, id_generator,
gid_generator, media_type, auth_required, authentication_format,
gid_generator, media_type, authentication_format,
authentication_type, activity_enabled, synchronize_with_erp5_sites,
sync_content_type):
"""
......@@ -165,7 +165,6 @@ class Publication(Subscription):
self.setConduit(conduit)
Folder.__init__(self, id)
self.title = title
self.auth_required = auth_required
self.authentication_format = authentication_format
self.authentication_type = authentication_type
self.setSyncContentType(sync_content_type)
......@@ -190,18 +189,6 @@ class Publication(Subscription):
"""
self.publication_url = publication_url
def isAuthenticationRequired(self):
"""
return False if authentication not required, True else
"""
return getattr(self, 'auth_required', False)
def setAuthentication(self, auth):
"""
set the value of the authentication requirement
"""
self.auth_required = auth
def getAuthenticationFormat(self):
"""
return the format of authentication
......
......@@ -110,10 +110,8 @@ class PublicationSynchronization(XMLSyncUtils):
xml(' <SyncBody>\n')
if publication.isAuthenticationRequired():
#at the begining, the code is initialised at UNAUTHORIZED
auth_code=self.UNAUTHORIZED
LOG('PubSyncInit', INFO, 'authentication required')
if not cred:
auth_code=self.AUTH_REQUIRED
LOG("PubSyncInit there's no credential !!!", INFO,'')
......@@ -173,16 +171,6 @@ class PublicationSynchronization(XMLSyncUtils):
subscription=subscriber).values()
xml(xml_status)
elif alert is not None: #if no identification is required :
# syncml header
xml_status, cmd_id = self.SyncMLStatus(xml_client, self.AUTH_ACCEPTED,
cmd_id, next_anchor, subscription=subscriber).values()
xml(xml_status)
# alert message
xml(self.SyncMLAlert(cmd_id, sync_type, subscriber.getTargetURI(),
subscriber.getSourceURI(), subscriber.getLastAnchor(), next_anchor))
cmd_id += 1
# We have to set every object as NOT_SYNCHRONIZED
subscriber.startSynchronization()
else:
......@@ -253,7 +241,6 @@ class PublicationSynchronization(XMLSyncUtils):
#we log the user authenticated to do the synchronization with him
if self.checkMap(xml_client) :
self.setRidWithMap(xml_client, subscriber)
if publication.isAuthenticationRequired():
if subscriber.isAuthenticated():
uf = self.getPortalObject().acl_users
user = uf.getUserById(subscriber.getUser()).__of__(uf)
......
......@@ -999,12 +999,6 @@ class Subscription(Folder, SyncCode):
"""
self.password = new_password
def setAuthentication(self, auth):
"""
set the value of the authentication requirement
"""
self.auth_required = auth
def getAuthenticationFormat(self):
"""
return the format of authentication
......
......@@ -179,7 +179,7 @@ class SynchronizationTool( SubscriptionSynchronization,
destination_path, source_uri, query, xml_mapping,
conduit, gpg_key,
synchronization_id_generator=None, gid_generator=None,
media_type=None, auth_required=0, authentication_format='',
media_type=None, authentication_format='',
authentication_type='', RESPONSE=None, activity_enabled = False,
sync_content_type='application/vnd.syncml+xml',
synchronize_with_erp5_sites=True):
......@@ -194,7 +194,7 @@ class SynchronizationTool( SubscriptionSynchronization,
pub = Publication(new_id, title, publication_url,
destination_path, source_uri, query, xml_mapping,
conduit, gpg_key, synchronization_id_generator,
gid_generator, media_type, auth_required,
gid_generator, media_type,
authentication_format, authentication_type,
activity_enabled, synchronize_with_erp5_sites,
sync_content_type)
......@@ -243,7 +243,7 @@ class SynchronizationTool( SubscriptionSynchronization,
def manage_editPublication(self, title, publication_url,
destination_path, source_uri, query, xml_mapping,
conduit, gpg_key, synchronization_id_generator,
gid_generator, media_type=None, auth_required=0,
gid_generator, media_type=None,
authentication_format='', authentication_type='',
RESPONSE=None, activity_enabled=False,
sync_content_type='application/vnd.syncml+xml',
......@@ -264,7 +264,6 @@ class SynchronizationTool( SubscriptionSynchronization,
pub.setSynchronizationIdGenerator(synchronization_id_generator)
pub.setGidGenerator(gid_generator)
pub.setMediaType(media_type)
pub.setAuthentication(auth_required)
pub.setAuthenticationFormat(authentication_format)
pub.setAuthenticationType(authentication_type)
pub.setSyncContentType(sync_content_type)
......
......@@ -100,7 +100,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
find a gid from any object</br>
<b>Media Type :</b> the type of media exchanged between publication
and subscription.</br>
<b>Authentication Required :</b> ask authentication to the clients</br>
<b>Authentication Format :</b>the format used to encode the
login and password</br>
<b>Autentication Type :</b> the type of the authentication</br>
......
......@@ -178,16 +178,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
<input type="text" name="media_type" value="<dtml-var getMediaType>" size="40" />
</td>
</tr>
<tr>
<td align="left" valign="top">
<div class="form-label">
Authentication Required
</label></div>
</td>
<td align="left" valign="top">
<input type="checkbox" name="auth_required" value="1" <dtml-if expr="isAuthenticationRequired()">CHECKED</dtml-if>>
</td>
</tr>
<tr>
<td align="left" valign="top">
<div class="form-label">
......
......@@ -173,17 +173,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
<input type="text" name="media_type" size="40" />
</td>
</tr>
<tr>
<td align="left" valign="top">
<div class="form-label">
Authentication Required
</label></div>
</td>
<td align="left" valign="top">
<input type="checkbox" name="auth_required" value="1">
</td>
</tr>
<tr>
<tr>
<td align="left" valign="top">
<div class="form-label">
......
......@@ -85,7 +85,7 @@ class TestERP5SyncMLMixin:
nb_subscription = 2
nb_publication = 1
nb_synchronization = 3
nb_message_first_synchronization = 6
nb_message_first_synchronization = 8
subscription_url1 = 'file://tmp/sync_client1'
subscription_url2 = 'file://tmp/sync_client2'
publication_url = 'file://tmp/sync_server'
......@@ -347,7 +347,9 @@ class TestERP5SyncML(TestERP5SyncMLMixin, ERP5TypeTestCase):
conduit='ERP5Conduit',
gpg_key='',
gid_generator='getId',
activity_enabled=False)
activity_enabled=False,
authentication_format='b64',
authentication_type='syncml:auth-basic')
pub = portal_sync.getPublication(self.pub_id)
self.failUnless(pub is not None)
......@@ -369,7 +371,9 @@ class TestERP5SyncML(TestERP5SyncMLMixin, ERP5TypeTestCase):
conduit='ERP5Conduit',
gpg_key='',
gid_generator='getId',
activity_enabled=False)
activity_enabled=False,
login='fab',
password='myPassword')
sub = portal_sync.getSubscription(self.sub_id1)
self.failUnless(sub is not None)
......@@ -391,7 +395,9 @@ class TestERP5SyncML(TestERP5SyncMLMixin, ERP5TypeTestCase):
conduit='ERP5Conduit',
gpg_key='',
gid_generator='getId',
activity_enabled=False)
activity_enabled=False,
login='fab',
password='myPassword')
sub = portal_sync.getSubscription(self.sub_id2)
self.failUnless(sub is not None)
......@@ -1338,7 +1344,9 @@ class TestERP5SyncML(TestERP5SyncMLMixin, ERP5TypeTestCase):
gpg_key='',
gid_generator='getId',
activity_enabled=False,
alert_code = SyncCode.ONE_WAY_FROM_SERVER)
alert_code = SyncCode.ONE_WAY_FROM_SERVER,
login = 'fab',
password = 'myPassword')
sub = portal_sync.getSubscription(self.sub_id1)
self.assertTrue(sub.isOneWayFromServer())
self.failUnless(sub is not None)
......@@ -1458,7 +1466,6 @@ wuIFtde33Dp3NkZl9fc2Rmw6fDp8OnX2RmX19fJibDqV1dXcKwwrDCsMKwwrDCsA=='
"""
portal_sync = self.getSynchronizationTool()
pub = portal_sync.getPublication(publication_id)
pub.setAuthentication(True)
pub.setLogin(login)
pub.setPassword(password)
pub.setAuthenticationFormat(auth_format)
......@@ -1472,7 +1479,6 @@ wuIFtde33Dp3NkZl9fc2Rmw6fDp8OnX2RmX19fJibDqV1dXcKwwrDCsMKwwrDCsA=='
"""
portal_sync = self.getSynchronizationTool()
sub = portal_sync.getSubscription(subscription_id)
sub.setAuthentication(True)
sub.setAuthenticated(False)
sub.setLogin(login)
sub.setPassword(password)
......@@ -1517,7 +1523,9 @@ wuIFtde33Dp3NkZl9fc2Rmw6fDp8OnX2RmX19fJibDqV1dXcKwwrDCsMKwwrDCsA=='
#adding authentication :
self.addAuthenticationToPublication(self.pub_id, 'fab', 'myPassword', 'b64',
'syncml:auth-basic')
# try to synchronize without authentication on the subscription, it
self.addAuthenticationToSubscription(self.sub_id1, 'pouet', 'pouet',
'b64', 'syncml:auth-basic')
# try to synchronize with a wrong authentication on the subscription, it
# should failed
kw = {'first_name':self.first_name2,'last_name':self.last_name2}
person1_c.edit(**kw)
......
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