Getting the current user in the views

Is there a way of getting the current logged-in user inside a view, so that I can perform queries based on the username or other defined properties?

Good question, I’m not sure this is possible at the moment. What exactly is your use-case? Then I can see if there is a way to achieve that.

I found this way of getting the current user inside a widget:
current user.alan

static {
}
control 'text' {
	'text' = switch engine 'engine state'.'status' (
		|'authenticated' as $ => switch $ .'anonymous session' (
			|'yes' => "anonymous user"
			|'no' as $ => $ .'username'
		)
		|'not authenticated' => "Not logged in"
	)
}

But I cannot find a way of getting more properties (such as first name, last name etc.)

'Users': collection ['Username'] {
	'Username': text
	'Type': stategroup (
		'Admin' { }
		'Unknown' { }
	)
	'Public data': group {
		can-read: user
		can-update: ^ is ( user )
		'First name': text
		'Last name': text
	}

	'Private data': group {
		can-read: ^ is ( user )
		can-update: ^ is ( user )
		'Email': text
		'Date of birth': number 'date'
		// ... more account information
	}
}

This is the first problem. And the second one is that there is a collection called Questions:

'Questions': collection ['Question id'] {
	'Question id': text @default: auto-increment
	'User asked': text -> ^ . 'Users'[] @default: user .'Username'
	// ...
}

As you can see it has a reference to the user which created that question. In the views I want to create a query for all the questions and filter them based on the user/users who asked those questions.