Verified Commit 0541607d authored by Peter Stanko's avatar Peter Stanko
Browse files

Fix for the role's clients listr

parent ece50f92
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -134,9 +134,13 @@ class RoleUsersList(CustomResource):
        # authorization
        log.debug(f"[REST] Get role clients in {role.log_name} by {self.client.log_name}")
        self.permissions(course=course).require.belongs_to_role(role)

        users = [client for client in role.clients if client.type == ClientType[type.upper()]]
        return SCHEMAS.dump('users', users)
        schema_type = 'clients'
        clients = role.clients
        if type and type in ['user', 'worker']:
            schema_type = f'{type}s'
            clients = [client for client in role.clients
                       if client.type == ClientType[type.upper()]]
        return SCHEMAS.dump(schema_type, clients)

    @jwt_required
    @access_log