You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

24 lines
678 B

# -*- coding: utf-8 -*-
from urllib.parse import urlparse
from odoo import models
class Repository(models.Model):
_inherit = 'galicea_git.repository'
def authenticated_url(self, client):
"""
@param application galicea_openid.application"""
token = self.env['galicea_openid_connect.access_token'].sudo().retrieve_or_create(
self.env.user.id,
client.id
)
unauthenticated_url = self.url
url_parts = urlparse(unauthenticated_url)
return '{}://{}:bearer@{}{}'.format(
url_parts.scheme,
token.token,
url_parts.netloc,
url_parts.path,
)