"Provide a possibility to regularly review the permissions in the system"
This commit is contained in:
Wytze van der Raay 2013-10-22 08:41:48 +00:00
parent fc979343e1
commit 8c125fd8c7

View file

@ -27,7 +27,7 @@ $ORGANISATION_ASSURANCE_OFFICER = 'oao@cacert.org';
//defines to whom to send the lists //defines to whom to send the lists
$flags = array( $flags = array(
'admin' => array( 'admin=1' => array(
'name' => 'Support Engineer', 'name' => 'Support Engineer',
'own' => false, //Don't send twice 'own' => false, //Don't send twice
'board' => true, 'board' => true,
@ -36,7 +36,7 @@ $flags = array(
'oao' => false 'oao' => false
), ),
'orgadmin' => array( 'orgadmin=1' => array(
'name' => 'Organisation Assurer', 'name' => 'Organisation Assurer',
'own' => true, 'own' => true,
'board' => true, 'board' => true,
@ -45,7 +45,7 @@ $flags = array(
'oao' => true 'oao' => true
), ),
'board' => array( 'board=1' => array(
'name' => 'Board Member', 'name' => 'Board Member',
'own' => false, 'own' => false,
'board' => true, 'board' => true,
@ -54,7 +54,7 @@ $flags = array(
'oao' => false 'oao' => false
), ),
'ttpadmin' => array( 'ttpadmin=1' => array(
'name' => 'Trusted Third Party Admin', 'name' => 'Trusted Third Party Admin',
'own' => true, 'own' => true,
'board' => true, 'board' => true,
@ -63,7 +63,16 @@ $flags = array(
'oao' => true 'oao' => true
), ),
'tverify' => array( 'ttpadmin=2' => array(
'name' => 'Trusted Third Party TOPUP Admin',
'own' => true,
'board' => true,
'support' => true,
'ao' => true,
'oao' => true
),
'tverify=1' => array(
'name' => 'Tverify Admin', 'name' => 'Tverify Admin',
'own' => false, 'own' => false,
'board' => true, 'board' => true,
@ -72,7 +81,7 @@ $flags = array(
'oao' => false 'oao' => false
), ),
'locadmin' => array( 'locadmin=1' => array(
'name' => 'Location Admin', 'name' => 'Location Admin',
'own' => false, 'own' => false,
'board' => true, 'board' => true,
@ -80,13 +89,34 @@ $flags = array(
'ao' => false, 'ao' => false,
'oao' => false 'oao' => false
), ),
'adadmin=1' => array(
'name' => 'submit status for Advertising Admin',
'own' => false,
'board' => true,
'support' => true,
'ao' => false,
'oao' => false
),
'adadmin=2' => array(
'name' => 'approve status for Advertising Admin',
'own' => false,
'board' => true,
'support' => true,
'ao' => false,
'oao' => false
),
); );
// Build up list of various admins // Build up list of various admins
$adminlist = array(); $adminlist = array();
foreach ($flags as $flag => $flag_properties) { foreach ($flags as $flag => $flag_properties) {
$query = "select `fname`, `lname`, `email` from `users` where `$flag` = 1"; $flagname = explode('=', $flag, 2 );
$query = "select `fname`, `lname`, `email` from `users` where `$flagname[0]` = '$flagname[1]'";
if(! $res = mysql_query($query) ) { if(! $res = mysql_query($query) ) {
fwrite(STDERR, fwrite(STDERR,
"MySQL query for flag $flag failed:\n". "MySQL query for flag $flag failed:\n".
@ -130,6 +160,7 @@ CAcert Support
EOF; EOF;
sendmail($admin['email'], "Permissions Review", $message, 'support@cacert.org'); sendmail($admin['email'], "Permissions Review", $message, 'support@cacert.org');
echo "Sent $flag_properties[name] mail to $admin[email]\n";
} }
} }
} }
@ -163,12 +194,13 @@ Best Regards,
CAcert Support CAcert Support
EOF; EOF;
foreach ($adminlist['admin'] as $support_engineer) { foreach ($adminlist['admin=1'] as $support_engineer) {
sendmail( sendmail(
$support_engineer['email'], $support_engineer['email'],
"Permissions Review", "Permissions Review",
$message, $message,
'support@cacert.org'); 'support@cacert.org');
echo "Sent Support Engineer mail to $support_engineer[email]\n";
} }
@ -214,4 +246,5 @@ CAcert Support
EOF; EOF;
sendmail($values['email'], "Permissions Review", $message, 'support@cacert.org'); sendmail($values['email'], "Permissions Review", $message, 'support@cacert.org');
echo "Sent $values[description] mail to $values[email]\n";
} }