-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_mapping.php
More file actions
26 lines (23 loc) · 1.13 KB
/
test_mapping.php
File metadata and controls
26 lines (23 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php
$path = 'mappingfile-prod.json';
$jsonString = file_get_contents($path);
$jsonData = json_decode($jsonString, true);
$users = ['name@sunet.se','first.last@sunet.se', 'first.last@hh.se', 'first.last@shh.se',
'name@sub.sunet.se','first.last@sub.sunet.se', 'first.last@sub.hh.se', 'first.last@sub.shh.se',
'name@sub.inst.sunet.se','first.last@sub.inst.sunet.se', 'first.last@sub.inst.hh.se', 'first.last@sub.inst.shh.se',
'sunet.se@sub.inst.sunet.se','ki.se@sub.inst.sunet.se', 'sub.inst.shh.se@sub.inst.hh.se', 'sub.inst.hh.se@sub.inst.shh.se',
'@.shh.se', 'some@.hh.se', '@...se', '@...shh.se', '@...sunet.se.', '@...sunet.se...', 'some@inst.shhs', 'sunet.se', '.sunet.se', '.sunet.se.',
'some-user@eduid.se','ki.se@somedomain.edu','ki.se@ki.se.somedomain.edu',
'someone@antagning.se', 'generic9987@su.se'];
foreach ($users as &$user)
{
foreach ($jsonData as $regex => $node) {
// printf("Testing regex: %s\n", $regex);
if (preg_match($regex, $user, $matches) === 1)
{
printf("%35s: %s\n", $user, $node );
break;
}
}
}
?>