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

  1. # -*- coding: utf-8 -*-
  2. from urllib.parse import urlparse
  3. from odoo import models
  4. class Repository(models.Model):
  5. _inherit = 'galicea_git.repository'
  6. def authenticated_url(self, client):
  7. """
  8. @param application galicea_openid.application"""
  9. token = self.env['galicea_openid_connect.access_token'].sudo().retrieve_or_create(
  10. self.env.user.id,
  11. client.id
  12. )
  13. unauthenticated_url = self.url
  14. url_parts = urlparse(unauthenticated_url)
  15. return '{}://{}:bearer@{}{}'.format(
  16. url_parts.scheme,
  17. token.token,
  18. url_parts.netloc,
  19. url_parts.path,
  20. )