code: def getContactUIDForUser(self):
          
          membership_tool = api.get_tool("portal_membership")
          member = membership_tool.getAuthenticatedMember()
          username = member.getUserName()
          r = self.portal_catalog(
              portal_type="Contact",
              getUsername=username
          )
          if len(r) == 1:
              return r[0].UID
docs: Get the UID of the user associated with the authenticated user