Show More
@@ -39,7 +39,7 b' from rhodecode.model.forms import UserGr' | |||
|
39 | 39 | from rhodecode.model.permission import PermissionModel |
|
40 | 40 | from rhodecode.model.scm import UserGroupList |
|
41 | 41 | from rhodecode.model.db import ( |
|
42 | or_, count, User, UserGroup, UserGroupMember) | |
|
42 | or_, count, User, UserGroup, UserGroupMember, in_filter_generator) | |
|
43 | 43 | from rhodecode.model.meta import Session |
|
44 | 44 | from rhodecode.model.user_group import UserGroupModel |
|
45 | 45 | from rhodecode.model.db import true |
@@ -107,11 +107,17 b' class AdminUserGroupsView(BaseAppView, D' | |||
|
107 | 107 | allowed_ids.append(user_group.users_group_id) |
|
108 | 108 | |
|
109 | 109 | user_groups_data_total_count = UserGroup.query()\ |
|
110 | .filter(UserGroup.users_group_id.in_(allowed_ids))\ | |
|
110 | .filter(or_( | |
|
111 | # generate multiple IN to fix limitation problems | |
|
112 | *in_filter_generator(UserGroup.users_group_id, allowed_ids) | |
|
113 | ))\ | |
|
111 | 114 | .count() |
|
112 | 115 | |
|
113 | 116 | user_groups_data_total_inactive_count = UserGroup.query()\ |
|
114 | .filter(UserGroup.users_group_id.in_(allowed_ids))\ | |
|
117 | .filter(or_( | |
|
118 | # generate multiple IN to fix limitation problems | |
|
119 | *in_filter_generator(UserGroup.users_group_id, allowed_ids) | |
|
120 | ))\ | |
|
115 | 121 | .filter(UserGroup.users_group_active != true()).count() |
|
116 | 122 | |
|
117 | 123 | member_count = count(UserGroupMember.user_id) |
@@ -124,7 +130,10 b' class AdminUserGroupsView(BaseAppView, D' | |||
|
124 | 130 | User, |
|
125 | 131 | member_count.label('member_count') |
|
126 | 132 | ) \ |
|
127 | .filter(UserGroup.users_group_id.in_(allowed_ids)) \ | |
|
133 | .filter(or_( | |
|
134 | # generate multiple IN to fix limitation problems | |
|
135 | *in_filter_generator(UserGroup.users_group_id, allowed_ids) | |
|
136 | )) \ | |
|
128 | 137 | .outerjoin(UserGroupMember) \ |
|
129 | 138 | .join(User, User.user_id == UserGroup.user_id) \ |
|
130 | 139 | .group_by(UserGroup, User) |
@@ -141,14 +150,16 b' class AdminUserGroupsView(BaseAppView, D' | |||
|
141 | 150 | user_groups_data_total_filtered_count = base_q.count() |
|
142 | 151 | user_groups_data_total_filtered_inactive_count = base_q_inactive.count() |
|
143 | 152 | |
|
153 | sort_defined = False | |
|
144 | 154 | if order_by == 'members_total': |
|
145 | 155 | sort_col = member_count |
|
156 | sort_defined = True | |
|
146 | 157 | elif order_by == 'user_username': |
|
147 | 158 | sort_col = User.username |
|
148 | 159 | else: |
|
149 | 160 | sort_col = getattr(UserGroup, order_by, None) |
|
150 | 161 | |
|
151 |
if |
|
|
162 | if sort_defined or sort_col: | |
|
152 | 163 | if order_dir == 'asc': |
|
153 | 164 | sort_col = sort_col.asc() |
|
154 | 165 | else: |
@@ -162,7 +173,7 b' class AdminUserGroupsView(BaseAppView, D' | |||
|
162 | 173 | |
|
163 | 174 | user_groups_data = [] |
|
164 | 175 | for user_gr in auth_user_group_list: |
|
165 | user_groups_data.append({ | |
|
176 | row = { | |
|
166 | 177 | "users_group_name": user_group_name(user_gr.users_group_name), |
|
167 | 178 | "name_raw": h.escape(user_gr.users_group_name), |
|
168 | 179 | "description": h.escape(user_gr.user_group_description), |
@@ -175,7 +186,8 b' class AdminUserGroupsView(BaseAppView, D' | |||
|
175 | 186 | "owner": user_profile(user_gr.User.username), |
|
176 | 187 | "action": user_group_actions( |
|
177 | 188 | user_gr.users_group_id, user_gr.users_group_name) |
|
178 |
} |
|
|
189 | } | |
|
190 | user_groups_data.append(row) | |
|
179 | 191 | |
|
180 | 192 | data = ({ |
|
181 | 193 | 'draw': draw, |
General Comments 0
You need to be logged in to leave comments.
Login now