def get_user_unique_id_and_display_name(request, mapped_properties):
 user = mapped_properties['user']
 user_id = user.get('id')
 user_name = (user.get('name') or request.remote_user)
 if (not any([user_id, user_name])):
  msg = _('Could not map user while setting ephemeral user identity. Either mapping rules must specify user id/name or REMOTE_USER environment variable must be set.')
  raise exception.Unauthorized(msg)
 elif (not user_name):
  user['name'] = user_id
 elif (not user_id):
  user_id = user_name
 user['id'] = parse.quote(user_id)
 return (user['id'], user['name'])

def get_user_unique_id_and_display_name ( request , mapped_properties ) : user = mapped_properties [ 'user' ] user_id = user . get ( 'id' ) user_name = ( user . get ( 'name' ) or request . remote_user ) if ( not any ( [ user_id , user_name ] ) ) : msg = _ ( 'Could not map user while setting ephemeral user identity. Either mapping rules must specify user id/name or REMOTE_USER environment variable must be set.' ) raise exception . Unauthorized ( msg ) elif ( not user_name ) : user [ 'name' ] = user_id elif ( not user_id ) : user_id = user_name user [ 'id' ] = parse . quote ( user_id ) return ( user [ 'id' ] , user [ 'name' ] )
setup federated username .