Permission for user that exists in specific collection

I would like to know if the current user name exists in a particular collection. If so, this user is allowed to execute the command. Something like this (pseudo-code!):

'Perform task': command can-execute: user is ( .'Team'* >'Member' ) {
   } => ...

Only a user that is Member of the Team should be able to execute this command. How to achieve this?

To check if a particular key exists in a collection, you need to do a lookup in the collection. You specify that with the containment option that a node expression supports:

can-execute: .'Team'[ user .'Name' ]