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.

33 lines
1.3 KiB

  1. # -*- coding: utf-8 -*-
  2. # Copyright 2016 SYLEAM
  3. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
  4. from openerp import models, fields
  5. class OAuthProviderAuthorizationCode(models.Model):
  6. _name = 'oauth.provider.authorization.code'
  7. _description = 'OAuth Provider Authorization Code'
  8. _rec_name = 'code'
  9. code = fields.Char(required=True, help='Name of the authorization code.')
  10. client_id = fields.Many2one(
  11. comodel_name='oauth.provider.client', string='Client', required=True,
  12. help='Client associated to this authorization code.')
  13. user_id = fields.Many2one(
  14. comodel_name='res.users', string='User', required=True,
  15. help='User associated to this authorization code.')
  16. redirect_uri_id = fields.Many2one(
  17. comodel_name='oauth.provider.redirect.uri', string='Redirect URI',
  18. required=True,
  19. help='Redirect URI associated to this authorization code.')
  20. scope_ids = fields.Many2many(
  21. comodel_name='oauth.provider.scope', string='Scopes',
  22. help='Scopes allowed by this authorization code.')
  23. active = fields.Boolean(
  24. default=True, help='When unchecked, the code is invalidated.')
  25. _sql_constraints = [
  26. ('code_client_id_unique', 'UNIQUE (code, client_id)',
  27. 'The authorization code must be unique per client !'),
  28. ]