add TenantRoot admins
diff --git a/xos/cord/admin.py b/xos/cord/admin.py
index a21a58b..5b02760 100644
--- a/xos/cord/admin.py
+++ b/xos/cord/admin.py
@@ -114,9 +114,9 @@
model = VCPETenant
class VCPETenantAdmin(ReadOnlyAwareAdmin):
- list_display = ('backend_status_icon', 'id' )
+ list_display = ('backend_status_icon', 'id', 'subscriber_tenant' )
list_display_links = ('backend_status_icon', 'id')
- fieldsets = [ (None, {'fields': ['backend_status_text', 'kind', 'provider_service', 'service_specific_id', 'service_specific_attribute',], 'classes':['suit-tab suit-tab-general']})]
+ fieldsets = [ (None, {'fields': ['backend_status_text', 'kind', 'provider_service', 'subscriber_tenant', 'service_specific_id', 'service_specific_attribute',], 'classes':['suit-tab suit-tab-general']})]
readonly_fields = ('backend_status_text', )
form = VCPETenantForm
@@ -168,9 +168,9 @@
model = VBNGTenant
class VBNGTenantAdmin(ReadOnlyAwareAdmin):
- list_display = ('backend_status_icon', 'id' )
+ list_display = ('backend_status_icon', 'id', 'subscriber_tenant' )
list_display_links = ('backend_status_icon', 'id')
- fieldsets = [ (None, {'fields': ['backend_status_text', 'kind', 'provider_service', 'service_specific_id', 'service_specific_attribute',], 'classes':['suit-tab suit-tab-general']})]
+ fieldsets = [ (None, {'fields': ['backend_status_text', 'kind', 'provider_service', 'subscriber_tenant', 'service_specific_id', 'service_specific_attribute',], 'classes':['suit-tab suit-tab-general']})]
readonly_fields = ('backend_status_text', )
form = VBNGTenantForm
diff --git a/xos/core/admin.py b/xos/core/admin.py
index c2de0f7..5531df4 100644
--- a/xos/core/admin.py
+++ b/xos/core/admin.py
@@ -786,6 +786,47 @@
return tabs
+class TenantRootRoleAdmin(XOSBaseAdmin):
+ model = TenantRootRole
+ fields = ('role',)
+
+class TenantRootTenantInline(XOSTabularInline):
+ model = Tenant
+ fields = ['provider_service', 'subscriber_root']
+ extra = 0
+ suit_classes = 'suit-tab suit-tab-tenantroots'
+ fk_name = 'subscriber_root'
+ verbose_name = 'subscribed tenant'
+ verbose_name_plural = 'subscribed tenants'
+
+ #def queryset(self, request):
+ # qs = super(TenantRootTenantInline, self).queryset(request)
+ # return qs.filter(kind="coarse")
+
+class TenantRootPrivilegeInline(XOSTabularInline):
+ model = TenantRootPrivilege
+ extra = 0
+ suit_classes = 'suit-tab suit-tab-tenantrootprivileges'
+ fields = ['backend_status_icon', 'user', 'role', 'tenant_root']
+ readonly_fields = ('backend_status_icon', )
+
+ def queryset(self, request):
+ return TenantRootPrivilege.select_by_user(request.user)
+
+class TenantRootAdmin(XOSBaseAdmin):
+ model = TenantRoot
+ list_display = ('backend_status_icon', 'name', 'kind')
+ list_display_links = ('backend_status_icon', 'name')
+ fieldList = ('backend_status_text', 'name', 'kind', )
+ fieldsets = [(None, {'fields': fieldList, 'classes':['suit-tab suit-tab-general']})]
+ inlines = (TenantRootTenantInline, TenantRootPrivilegeInline)
+ readonly_fields = ('backend_status_text', )
+
+ suit_form_tabs =(('general', 'Tenant Root Details'),
+ ('tenantroots','Tenancy'),
+ ('tenantrootprivileges','Privileges')
+ )
+
class ProviderTenantInline(XOSTabularInline):
model = CoarseTenant
fields = ['provider_service', 'subscriber_service', 'connect_method']
@@ -832,7 +873,7 @@
('slices','Slices'),
('serviceattrs','Additional Attributes'),
('servicetenants','Tenancy'),
- ('serviceprivileges','Privileges')
+ ('serviceprivileges','Privileges')
)
class SiteNodeInline(XOSTabularInline):
@@ -1870,4 +1911,6 @@
admin.site.register(Image, ImageAdmin)
admin.site.register(DashboardView, DashboardViewAdmin)
admin.site.register(Flavor, FlavorAdmin)
+ admin.site.register(TenantRoot, TenantRootAdmin)
+ admin.site.register(TenantRootRole, TenantRootRoleAdmin)