From 5e13da62a48a3e391bf10d0c73233aaf782748b9 Mon Sep 17 00:00:00 2001 From: Jeff Bradberry Date: Wed, 6 Feb 2019 10:14:46 -0500 Subject: [PATCH] Added a max_hosts field to Organization in order to optionally set a limit to the number of hosts an organization that is sharing a license is allowed to manage. related #1542 --- awx/main/models/organization.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/awx/main/models/organization.py b/awx/main/models/organization.py index 8379cfa0cd..ac7b41bda9 100644 --- a/awx/main/models/organization.py +++ b/awx/main/models/organization.py @@ -10,6 +10,7 @@ from django.db.models import Q from django.contrib.auth.models import User from django.contrib.sessions.models import Session from django.utils.timezone import now as tz_now +from django.utils.translation import ugettext_lazy as _ # AWX @@ -42,6 +43,12 @@ class Organization(CommonModel, NotificationFieldsModel, ResourceMixin, CustomVi 'InstanceGroup', blank=True, ) + max_hosts = models.PositiveIntegerField( + blank=True, + default=0, + help_text=_('Maximum number of hosts allowed to be managed by this organization.'), + ) + admin_role = ImplicitRoleField( parent_role='singleton:' + ROLE_SINGLETON_SYSTEM_ADMINISTRATOR, )