##// END OF EJS Templates
user-group-admin: use a proper auth filter....
marcink -
r1986:64b52a82 default
parent child Browse files
Show More
@@ -89,7 +89,16 b' class AdminUserGroupsView(BaseAppView, D'
89 def user_profile(username):
89 def user_profile(username):
90 return _render('user_profile', username)
90 return _render('user_profile', username)
91
91
92 user_groups_data_total_count = UserGroup.query().count()
92 auth_user_group_list = UserGroupList(
93 UserGroup.query().all(), perm_set=['usergroup.admin'])
94
95 allowed_ids = []
96 for user_group in auth_user_group_list:
97 allowed_ids.append(user_group.users_group_id)
98
99 user_groups_data_total_count = UserGroup.query()\
100 .filter(UserGroup.users_group_id.in_(allowed_ids))\
101 .count()
93
102
94 member_count = count(UserGroupMember.user_id)
103 member_count = count(UserGroupMember.user_id)
95 base_q = Session.query(
104 base_q = Session.query(
@@ -101,6 +110,7 b' class AdminUserGroupsView(BaseAppView, D'
101 User,
110 User,
102 member_count.label('member_count')
111 member_count.label('member_count')
103 ) \
112 ) \
113 .filter(UserGroup.users_group_id.in_(allowed_ids)) \
104 .outerjoin(UserGroupMember) \
114 .outerjoin(UserGroupMember) \
105 .join(User, User.user_id == UserGroup.user_id) \
115 .join(User, User.user_id == UserGroup.user_id) \
106 .group_by(UserGroup, User)
116 .group_by(UserGroup, User)
@@ -130,9 +140,7 b' class AdminUserGroupsView(BaseAppView, D'
130 base_q = base_q.offset(start).limit(limit)
140 base_q = base_q.offset(start).limit(limit)
131
141
132 # authenticated access to user groups
142 # authenticated access to user groups
133 user_group_list = base_q.all()
143 auth_user_group_list = base_q.all()
134 auth_user_group_list = UserGroupList(
135 user_group_list, perm_set=['usergroup.admin'])
136
144
137 user_groups_data = []
145 user_groups_data = []
138 for user_gr in auth_user_group_list:
146 for user_gr in auth_user_group_list:
General Comments 0
You need to be logged in to leave comments. Login now