[FIX] google_drive: anyone with the link can now write

We used to give write access to the email address of the current user, but if the email is not a google account, there is no way for the current user to write on the data (except if the current email address is also the email which has done the oauth activation in the settings).

bzr revid: dle@openerp.com-20140115093528-ir39ppqrinjqyeta
This commit is contained in:
Denis Ledoux 2014-01-15 10:35:28 +01:00
parent ede8d04028
commit 1cfd7ec102
1 changed files with 2 additions and 2 deletions

View File

@ -120,7 +120,7 @@ class config(osv.Model):
res['url'] = content['alternateLink']
key = self._get_key_from_url(res['url'])
request_url = "https://www.googleapis.com/drive/v2/files/%s/permissions?emailMessage=This+is+a+drive+file+created+by+OpenERP&sendNotificationEmails=false&access_token=%s" % (key, access_token)
data = {'role': 'reader', 'type': 'anyone', 'value': '', 'withLink': True}
data = {'role': 'writer', 'type': 'anyone', 'value': '', 'withLink': True}
try:
req = urllib2.Request(request_url, json.dumps(data), headers)
urllib2.urlopen(req)
@ -133,7 +133,7 @@ class config(osv.Model):
req = urllib2.Request(request_url, json.dumps(data), headers)
urllib2.urlopen(req)
except urllib2.HTTPError:
raise self.pool.get('res.config.settings').get_config_warning(cr, _("The permission 'writer' for your email '%s' has not been written on the document. Is this email a valid Google Account ?" % user.email), context=context)
pass
return res
def get_google_drive_config(self, cr, uid, res_model, res_id, context=None):