This is just a first evaluation to understand if Diffusion public identities can be used to expand Calendar invitees, so to have less "Private User".
Data protection considerations: who import the calendar ICS data already knows the emails in the file. Who import should just do not know verified emails in general. Diffusion identities - instead - are already a public information.
Specifications to respect the above considerations:
- for imported events, NEVER create any new Identity
- for imported events, just try to match an identity
- if the Diffusion application is disabled, do not try to perform any lookup there
Current structure of the Diffusion identity entity:
CREATE TABLE `repository_identity` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `phid` varbinary(64) NOT NULL, `dateCreated` int(10) unsigned NOT NULL, `dateModified` int(10) unsigned NOT NULL, `automaticGuessedUserPHID` varbinary(64) DEFAULT NULL, `manuallySetUserPHID` varbinary(64) DEFAULT NULL, `currentEffectiveUserPHID` varbinary(64) DEFAULT NULL, `identityNameHash` binary(12) NOT NULL, `identityNameRaw` longblob NOT NULL, `identityNameEncoding` varchar(16) DEFAULT NULL, `authorPHID` varbinary(64) NOT NULL, `emailAddress` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `key_phid` (`phid`), UNIQUE KEY `key_identity` (`identityNameHash`), KEY `key_email` (`emailAddress`(64)) ) ENGINE=InnoDB AUTO_INCREMENT=3617 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin
Way to look for identities (untested - incomplete):
$email = $email_found_from_imported_ics_file; $identity = id(new PhabricatorRepositoryIdentityQuery) ->withEmailAddresses(array($email)) ->setLimit(1) ->executeOne(); // order by manuallySetUserPHID NOT NULL, automaticGuessedUserPHID NOT NULL