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.2 KiB

  1. # -*- coding: utf-8 -*-
  2. # © 2012-2018 Therp BV <https://therp.nl>
  3. # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
  4. from odoo import fields, models
  5. class ResCompanyLdapGroupMapping(models.Model):
  6. _name = 'res.company.ldap.group_mapping'
  7. _rec_name = 'ldap_attribute'
  8. _order = 'ldap_attribute'
  9. ldap_id = fields.Many2one(
  10. 'res.company.ldap', 'LDAP server', required=True, ondelete='cascade',
  11. )
  12. ldap_attribute = fields.Char(
  13. 'LDAP attribute',
  14. help='The LDAP attribute to check.\n'
  15. 'For active directory, use memberOf.')
  16. operator = fields.Selection(
  17. lambda self: [
  18. (o, o) for o in self.env['res.company.ldap.operator'].operators()
  19. ],
  20. 'Operator',
  21. help='The operator to check the attribute against the value\n'
  22. 'For active directory, use \'contains\'', required=True)
  23. value = fields.Char(
  24. 'Value',
  25. help='The value to check the attribute against.\n'
  26. 'For active directory, use the dn of the desired group',
  27. required=True)
  28. group_id = fields.Many2one(
  29. 'res.groups', 'Odoo group', oldname='group',
  30. help='The Odoo group to assign', required=True)