From f5a92f911589802b7a7046410def4891fd60c267 Mon Sep 17 00:00:00 2001 From: Brett Bieber <brett.bieber@gmail.com> Date: Tue, 29 May 2012 08:50:17 -0500 Subject: [PATCH] Add support for a list of authorized usernames --- config.sample.php | 3 ++- index.php | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/config.sample.php b/config.sample.php index 6107111..3e5a7b0 100644 --- a/config.sample.php +++ b/config.sample.php @@ -4,6 +4,7 @@ $options = array(); $options['bind_dn'] = 'uid=youruseridhere,ou=service,dc=unl,dc=edu'; $options['bind_password'] = 'passwordhere'; +$authorized_users = array('hhusker0'); function autoload($class) { @@ -17,4 +18,4 @@ spl_autoload_register("autoload"); ini_set('display_errors', true); error_reporting(E_ALL); -set_include_path(dirname(__FILE__).'/vendor/php'); \ No newline at end of file +set_include_path(dirname(__FILE__).'/vendor/php'); diff --git a/index.php b/index.php index 6efbb97..e77ba5c 100644 --- a/index.php +++ b/index.php @@ -14,6 +14,12 @@ if (!$auth->isLoggedIn()) { exit; } +if (empty($authorized_users) + || !in_array($auth->getUser(), $authorized_users)) { + echo 'You are not authorized to use this tool. Contact the UNL Identity Management Team.'; + exit; +} + echo '<h1>Upload a file containing NUIDs or My.UNL Usernames</h1> <form action="" method="post" enctype="multipart/form-data"> File <input type="file" name="userfile" /> -- GitLab