diff --git a/rhodecode/apps/admin/views/user_groups.py b/rhodecode/apps/admin/views/user_groups.py
--- a/rhodecode/apps/admin/views/user_groups.py
+++ b/rhodecode/apps/admin/views/user_groups.py
@@ -41,6 +41,7 @@ from rhodecode.model.db import (
or_, count, User, UserGroup, UserGroupMember)
from rhodecode.model.meta import Session
from rhodecode.model.user_group import UserGroupModel
+from rhodecode.model.db import true
log = logging.getLogger(__name__)
@@ -108,6 +109,10 @@ class AdminUserGroupsView(BaseAppView, D
.filter(UserGroup.users_group_id.in_(allowed_ids))\
.count()
+ user_groups_data_total_inactive_count = UserGroup.query()\
+ .filter(UserGroup.users_group_id.in_(allowed_ids))\
+ .filter(UserGroup.users_group_active != true()).count()
+
member_count = count(UserGroupMember.user_id)
base_q = Session.query(
UserGroup.users_group_name,
@@ -123,13 +128,17 @@ class AdminUserGroupsView(BaseAppView, D
.join(User, User.user_id == UserGroup.user_id) \
.group_by(UserGroup, User)
+ base_q_inactive = base_q.filter(UserGroup.users_group_active != true())
+
if search_q:
like_expression = u'%{}%'.format(safe_unicode(search_q))
base_q = base_q.filter(or_(
UserGroup.users_group_name.ilike(like_expression),
))
+ base_q_inactive = base_q.filter(UserGroup.users_group_active != true())
user_groups_data_total_filtered_count = base_q.count()
+ user_groups_data_total_filtered_inactive_count = base_q_inactive.count()
if order_by == 'members_total':
sort_col = member_count
@@ -171,7 +180,9 @@ class AdminUserGroupsView(BaseAppView, D
'draw': draw,
'data': user_groups_data,
'recordsTotal': user_groups_data_total_count,
+ 'recordsTotalInactive': user_groups_data_total_inactive_count,
'recordsFiltered': user_groups_data_total_filtered_count,
+ 'recordsFilteredInactive': user_groups_data_total_filtered_inactive_count,
})
return data
diff --git a/rhodecode/apps/admin/views/users.py b/rhodecode/apps/admin/views/users.py
--- a/rhodecode/apps/admin/views/users.py
+++ b/rhodecode/apps/admin/views/users.py
@@ -32,6 +32,7 @@ from rhodecode.apps._base import BaseApp
from rhodecode.apps.ssh_support import SshKeyFileChangeEvent
from rhodecode.authentication.plugins import auth_rhodecode
from rhodecode.events import trigger
+from rhodecode.model.db import true
from rhodecode.lib import audit_logger
from rhodecode.lib.exceptions import (
@@ -89,7 +90,6 @@ class AdminUsersView(BaseAppView, DataGr
draw, start, limit = self._extract_chunk(self.request)
search_q, order_by, order_dir = self._extract_ordering(
self.request, column_map=column_map)
-
_render = self.request.get_partial_renderer(
'rhodecode:templates/data_table/_dt_elements.mako')
@@ -100,8 +100,14 @@ class AdminUsersView(BaseAppView, DataGr
.filter(User.username != User.DEFAULT_USER) \
.count()
+ users_data_total_inactive_count = User.query()\
+ .filter(User.username != User.DEFAULT_USER) \
+ .filter(User.active != true())\
+ .count()
+
# json generate
base_q = User.query().filter(User.username != User.DEFAULT_USER)
+ base_inactive_q = base_q.filter(User.active != true())
if search_q:
like_expression = u'%{}%'.format(safe_unicode(search_q))
@@ -111,8 +117,10 @@ class AdminUsersView(BaseAppView, DataGr
User.name.ilike(like_expression),
User.lastname.ilike(like_expression),
))
+ base_inactive_q = base_q.filter(User.active != true())
users_data_total_filtered_count = base_q.count()
+ users_data_total_filtered_inactive_count = base_inactive_q.count()
sort_col = getattr(User, order_by, None)
if sort_col:
@@ -148,12 +156,13 @@ class AdminUsersView(BaseAppView, DataGr
"extern_name": user.extern_name,
"action": user_actions(user.user_id, user.username),
})
-
data = ({
'draw': draw,
'data': users_data,
'recordsTotal': users_data_total_count,
'recordsFiltered': users_data_total_filtered_count,
+ 'recordsTotalInactive': users_data_total_inactive_count,
+ 'recordsFilteredInactive': users_data_total_filtered_inactive_count
})
return data
diff --git a/rhodecode/templates/admin/user_groups/user_groups.mako b/rhodecode/templates/admin/user_groups/user_groups.mako
--- a/rhodecode/templates/admin/user_groups/user_groups.mako
+++ b/rhodecode/templates/admin/user_groups/user_groups.mako
@@ -10,7 +10,7 @@
<%def name="breadcrumbs_links()">
- ${h.link_to(_('Admin'),h.route_path('admin_home'))} » 0 ${_('user groups')}
+ ${h.link_to(_('Admin'),h.route_path('admin_home'))} » 0
%def>
<%def name="menu_bar_nav()">
@@ -38,21 +38,33 @@