Commit a49ffab 1 parent 3596447 commit a49ffab Copy full SHA for a49ffab
File tree 2 files changed +14
-4
lines changed
2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -149,10 +149,10 @@ def _get_permission_data(permission_obj):
149
149
"id" : instance .id ,
150
150
"name" : instance .name ,
151
151
"description" : instance .description ,
152
- "users" : [x .username for x in instance .users .all ( )],
153
- "groups" : [x .name for x in instance .groups .all ( )],
154
- "admin_users" : [x .username for x in instance .admin_users .all ( )],
155
- "admin_groups" : [x .name for x in instance .admin_groups .all ( )],
152
+ "users" : [x .username for x in instance .users .filter ( is_active = True )],
153
+ "groups" : [x .name for x in instance .groups .filter ( is_active = True )],
154
+ "admin_users" : [x .username for x in instance .admin_users .filter ( is_active = True )],
155
+ "admin_groups" : [x .name for x in instance .admin_groups .filter ( is_active = True )],
156
156
"permissions" : [_get_permission_data (x ) for x in instance .permissions .all ()],
157
157
}
158
158
Original file line number Diff line number Diff line change @@ -332,6 +332,16 @@ def test_export(self):
332
332
role = self ._create_role ("test-role" )
333
333
entity = self .create_entity (admin , "Entity" )
334
334
entity .full .roles .add (role )
335
+ user = User .objects .create (username = "test_user" )
336
+ group = Group .objects .create (name = "test_group" )
337
+
338
+ # Associate user and group with the role
339
+ role .users .set ([user .id ])
340
+ role .groups .set ([group .id ])
341
+
342
+ # Delete the user and group
343
+ user .delete ()
344
+ group .delete ()
335
345
336
346
resp = self .client .get ("/role/api/v2/export" )
337
347
data = yaml .safe_load (resp .content .decode ("utf-8" ))
You can’t perform that action at this time.
0 commit comments